jQuery.noConflict(); 

jQuery(document).ready(function(){		

	function page_set_heights(){	
		var lft = jQuery("div.content");
		var rgt = jQuery("div.right-content");
		var mid = jQuery("div#content");
		
		//alert("l:"+lft.height()+" r:"+rgt.height()+" m:"+mid.height())
		
		// 200 : 100	
		if(mid.height() >= rgt.height() - 19){	// m200
			lft.height(mid.height()-80);		// l120
			rgt.height(mid.height()+19);		// r219
		}
		
		// 100 : 100
		// 81  : 100
		if(mid.height() < rgt.height() - 19){	// m100
			mid.height(rgt.height()-19);		// m81
			lft.height(mid.height()-80);		// l1
			rgt.height(mid.height()+19);		// r100
		}
		//alert("l:"+lft.height()+" r:"+rgt.height()+" m:"+mid.height())
	}
	
	page_set_heights();
	
	jQuery(window).scroll(function () { 
		page_set_heights();
    });


	
	/*if(lft.height() > (rgt.height() + 98)){
		rgt.height(lft.height() + 98)
	}
	else{
		lft.height(rgt.height() - 98)
	}*/ 	


	//jQuery("ul.wpsc_top_level_categories > li > a").remove(); 
	//jQuery("ul.wpsc_top_level_categories > li > ul").unwrap().unwrap(); 
	
	// first-last li
	jQuery("ul li:first-child").addClass("first");
	jQuery("ul li:last-child").addClass("last");
	
	jQuery("li").has("ul").addClass("arrow");
	
	// slide left
	var closetimer 	= 0;
	var slide_item	= 0;
	
	function slide_open(){
		cancel_timer();
	   	slide_close();
	   	slide_item = jQuery(this).children('ul').css('display','block');
	}	
	
	function slide_close(){
		if(slide_item){
			slide_item.css('display','none');
		}
	}
	
	function cancel_timer(){  
		if(closetimer){  
			window.clearTimeout(closetimer);
      		closetimer = null;
		}
	}
	
	function set_timer(){
		closetimer = window.setTimeout(slide_close, 250);
	}
	
	//jQuery("ul#menu-bottom-head-menu.menu li").css('display','none')
	jQuery("ul#menu-bottom-head-menu.menu > li").bind('mouseover', slide_open);
	jQuery("ul#menu-bottom-head-menu.menu > li").bind('mouseout', set_timer);	
	
	jQuery("ul#menu-top-head-menu.menu > li").bind('mouseover', slide_open);
	jQuery("ul#menu-top-head-menu.menu > li").bind('mouseout', set_timer);
	
	//jQuery(".content .left_side div div div > ul > li > ul > li").bind('mouseover', slide_open2);
	//jQuery(".content .left_side div div div > ul > li > ul > li").bind('mouseout', set_timer2);
	document.onclick = slide_close;
	
	jQuery("form.customcontactform-sidebar div").addClass("required");
	jQuery("form.customcontactform div:nth-child(1)").addClass("required");
	jQuery("form.customcontactform div:nth-child(2)").addClass("required");
	jQuery("form.customcontactform div:nth-child(3)").addClass("required");
	
	//console.log(mid)
})

