function slideMenu(o,on) {
	if(on){
		o.show().animate({height: 54}, {duration: 400});
		/*var thissound=document.getElementById("sound"+o.attr("id").replace("menu",""));
		thissound.Play();*/
	}else{
		o.show().animate({height: 21}, {duration: 400});
	}
}

function loadMenu() {	
	/*$(".menuImg").mouseover(function(){slideMenu($(this),true);});
	$(".menuImg").mouseout(function(){slideMenu($(this),false);});*/
}

function loadCompany() {	
	$(".clubForum img").mouseover(function(){$(this).removeClass("companyForum");$(this).addClass("companyForumOver");});
	$(".clubForum img").mouseout(function(){$(this).removeClass("companyForumOver");$(this).addClass("companyForum");});
}


function addCompare(product_id, product_name, image_html) {
	var html = "<iframe class=\"product_compare_bar fixed-bottom\" frameborder=0></iframe>" +
		"<div class=\"product_compare_bar dashed fixed-bottom\">" +
			"<div class=\"product_compare_background\"></div>" +
			"<div class=\"product_compare_header\">" +
				"<div class=\"button\" onclick=\"compare();return false;\" onmouseover=\"overButton(this);\" onmouseout=\"outButton(this);\">เปรียบเทียบ</div>" +			
				"<div class=\"button\" onclick=\"minimizeCompare();return false;\" onmouseover=\"overButton(this);\" onmouseout=\"outButton(this);\">_</div>" +
				"<div class=\"button\" onclick=\"closeCompare();return false;\" onmouseover=\"overButton(this);\" onmouseout=\"outButton(this);\">X</div>" +
			"</div>" +
			"<div class=\"product_compare_list\"></div>" +
			"<form method=\"POST\" action=\"http://www.tabletd.com/tablets/compare\" id=\"frmProductCompare\">" +
				"<input id=\"products_id\" name=\"products_id\" class=\"product_compare_list_id\" type=\"hidden\" value=\"\">" +
			"</form>" +
		"</div>" +
		"<div class=\"icon_compare fixed-bottom\" onclick=\"showCompare();return false;\">" +
			"<div class=\"icon\"></div>" +
		"</div>";
	if(!$(".product_compare_bar").length){
		$("body .content").append(html);
	}
	showCompare();
	// keep product_id into list_product_compare_id element
	if($(".product_compare_list_id").val().indexOf(product_id+",") == -1){
		var product_list_id = $(".product_compare_list_id").val();
		$(".product_compare_list_id").val(product_list_id + product_id+",");
		var html = $(".product_compare_list").html() + "<div class=\"product\" id=\"product"+product_id+"\">";
		html += "<table cellspacing=0 cellpadding=0>";
		html += "<tr><td>";
		html += "<div class=\"product_picture\">"+image_html+"</div>";
		html += "<div class=\"product_name\">"+product_name+"</div>";
		html += "</td></tr></table></div>";
		$(".product_compare_list").html(html);			
	}	
}

function overButton(o){
	o.className = "overButton";
}

function outButton(o){
	o.className = "button";
}

function compare(){
	if($(".product_compare_list_id").val() == ""){
		alert("กรุณาเลือกแท็บเล็ตที่ต้องการเปรียบเทียบ");
	}else{
		document.getElementById("frmProductCompare").submit();
	}
}

function closeCompare(){
	if(confirm('คุณต้องการที่จะยกเลิกการเปรียบเทียบแท็บเล็ตนี้ใช่หรือไม่ ?')){
		$('.product_compare_bar').remove();	
		$('.icon_compare').remove();
	}
}

function showCompare(){
	$('.icon_compare').hide('slow');	
	if(!$('.product_compare_bar').is(":visible")){
		$('.product_compare_bar').show('blind');
	}
}

function minimizeCompare(){
	$('.product_compare_bar').hide('slow');
	$('.icon_compare').show('blind');	
}
