﻿var ls_path = "/luxury" ; 

function test1(form) {
	if (form.text1.value == "") {
		alert("Please enter a string!")
	}
	else {
		alert("Hi "+form.text1.value+"! Form input ok!");
	}
}

function test2(form) {
	if (form.text2.value == "" || form.text2.value.indexOf('@', 0) == -1)
		alert("No valid e-mail address!");
	else alert("OK!");
}

function Addcat(catid,number,spec,name,price){   
	if (number<=0) Deletecookie("mycat"+catid);  
	else
		//decodeURI(a);  //encodeURI 编码 decodeURI 解码   
		tmp = encodeURI( catid+","+number+","+spec+","+name+","+price ) ;  
		setcookies("mycat"+catid,tmp); 
		//document.cookie = catid + "=" + "1"  ; 
		var cat=window.open(ls_path+"/read.php","cat","toolbar=no,menubar=no,location=no,status=no,width=520,height=280");
		cat.document.execCommand("refresh");
		cat.focus();
}

function Addcat2(catid,number,spec,spec2,name,price,cata){   
	if (number<=0) Deletecookie("mycat"+catid);  
	else
		//decodeURI(a) ; //encodeURI 编码 decodeURI 解码  
		tmp = encodeURI( catid+","+number+","+spec+","+spec2+","+name+","+price ) ;  
		setcookies("mycat"+catid,tmp); 
		//document.cookie = catid + "=" + "1"  ; 
		//var cat=window.open(ls_path+"/read.php","cat","toolbar=no,menubar=no,location=no,status=no,width=520,height=280");
		//cat.document.execCommand("refresh");
		//cat.focus();
		//window.location.href(ls_path+"/read.php");		
		window.location.replace(ls_path+"/read.php?cata="+cata+"&res=1&name="+name);
}

function Deletecat(catid){
	deletecookie("mycat"+catid); 
	var cat=window.open(ls_path+"/read.php","cat","toolbar=no,menubar=no,location=no,status=no,width=520,height=280"); 
	cat.document.execCommand("refresh");
	cat.focus();
} 

function Deletecat2(catid){
	deletecookie("mycat"+catid); 
	//var cat=window.open(ls_path+"/read.php","cat","toolbar=no,menubar=no,location=no,status=no,width=520,height=280"); 
	cat.document.execCommand("refresh");
	cat.focus();
} 

function setcookies(name, value) { //设置名称为name,值为value的Cookie
	var argc = setcookies.arguments.length;
    var argv = setcookies.arguments;
	 
	var path   = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
　　var Days = 30; //
　　var exp　= new Date();
　　exp.setTime(exp.getTime() + Days*24*60*60*1000);
	//document.cookie = name + "=" + value  + ";path=/;expires=" + exp.toGMTString();  
	document.cookie = name + "=" + value  + ";path=/;domain=.dijiya.com" ; 

	//alert(value) ; 
	//alert(argc) ;
	//alert(path) ;

}
function showcat(){
	var strCookie=document.cookie;
	alert(strCookie); 

	var cat=window.open(ls_path+"/read.php","cat","toolbar=no,menubar=no,location=no,status=no,width=520,height=280");
	cat.document.execCommand("refresh");
	cat.focus();
}
function deletecookie (name) { //删除名称为name的Cookie
	var exp = new Date();
	exp.setTime (exp.getTime() - 1);
	var cval = GetCookie (name);
	document.cookie=name+"="+cval+";expires="+exp.toGMTString() +";path=/;domain=.dijiya.com" ;
}
function Clearcookie() { //清除COOKIE
    var temp = document.cookie;
	var loop3;
	var ts;	
    temp=document.cookie.split(";");	
	for (loop3=0;loop3<temp.length;loop3++) {  
		ts=temp[loop3].split("=")[0];
    		if (ts.indexOf('mycat')!=-1)   
			    deletecookie(ts); //如果ts含“mycat”则执行清除		
	}
}	
function getCookieVal (offset) { //取得项名称为offset的cookie值
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1) 	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) { //取得名称为name的cookie值
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)  return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
return null;
} 
function Addwish(proid){   
   //alert(proid+"'"+proname+"'") ;
   window.open(ls_path+"/addwish.php?proid="+proid, 
	   "wish","toolbar=no,menubar=no,location=no,status=no,width=520,height=280");
	
}
function view_pic(path,ia){   
  // alert(proid+"'"+proname+"'") ;
   window.open(path, "view","toolbar=no,menubar=no,location=no,resizable=yes,status=no,width=1000,height=650");
	
}
function view_pro(rno,cata){
//alert("fadfa");
   window.open(ls_path+"/view.php?rno="+rno+"&cata="+cata);
}7070
