function AddCart(id)
{
	var url="cart.aspx?id="+id;
	var obj=document.getElementById("CartIframe");
	
	if(null!=obj)
	{
		
		obj.setAttribute("src",url);
	}else
  {
  	
			document.body.innerHTML+= "<iframe id='CartIframe' src=\""+url+"\" width=\"0\" height=\"0\" frameborder=\"0\" scrolling=\"no\"><\/iframe>";	
	}
	
}
function GoCart()
{
	window.location.href='cart.aspx'	
}

function CartUpdate(NumInputName,id)
{
    var obj=document.getElementById(NumInputName);
    if(null!=obj)
    {
        //alert(obj.value+"必须是数字");
        window.location.href="cart.aspx?id="+id+"&num="+obj.value;
    }else
    {
        alert("eror");
    }
}
function CartClear()
{
   window.location.href="cart.aspx?action=clear";
}

function CartDelete(id)
{
   window.location.href="cart.aspx?id="+id+"&action=del";
}

function ShopAgain()
{
window.location.href='lamp_lst.aspx'	
}

function OrderCheck()
{
	window.location.href='order_check.aspx'	
} 



function TypeGo()
{
	var tid=0;
	var obj=document.getElementById("tid");
	tid=obj.options[obj.selectedIndex].value;
	//默认pageindex不传递
	var urlfile=getUrlFile();
	window.location.href=urlfile+"?"+getQueryString("tid,pageindex","tid="+tid);
}
function TypeGoVar(tid)
{
	var urlfile="lamp_lst.aspx";
	window.location.href=urlfile+"?"+getQueryString("tid,id,pageindex","tid="+tid);
}

function AttributeGoVar(aid)
{
	var urlfile="lamp_lst.aspx";
	window.location.href=urlfile+"?"+getQueryString("aid,id,pageindex","aid="+aid);
}

function ThemeGoVar(sid)
{
	var urlfile="lamp_lst.aspx";
	window.location.href=urlfile+"?"+getQueryString("sid,id,pageindex","sid="+sid);
}

function AttributeGo()
{
	var aid=0;
	var obj=document.getElementById("aid");
	//默认pageindex不传递
	aid=obj.options[obj.selectedIndex].value; 
	var urlfile=getUrlFile();
	window.location.href=urlfile+"?"+getQueryString("aid,pageindex","aid="+aid);
}
function OrderGo(oby)
{
	var urlfile=getUrlFile();
		window.location.href=urlfile+"?"+getQueryString("oby,pageindex","oby="+oby);
}

function ThemeGo()
{ 
	var sid=0;
	var obj=document.getElementById("sid");
	//默认pageindex不传递
	sid=obj.options[obj.selectedIndex].value; 
	var urlfile=getUrlFile();
	window.location.href=urlfile+"?"+getQueryString("sid,pageindex","sid="+sid);
}

function $G(){
	//arrexcept "aid,tid"
//var arrExcept=strexcept.split(",");
var Url=top.window.location.href;
var u,g,StrBack='';
if(arguments[arguments.length-1]=="#")
   u=Url.split("#");
else
   u=Url.split("?");
if (u.length==1) g='';
else g=u[1];

if(g!=''){
   gg=g.split("&");
   var MaxI=gg.length;
   str = arguments[0]+"=";
   for(i=0;i<MaxI;i++){
      if(gg[i].indexOf(str)==0) {
      	
      	//for(int k=0;k<arrExcept.length;k++)
      	///{
      	//	if(arrExcept[k]==
      	//}
      	
        StrBack=gg[i].replace(str,"");
        break;
      }
   }
}
return StrBack;
}

function getUrlFile()
{
	var Url=top.window.location.href;
	var u=Url.split("?");
	var x=u[0].split("/");
	return x[x.length-1];
}
function getQueryString(strExcept,strAdded){
	//arrexcept "aid,tid"
var arrExcept=strExcept.split(",");
var Url=top.window.location.href;
var u,g,StrBack='';
 
   u=Url.split("?");
if (u.length==1) g='';
else g=u[1];

if(g!=''){
   var gg=g.split("&");
   for(var i=0;i<gg.length;i++)
   {
   	
   		var iIndex=-1;
   		if(strExcept.length>0)
   		{
	   		for(var k=0;k<arrExcept.length;k++)
		   	{
		   			if(gg[i].toLowerCase().indexOf(arrExcept[k]+"=")>=0)
		   			{
		   				iIndex=i;   				
		   			}
		   	}
		   	if(iIndex>=0)
		   	{
		   		gg[i]="";
		   	}
  		}
  		if(gg[i]!="")
  		{
  			StrBack+="&"+gg[i]; 
  		}  	
   	}
	}
		
		if(StrBack.length>0)
		{
			if(strAdded.length>0)
				StrBack+="&"+strAdded;
			StrBack=StrBack.substr(1);
		}
		else
		{
			StrBack=strAdded;
		}
		
		
return StrBack;
}
 
 
function pic_list_move()
{
	var obj=document.getElementById("pic_list");
	var objDest=document.getElementById("pic_list2");
	
	if(null!=obj && null!=objDest)
	{
		objDest.innerHTML=obj.innerHTML;
		obj.style.display="none";
	}		
}

function image_none(_width,_height,_nullimg)
{
		var _obj=document;
		var nImgCount=0;
		if(typeof(_obj.images)!="undefined")
		{
			
			nImgCount=_obj.images.length;
			for(var i=0;i<nImgCount;i++)
			{
				if(_obj.images[i].width==_width && _obj.images[i].height==_height)
				{
					if(_obj.images[i].fileSize<=0)
					{
						_obj.images[i].src="http://www.lampool.com/XShopManagement/UploadHere/default.gif";						
					}
				}
			}							
		}
}
function RedInfo(strVar)
{
	FormatString("({0})",strVar);
}
function FormatString(strFormat,strVar)
{

 strReturn="";
 if(strVar.length>0)
 {
 	strReturn=strFormat.replace("{0}",strVar);
 }
	document.write(strReturn);
}

function ShowReview(var1)
{
	var i=0;
	for(i=0;i<parseInt(var1);i++)
	{
		document.write('<img src="images/review_y.gif" width="18" height="18">');	
	}
	for(;i<5;i++)
	{
			document.write('<img src="images/review_n.gif" width="18" height="18">');	
	}
}

function EditProfile(id)
{
 		window.location.href='profileadt_lst.aspx?action=edit&id='	+id;
}

function DeleteProfile(id)
{
		if(confirm('你确定要删除这条地址记录吗?'))
		{
 			window.location.href='profileadt_lst.aspx?action=del&id='	+id;
 		}
}


function ListProfile()
{
 		window.location.href='profileadt_lst.aspx';
}

function ShowProduct(id)
{
	window.location.href="product.aspx?id="+id;	
}

function ShowOrder(id)
{
	window.location.href="order.aspx?id="+id;	
}
function OrderList()
{
		window.location.href="order_lst.aspx";
}



arrTotal =new Object()
arrTotal["1"]=0
arrTotal["2"]=0
arrTotal["3"]=0
arrTotal["4"]=0
arrTotal["4"]=0
arrTotal["5"]=0
arrTotal["6"]=0
arrTotal["7"]=0
arrTotal["8"]=0
arrTotal["9"]=0
 
function totalx(var1 ,var2)
{
	document.write((var1)+(var2));
}
function total(var1 ,var2,totalname,bOutput)
{
	 if(parseInt(var1)==0)
	 	var1=1;
	 if(parseInt(var2)==0)
	 	var2=1;
	 
   var n1=parseInt(var1);
   var n2=parseInt(var2);
   
   var totalvar=(n1*n2);
   
	if(null!=totalname)
	{
		arrTotal[totalname]+=totalvar;
	}
	
   if(null==bOutput)
   {
   	document.writeln(totalvar);
   }else
   {
   	return totalvar;
   }
}

function getTotal(totalname,bOutput)
{
	if(null==bOutput)
	{
		document.writeln(arrTotal[totalname]);	
	}else
	{
			return arrTotal[totalname];
	}
}

function Gram(var1)
{
	if(parseInt(var1)>1000)
	{
		document.write((parseInt(var1)/1000)+"千克");	
	}else
		{
	document.write(var1+"克");				
		}	
}

var global_browseiframe_name="browseiframe";
function ShowBrowseWin()
{
	document.writeln("<iframe id='iframe_"+global_browseiframe_name+"' src=\"my_browse.aspx\" width=\"0\" height=\"0\" frameborder=\"0\" scrolling=\"no\">");
	document.writeln("<\/iframe>");
	document.writeln("<div id=\""+global_browseiframe_name+"\">");
	document.writeln("<\/div>");
		
}
function LoadBrowse(idname)
{
	//清除使用ｘｍｌ
	var obj=document.getElementById(idname);
	if(null!=obj)
	{
		
		if(obj.innerHTML!="")
		{
				var objIframe=(window.parent.document.getElementById(global_browseiframe_name));
				objIframe.innerHTML=document.body.innerHTML;
				
		}
	}
}
function ShowOrderStatus(id)
{
	document.write(id);
	 	
}

function ClearBrowse()
{
		var objIframe=document.getElementById(global_browseiframe_name);
		objIframe.innerHTML="";
		var objIfrm=document.getElementById("iframe_"+global_browseiframe_name);
		objIfrm.setAttribute("src","my_browse.aspx?action=clear");
}
function ShowDefault(check)
{
	var img_yes="<img src='http://www.lampool.com/images/default_g.gif' />";
	var img_no="<img src='http://www.lampool.com/images/default_n.gif'/>";
	if(1==check)
	{
		document.write(img_yes);		
	}else
		{
			document.write(img_no);	
			}
}
function PriceGoFirst()
{ 
	//display gif
	odr=$G("odr");
	oby=$G("oby");
	if(2!=oby)
	{
		return;
	}
	if(odr==1)
	{
			document.write("<span onclick='javascript:PriceGoVar(1);' style='cursor:hand'><img src='images/price_down.gif' border=0 alt='按价格排序'/></span>");
		}else if(odr==0)
			{
				document.write("<span onclick='javascript:PriceGoVar(0);' style='cursor:hand'><img src='images/price_up.gif' border=0 alt='按价格排序'/></span>");
			} 
		
}
function PriceGoVar(odr)
{
	var urlfile="lamp_lst.aspx";
  if(odr==1)
  {
  	odr=0;
  	}else if(odr==0)
  	{
  		odr=1;
  	}
  
	window.location.href=urlfile+"?"+getQueryString("odr,pageindex","odr="+odr);
}

function PayOnline_CancelOrder(id,status,method)
{
	if(0==status)
	{
		if(3==method)
		{
			document.write("<a href='http://www.lampool.com/order_alipay.aspx?action=do&id="+id+"' >马上在线支付</a>");
		}
		document.write("&nbsp;&nbsp;<a href='order.aspx?id="+id+"&action=cancel' onclick='return confirm(\"确定要作废该订单吗？\")' >作废</a>	");
	}
}

//如果有历史就显示回退
function historyback()
{
	if(history.length>0)
	{
		document.write('<img src="images/back.jpg" width="62" height="25" alt="返回" style="cursor:hand" onclick="history.back();">');
	}
}

//显示评论列表窗体到调用页面
var global_reviewiframe_name="reviewiframe";
function ShowReviewWin()
{
	document.writeln("<iframe id='iframe_"+global_reviewiframe_name+"' src=\"reviews.aspx?id="+$G("id")+"&PageIndex="+$G("PageIndex")+"\" width=\"0\" height=\"0\" frameborder=\"0\" scrolling=\"no\">");
	document.writeln("<\/iframe>");
	document.writeln("<div id=\""+global_reviewiframe_name+"\">");
	document.writeln("<\/div>");
		
}

function Load(idname,iframename)
{
	//清除使用ｘｍｌ
	var obj=document.getElementById(idname);
	if(null!=obj)
	{
		
		if(obj.innerHTML!="")
		{
				var objIframe=(window.parent.document.getElementById(iframename));
				objIframe.innerHTML=document.body.innerHTML;				
		}
	}
}

function LoadReview(idname)
{
	//Load(	idname,global_reviewiframe_name);
}