/* 
Client			: ACST - Australian College of Sports Therapy
Description		: common.js - needs jquery lib
Created By		: Bjorn de Lima
Created Date	: Mid-2009

*/

// JavaScript Document
$(document).ready(function(){
		$(".popup").click(function(){
						window.open($(this).attr('href'),'window',"width=565,height=600")
						return false;
						});
		$("#mainmenu ul li").click(function(){
						
						$("#mainmenu ul li ul").css({
								display : 'none'		 
								});	
						$(this).find('ul').css({
								display : 'block',
								top : $(this).offset().top + $(this).height(),
								left : $(this).offset().left 							
								});
						
						if ($(this).attr('class')=='last'){
							$(this).find('ul').css({
									left : $(this).offset().left - 53
									});
							}
						
						$(this).find('ul').hide();
						
						$(this).find('ul').fadeIn("medium");
						
						//return false;
						});	
		
		
		$("#mainmenu > ul > li.first").mouseover(function(){
							$(this).find('a:first').css({
								backgroundColor : '#6ABFE8',
								cursor : 'pointer',
								color : '#fff',
								borderBottomColor : '#9DD2EC',
								borderBottomWidth : '1px',
								borderBottomStyle : 'solid'
								});			
						});
		$("#mainmenu > ul > li.first").mouseout(function(){
							$(this).find('a:first').css({
								backgroundColor : '',
								borderBottomColor : '#4EAEDE',
								borderBottomWidth : '1px',
								borderBottomStyle : 'solid'
								});			
						});
		
		if ($("body").is('#index')){
			var obj = new SWFObject("./flash/ball.swf", "ballflash", '200', '450', "9");
			}
		else{
			var obj = new SWFObject("../flash/ball.swf", "ballflash", '200', '450', "9");
			}
		 
  		 obj.addParam("wmode","transparent")
  		 obj.write("ballflash");
		 
		 if ($("body").is('#finder')){
			 var obj2 = new SWFObject("../flash/finder.swf", "find", '540', '200', "9");
			obj2.addParam("wmode","transparent")
			 obj2.write("find");
		 }
		 
		 $(".jsselect").click(function(){
				$(".dropitem").css({
						display : 'block',
						left: $(this).offset().left + 11
						});		   
								
				$(".dropitem a").click(function(){
						$("span.dropitem").css({
							display : 'none'
						});	
					
						$("#type").attr('value',$(this).text());
						$(".jsselect").text($(this).text());
						return false;
					});				
				
								
				});
		 
		}); // domready end
