document.write("<script src='js/validator.js' type='text/javascript' language='javascript'></script>");
var timerID = null; 
var timerRunning = false; 
function stopclock (){ 
if(timerRunning) 
clearTimeout(timerID); 
timerRunning = false;} 
function startclock () { 
stopclock(); 
showtime();} 
function showtime () { 
var now = new Date(); 
var hours = now.getHours(); 

var day  = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var month  = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

var minutes = now.getMinutes(); 
var seconds = now.getSeconds() 
//var timeValue = "" +((hours >= 12) ? "PM" : "AM" ) 
//timeValue += ((hours >12) ? hours -12 :hours) 
//timeValue += ((minutes < 10) ? ":0" : ":") + minutes 
//timeValue += ((seconds < 10) ? ":0" : ":") + seconds 
//timeValue+= day[now.getDay()];
//timeValue+= month[now.getMonth()];
var timeValue =""+day[now.getDay()];
timeValue +=",";
timeValue +=month[now.getMonth()];
timeValue +=" ";
timeValue +=now.getDate();
timeValue +="";
timeValue +=",";
timeValue +=now.getFullYear();
timeValue +=" ";
timeValue += ((hours >12) ? hours -12 :hours) 
timeValue += ((minutes < 10) ? ":0" : ":") + minutes 
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue +=" ";
timeValue +=((hours >= 12) ? "PM" : "AM" );
document.getElementById("thetime").innerHTML=timeValue;  
//document.thetime.innerHTML  = timeValue; 
timerID = setTimeout("showtime()",1000); 
timerRunning = true;} 





var flag=false; 

function DrawImage(ImgD,awidth,aheight){ 

var image=new Image(); 

image.src=ImgD.src; 

if(image.width>0 && image.height>0){ 

  flag=true; 

  if(image.width/image.height>= awidth/aheight){ 

   if(image.width>awidth){

    ImgD.width=awidth; 

    ImgD.height=(image.height*aheight)/image.width; 

   }else{ 

    ImgD.width=image.width;

    ImgD.height=image.height; 

   }

   /*ImgD.alt="bigpic"  */

  } 

  else{ 

   if(image.height>aheight){

    ImgD.height=aheight; 

    ImgD.width=(image.width*awidth)/image.height; 

   }else{ 

    ImgD.width=image.width;

    ImgD.height=image.height; 

   } 

    /*ImgD.alt="bigpic"  */ 

  } 

}

}







function regetImage(obj) {
    var today = new Date();
	var today_ms = ""
		+ today.getFullYear() + (today.getMonth() + 1) + today.getDate()
		+ today.getMinutes() + today.getSeconds() + today.getMilliseconds();
    obj.src = 'include/auth/getimg.php?' + today_ms;
}


function fRandomBy(under, over){
switch(arguments.length){
case 1: return parseInt(Math.random()*under+1);
case 2: return parseInt(Math.random()*(over-under+1) + under);
default: return 0;
}
}


function addcart(id){
if(confirm('你是否决定把该相片删除？')){
	location.href='member.php?act=delphoto&id='+id;
}else{
	return false;
}
}



function bookmarkit(href,title)
 {
	 if(href==""){
		href=location.href;
	 }
	 if(title==""){
		title=document.title;
	 }	 
	 window.external.addFavorite(href,title);

	 }




function changeImg(mypic){
	
    var xw=240;
    var xl=300;
        
    var width = mypic.width;
    var height = mypic.height;
    var bili = width/height;        
        
    var A=xw/width;
    var B=xl/height;
        
    if(!(A>1&&B>1))
    {
        if(A<B)
        {
            mypic.width=xw;
            mypic.height=xw/bili;
        }
        if(A>B)
        {
            mypic.width=xl*bili;
            mypic.height=xl;
        }
    }
} 



function imageview(temp,type) {
    var windowprops = "height=350,width=450,toolbar=no,menubar=no,resizable=no,status=no";
    if (type=="1"){
        windowprops+=",scrollbars=yes";
        var imgsc = "yes";
    } else {
        var imgsc = "";
    }
    if (temp.length == 0) { 
        alert("图片地址不能为空"); 
        return; 
    }

    var n4 = (document.layers)?true:false;
    if (n4) {
        var url = escape(temp);
    } else {
        var url = temp;
    }
    window.open(url, "win", windowprops);
}


 function count_change(temp)
 {
   var test=document.form1.count.value;
   if(temp==0){
      test++;
   }else if(temp==1){
      if(test> 1) test--;
   }
   document.form1.count.value=test;
 }
 
 
 function resizeImg(obj, maxw) {
    var obj = document.getElementById(obj);
	if(!obj) return;
    var imgs = obj.getElementsByTagName('img');
    var imgCount = imgs.length;
    if(imgCount==0) return;
    for(var i=0; i<imgCount; i++) {
        if(imgs[i].width>maxw) {
            var oldw = imgs[i].width;
            var oldh = imgs[i].height;
            imgs[i].style.width = maxw +'px';
            imgs[i].style.height = (maxw/oldw*oldh) +'px';
        }
    }
}
//window.onload = function() {resizeImg('mainpage', 900);}


function checkAddForm(objForm) {
	if (objForm.username.value=="") { 
		alert("请输入用户名！");
		objForm.username.focus();	    
		return false;
	}
	if (objForm.phone.value==""){
		alert("请输入联系电话！");
		objForm.phone.focus();	    
		return false;
	}
}
function checkLoginForm(objForm) {
	if (objForm.username.value=="") {
	    alert("请输入用户名！");
		objForm.username.focus();	    
		return false;
	}
	if (objForm.password.value==""){
	    alert("请输入密码！");
		objForm.password.focus();	    
		return false;
	}
}


function changeImg(mypic){
	
    var xw=196;
    var xl=312;
        
    var width = mypic.width;
    var height = mypic.height;
    var bili = width/height;        
        
    var A=xw/width;
    var B=xl/height;
        
    if(!(A>1&&B>1))
    {
        if(A<B)
        {
            mypic.width=xw;
            mypic.height=xw/bili;
        }
        if(A>B)
        {
            mypic.width=xl*bili;
            mypic.height=xl;
        }
    }
} 


function locahref(){
	 username = document.getElementById("cusername").value;
	 window.open("check.php?username="+username);
}


function Check(id)
{
	
if(!confirm("你确定将此信息删除吗?"))
{return false;}
location.href='member.php?act=public_del&id='+id;
} 

function Checkco(id)
{
	
if(!confirm("你确定将此信息删除吗?"))
{return false;}
location.href='member.php?act=collect_del&id='+id;
} 

function Checkpr(id)
{
	
if(!confirm("你确定将此信息删除吗?"))
{return false;}
location.href='member.php?act=product_del&id='+id;
} 




function cswitch(tid,box,num,tag){
if(tid==null || box==null || num==null) return;
var tabs=document.getElementById(tid);
if(tabs==null) return;
if(tag=="") tag="LI";
tabs=tabs.getElementsByTagName(tag);
for(n=0;n<tabs.length;n++){
	 if(num==n){
		tabs[n].id="current";
		document.getElementById(box+n).className="sw";
	 }else{
		tabs[n].id="";
		document.getElementById(box+n).className="hd";
	 }	
}	
}


			function OMOver(OMO){OMO.style.backgroundColor='#FFFBF2';OMO.cells[0].style.color='#927500';}
			function OMOut(OMO){OMO.style.backgroundColor='';OMO.cells[0].style.color='';}
			function OMOver2(OMO){OMO.style.backgroundColor='#FFFBF2';OMO.cells[1].style.color='#927500';}
			function OMOut2(OMO){OMO.style.backgroundColor='';OMO.cells[1].style.color='';}
			
function checkValidator(obj){
//if (obj.b_byway.value==1) {
//	if(obj.b_address.value==""){
//	alert("请填写完整地址");
//	return false;
//	}
//}
//alert(obj.b_byway.length);
//    for (i=0; i<obj.b_byway.length; i++)
//    {
//        if (obj.b_byway[i].checked)
//        {
//            alert("您选择项的 value 是：" + obj.b_byway[i].value);
//            break;
//        }
//    }
if(obj.b_byway[0].checked==1){
 if(obj.b_address.value==""){
	alert("请填写完整地址");
	obj.b_address.focus();
    return false;
	}
}

if(obj.b_byway[2].checked==1){
 if(obj.b_money.value==""){
	alert("请填写质押金额");
	obj.b_money.focus();
    return false;
	}
}
	

 if(obj.en_editor.value=="" && obj.source.value=="" && obj.tk_content.value==""){
	alert("手机、固话、Email必须填写一项");
	obj.en_editor.focus();
    return false;
}


return Validator.Validate(obj,2);
}


function checkValidator_s(obj){

 if(obj.en_editor.value=="" && obj.source.value=="" && obj.tk_content.value=="" && obj.en_content.value==""){
	alert("手机、固话、Email必须填写一项");
	obj.en_editor.focus();
    return false;
}


return Validator.Validate(obj,2);
}





function imeWin(file,w,h){
   window.open(file,'','resizable=yes,width='+w+",height="+h+',scrollbars=yes,left='+(screen.availWidth-w)/2+',top='+(screen.availHeight-h)/2);
}


//
//var online=new Array();
//if (!document.layers)
//document.write('<div id=divStayTopLeft style=position:absolute>');
//document.write('<table cellSpacing="0" cellPadding="0" width="110" border="0" id="qqtab">');
//document.write('    <tr>');
//document.write('      <td width="110" onclick="if(document.all.qqtab.style.display==\'none\'){document.all.qqtab.style.display=\'\'} else {document.all.qqtab.style.display=\'none\'}"><img src="images/top.gif" border="0"></td>');
//document.write('    </tr>');
//document.write('    <tr id="qqstab">');
//document.write('      <td valign="middle" align="center" background="images/middle.gif">');
//document.write('<table border="0" width="90" cellSpacing="0" cellPadding="0">');
//document.write(' <tr>');
//document.write('    <td width="90" height="5" border="0" colspan="2"></td>');
//document.write(' </tr>');
//
//document.write(' <tr>');
//document.write('    <td colspan="2"valign="middle" align="center">');
//    document.write('客服一号');
//    document.write('    </td>');
//document.write(' </tr>');
//document.write(' <tr>');
//document.write('    <td colspan="2" height="27" valign="middle" align="center">');
//    document.write('<A href="tencent://message/?uin=153788639&amp;Site=客服一号&amp;Menu=yes"><IMG alt="" src="images/qq_online.gif" border=0></A><br>');
//    document.write('    </td>');
//document.write(' </tr>');
//
//
//
//
//
//
//document.write(' <tr>');
//
//document.write('</table>');
//document.write('</td>');
//document.write('    </tr>');
//document.write('    <tr>');
//document.write('<td width="110"><img src="images/bottom.gif" border="0"></td>');
//document.write('    </tr>');
//document.write('</table>');
//var verticalpos="frombottom"
//if (!document.layers)
//document.write('</div>')
//function scrollqq()
//{
//var posXqq,posYqq;
//if (window.innerHeight)
//{
//posXqq=window.pageXOffset;
//posYqq=window.pageYOffset;
//   }
//   else if (document.documentElement && document.documentElement.scrollTop)
//      {
//    posXqq=document.documentElement.scrollLeft;
//    posYqq=document.documentElement.scrollTop;
//    }
//    else if (document.body)
//      {
//    posXqq=document.body.scrollLeft;
//    posYqq=document.body.scrollTop;
//      }
//     var divStayTopLeft=document.getElementById("divStayTopLeft");
//    divStayTopLeft.style.top=(posYqq+450-200)+"px";
//divStayTopLeft.style.left=(posXqq+screen.width-131)+"px";
//setTimeout("scrollqq()",500);
//    }
//      scrollqq();
	  



function active(i,id){
	if(i=="sw"){
	 	document.getElementById("active"+id).className="sw nextCategories";
	}
		if(i=="hd"){
	 	document.getElementById("active"+id).className="hd";
	}
}

function subsort(id,act){
sortact.action="product"+id+"-"+act+".html";
//alert(sortact.action);
//product"+id+"-"+act+".html
//alert(obj);
sortact.submit();
}


function makeup(r){
				var url=r;
				var img=document.getElementById("pushimg");
				img.src=url;
				img.alt=url;
				
				 var sections=document.getElementsByTagName("a");
				  for(var i=0;i<sections.length;i++){
					  var section=sections[i];
					   if(section.getAttribute("rel")=="lightbox"){
						    section.href=url;
					   }
				  }

				}
				
function option(id){
 document.getElementById("productOptions_"+id).innerHTML=document.getElementById("hide_"+id).innerHTML;
 return false;
}

function sameas(obj){
	if(obj.checked){
		document.getElementsByName("sp_mobile")[0].value=document.getElementsByName("mobile")[0].value;
		document.getElementsByName("sp_truename")[0].value=document.getElementsByName("truename")[0].value;
		document.getElementsByName("sp_company")[0].value=document.getElementsByName("company")[0].value;
		document.getElementsByName("sp_telephone")[0].value=document.getElementsByName("telephone")[0].value;
		document.getElementsByName("sp_address")[0].value=document.getElementsByName("address")[0].value;
		document.getElementsByName("sp_state")[0].value=document.getElementsByName("state")[0].value;
		document.getElementsByName("sp_postid")[0].value=document.getElementsByName("postid")[0].value;
		document.getElementsByName("sp_city")[0].value=document.getElementsByName("city")[0].value;
		//document.getElementsByName("sp_country")[0].innerHTML=document.getElementsByName("country")[0].innerHTML;
//var t = document.getElementsByName("country")[0]; 
//alert(t.options[t.selectedIndex].index); 
//var sp_t = document.getElementsByName("sp_country")[0]; 
//sp_t.options[sp_t.selectedIndex].index=t.options[t.selectedIndex].index;
//document.getElementsByName("sp_country")[0].innerHTML=document.getElementsByName("country")[0].innerHTML;
//alert(document.getElementsByName("country")[0].innerHTML);
        //document.getElementsByName("sp_country")[0].value=document.getElementsByName("country")[0].value;
				
				
	}
	//alert(document.getElementsByName("mobile")[0].value);
//	alert(obj.checked);
}

function completeid(id,payby){
 document.getElementById("aid").value=id;
 document.getElementById("payby").value=payby;
 orderadd.submit();
}




function copyToClipboard(txt) {
      if(window.clipboardData) {
              window.clipboardData.clearData();
              window.clipboardData.setData("Text", txt);
      } else if(navigator.userAgent.indexOf("Opera") != -1) {
           window.location = txt;
      } else if (window.netscape) {
           try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
           } catch (e) {
                alert("error");
           }
           var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
           if (!clip)
                return;
           var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
           if (!trans)
                return;
           trans.addDataFlavor('text/unicode');
           var str = new Object();
           var len = new Object();
           var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
           var copytext = txt;
           str.data = copytext;
           trans.setTransferData("text/unicode",str,copytext.length*2);
           var clipid = Components.interfaces.nsIClipboard;
           if (!clip)
                return false;
           clip.setData(trans,null,clipid.kGlobalClipboard);
      }
}