function callDomain(id,val) {
	 inputDomain = $(id).attr('value');
	 if (inputDomain == '') {
	 	$(id).attr('value',val);
	 }
}
function goBack()
  {
  window.history.back()
  };
function newLocation(bien)
{
	var newlink	=	bien;
window.location=newlink;
}

//Chức năng GiveEmail
function getposOffset(overlay, offsettype){
	var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
	var parentEl=overlay.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}
function overlay(curobj, subobjstr, opt_position){
	if (document.getElementById){
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		if((typeof opt_position!="undefined" && opt_position.indexOf("top")!=-1))
			ypos=getposOffset(curobj, "top")-subobj.offsetHeight-3;
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
		return true
}
function overlayclose(subobj){
	document.getElementById(subobj).style.display="none"
};
function v3s_over(id) {
	if (id < 8) {
		document.getElementById("topr").style.background='url(themes\/default\/images\/'+id+'.jpg) top left no-repeat';
		document.getElementById("topr").style.display = 'none';
		$('#topr').fadeIn("slow");
	}
};
function v3s_mntop(id,name) {
	var c='mt'+id;
	document.getElementById(c).style.background='url(themes\/default\/images\/'+name+'.jpg) top no-repeat';
};
function ov(id,rename){
	document.getElementById(id).src='themes\/default\/images\/menu\/'+rename;
};
function ov2(id,rename){
	document.getElementById(id).src='lib\/images\/'+rename;
};
function ClickToURL()
{
	var http=document.formURL.SltWeb.value;
	if (http!="")
		window.open(document.formURL.SltWeb.value);
};
function active(j,c)
{
	var id,idj;
	idj	=	"pro_"+j;
	for (i=0;i<=c;i++) {
		id	= "pro_"+i;
		if (id == idj)
			document.getElementById(id).style.display="block";
		else 
			document.getElementById(id).style.display="none";
	}
}
function checkok() {
	if (document.reg.question.checked == true)
		document.reg.submit1.disabled = false;
	else
		document.reg.submit1.disabled = true;
}
function checkempty(count){
	var id=count;
	if (id==0)
	 alert('Giỏ hàng của bạn đang trống, vui lòng chọn thêm hàng !');
}
function setCookie(c_name,value,expiredays)
{var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function CheckSavePass() {
	if (document.reg.checksave.checked == true)
		document.reg.checkvl.value = 1;
	else
		document.reg.checkvl.value = 0;
}
function checkeditem() {
	gid = document.frm.iddetail;
	if (gid != null) {
		str = '';
		z = gid.length;
		if (z == null) { if (gid.checked == true) str= gid.value+','; }
		else {
			for (i=0;i<z;i++) {
				if (gid[i].checked == true) str+= gid[i].value+',';
			}
		}
	}
	return str;
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function thanks(lang){
	alert(lang);
}
function showlayer(m)
{
	var i=m;
	if (i==1){
		document.all.l1.style.display='block';
		document.all.neck.focus();
	}	
	else	
		document.all.l1.style.display='none';
	if (i==2){
		document.all.l2.style.display='block';
		document.all.armpit.focus();
	}	
	else	
		document.all.l2.style.display='none';
	if (i==3){
		document.all.l3.style.display='block';
		document.all.chest.focus();
	}	
	else	
		document.all.l3.style.display='none';
	if (i==4){
		document.all.l4.style.display='block';
		document.all.lowerchest.focus();
	}	
	else	
		document.all.l4.style.display='none';
	if (i==5)
	{
		document.all.l5.style.display='block';
		document.all.waist.focus();
	}	
	else	
		document.all.l5.style.display='none';
	if (i==6){
		document.all.l6.style.display='block';
		document.all.backwaist.focus();
	}	
	else	
		document.all.l6.style.display='none';
	if (i==7){ 
		document.all.l7.style.display='block'; 
		document.all.arms.focus();
	}else	
		document.all.l7.style.display='none';
	if (i==8) {
		document.all.l8.style.display='block'; 
		document.all.hips.focus();
	}else	
		document.all.l8.style.display='none';
	if (i==9) {
		document.all.l9.style.display='block' ;
		document.all.pants.focus()
	}else	
		document.all.l9.style.display='none';
	if (i==10) {
		document.all.l10.style.display='block' ;
		document.all.dresslength.focus();
	}else	
		document.all.l10.style.display='none';
	if (i==11) {
		document.all.l11.style.display='block' ;
		document.all.height.focus();
	}else	
		document.all.l11.style.display='none';
}

