var t_height,t_gap, container_height=0;
jQuery(document).ready(function(){
//search box
	var tl_keyword='Keyword ...';
	jQuery(".mainsearch .keyword").val(tl_keyword);
	
	jQuery(".mainsearch").hover(
		function () {
			jQuery(".mainsearch .keyword").css('visibility', 'visible');
			jQuery(this).addClass("mainsearch_hover");
		},	
		function () {
			if(jQuery(".mainsearch .keyword").val()==tl_keyword){
				jQuery(".mainsearch .keyword").css('visibility', 'hidden');
				jQuery(this).removeClass("mainsearch_hover");
			}
	});
	jQuery(".mainsearch .keyword").bind("focus", function(){
  		if(jQuery(this).val()==tl_keyword) jQuery(this).val('');
	});
	
	jQuery(".mainsearch .keyword").bind("blur", function(){
  		if(jQuery(this).val()==''){
  			jQuery(this).val(tl_keyword);
  			jQuery(this).css('visibility', 'hidden');
  			jQuery(".mainsearch").removeClass("mainsearch_hover");
  		}
	});
//drop-down menu
	jQuery("div.menu ul ul li:has(ul)").find("a:first").append(" &raquo;");

//remove the last sidebar background 
	//jQuery("#sidebar1>ul>li:last").css('background', 'none');

//make sure the background showing
	//if(jQuery("#content").height()<350) jQuery("#content").css("padding-bottom","350px");

//check the repeat background
	checkheight();
	setInterval("checkheight()",2000);

//resize
	jQuery(window).resize();
});

jQuery(window).resize(
function(){
	if(jQuery("body").width()%2 !=0){
		jQuery("body").css("margin-left","1px");
	};
});

function checkheight(){
	if(container_height!=jQuery("#container").height()){
		jQuery("#container").css({"padding-bottom":"0px","margin-bottom":"0px"});
		t_height=jQuery("#container").height()-6;
		t_gap=Math.ceil(t_height/9)*9-t_height;
		jQuery("#container").css({"padding-bottom":t_gap+"px"});
		container_height=jQuery("#container").height();
	}
}
