// JavaScript Document
function displayAddress(value){
	$("#showaddress").load("<?php echo MAIN_URL;?>modules/ajax/footer_address_ajax.php?Id="+ value);
}

function showMenuit(f){
	if(f){visi="visible";}
	else{visi="hidden";}
	if(document.layers){document.menuit.visibility=visi;}
	if(document.all){document.all.menuit.style.visibility=visi;}
	if(document.getElementById){document.getElementById("show_hotline").style.visibility=visi;}
} 


function ajaxPost(){
    var email = (document.getElementById("email").value);
	if(email==""){
		alert("Bạn chưa điền email !");
		return false;
	}else{
		if(email.indexOf("@")==-1 || email.indexOf(".")==-1){
			alert("Không fải Email ! Bạn hãy viết đầy đủ");
			return false;
		}else{
			document.getElementById("hienthiok").innerHTML = '<img src=/includes//images/awaiting1111.gif>';
			poststr=email;
			$("#hienthiok").load("/modules/ajax/email_register_ajax.php",{
				DATA : poststr
			});
		}
	}
	
}

function goComparePage(categoryId){
    var compareList = document.getElementById("hdn_compare_product_list").value;
    var numberProduct = compareList.split(';').length;
    if(numberProduct > 3){
		window.location.href = "/?option=compare&catId="+ categoryId +"&hdn_compare_product_list="+compareList;
       // alert(numberProduct);
    }else{
        alert("Bạn cần chọn ít nhất 2 sản phẩm để so sánh\nChọn sản phẩm bằng tích ô dưới ảnh sản phẩm");
    }
}

function checkEmail(){
	var email = document.getElementById("email").value;
	if(email==""){
		alert("Bạn chưa điền email !");
		return false;
	}else{

		if(email.indexOf("@")==-1 || email.indexOf(".")==-1){
			alert("Không fải Email ! Bạn hãy viết đầy đủ");
			return false;
		}
	}
	return true;


}

function share_(giatri)
{
	var	u=location.href;
	var t=document.title;
	if(giatri=="facebook"){
		window.open("http://www.facebook.com/share.php?u="+encodeURIComponent(u)+"&t="+encodeURIComponent(t));
	}else if(giatri=="twitter"){
		window.open("http://twitter.com/home?status=" + encodeURIComponent(u));
	}

}
