function changtab(id,count){
	for(i=1;i<=count;i++){
		document.getElementById('tab_'+i).className='tab_nomal';
		document.getElementById('content_'+i).style.display='none';
	}
	document.getElementById('tab_'+id).className='tab_select';
	document.getElementById('content_'+id).style.display='block';
}
function changtab_detail(id,count){
	for(i=1;i<=count;i++){
		document.getElementById('tab_de_'+i).className='tab_select_detail';
		document.getElementById('content_de_'+i).style.display='none';
	}
	document.getElementById('tab_de_'+id).className='tab_nomal_detail';
	document.getElementById('content_de_'+id).style.display='block';
}
function dsafdf()
{
	document.tinhlai.submit();
}
function web_alert()
{
	alert('Bạn chưa chọn sản phẩm nào !');
}
function buy_detail(){
	document.add_cart.submit();
}
function showContent(id){
	for(i=0;i<=3;i++){
		$("#show-content-"+i).css('display','none');
	}			
	var offset = $("#right-box-"+id).offset();
	$("#show-content-"+id).css({'display':'block','position':'absolute'});
}
function hideContent(id){
	$("#show-content-"+id).css('display','none');
}
function popupWindow(url, width , height)
{
	var def = 'status=no,resizable=no,scrollbars=yes,toolbar=no,location=no,fullscreen=no,titlebar=yes,height='.concat(height).concat(',').concat('width=').concat(width).concat(',');
	def = def.concat('top=').concat((screen.height - height)/2).concat(',');
	def = def.concat('left=').concat((screen.width - width)/2);
	open(url, '_blank', def);
}
function check_contact(){   
	if(document.getElementById("name_contact").value == ""){
		alert("Please Enter your name");
		document.getElementById("name_contact").focus();
		return;
	}
	if(document.getElementById("address_contact").value == ""){
		alert("Please Enter your Address");
		document.getElementById("address_contact").focus();
		return;
	}
	if(document.getElementById("phone_contact").value == ""){
		alert("Please Enter your Phone");
		document.getElementById("phone_contact").focus();
		return;
	}
	if(document.getElementById("email_contact").value == ""){
		alert("Please Enter your Email");
		document.getElementById("email_contact").focus();
		return;
	}
	if(document.getElementById("email_contact").value.length > 0){
		if(!isemail(document.getElementById("email_contact").value)){
			alert("Invalid email");
			document.getElementById("email_contact").focus();
			return;
		}
	}
	if(document.getElementById("name_contact").value == ""){
		alert("Please Enter your name");
		document.getElementById("name_contact").focus();
		return;
	}
	if(document.getElementById("title_contact").value == ""){
		alert("Please Enter title");
		document.getElementById("title_contact").focus();
		return;
	}
	document.contact.submit();
}
function isemail(email) {
	var re = /^(\w|[^_]\.[^_]|[\-])+(([^_])(\@){1}([^_]))(([a-z]|[\d]|[_]|[\-])+|([^_]\.[^_])*)+\.[a-z]{2,3}$/i;
	return re.test(email);
}
