function display(url) 
{
    var sAttr;
    var sWidth;
    var sHeight;
    var sWindowName;
    var IE=(document.all) ? 1 : 0;
    var left;
    var top;
    sAttr="width=360,height=350,top=150,left=250,location=0,menubar=0,scrollbars=1,resizable=1";
    sWindowName = "PopUp";
    popupwindow = window.open(url, sWindowName, sAttr);
}

function shownews(url)
{
	width=300;	
	height=290;	
	win_top=290;	
	win_left=660;	
	locationStr="directories=no,scrollbars=1,width="+width+",height="+height+",top="+win_top+",left="+win_left;     
	window.open(url,"nidaye",locationStr);
}

function shownewsb(_url,_width,_height)
{
	width=520;	
	height=305;	
	win_top=290;	
	win_left=480;	
	locationStr="directories=no,scrollbars=1,width="+_width+",height="+_height+",top="+win_top+",left="+win_left;     
	window.open(_url,"nidaye",locationStr);
}

function openpopup( sURL, sType ) {
    var sAttr;
    var sWidth;
    var sHeight;
    var sWindowName;
    var IE = (document.all) ? 1 : 0;
    var left;
    var top;

    switch (sType)
    {
    	  case "Middle": // lookup popup.

            if (IE)
            {
                // IE
                sWidth = "620";
                sHeight = "460";
            }
            else
            {
                // other (Netscape)
                sWidth = "700";
                sHeight = "500";
            }

            sAttr = "width=" + sWidth + ",height=" + sHeight + ",top=150,left=150,toolbar=0,location=0,menubar=0,scrollbars=1,resizable=1";
            sWindowName = "Lookup";
            break;
        case "Lookup": // lookup popup.

            if (IE)
            {
                // IE
                sWidth = "700";
                sHeight = "600";
            }
            else
            {
                // other (Netscape)
                sWidth = "700";
                sHeight = "500";
            }

            sAttr = "width=" + sWidth + ",height=" + sHeight + ",top=150,left=150,toolbar=0,location=0,menubar=0,scrollbars=1,resizable=1";
            sWindowName = "Lookup";
            break;
        case "Small": // lookup popup.

            if (IE)
            {
                // IE
                sWidth = "450";
                sHeight = "220";
            }
            else
            {
                // other (Netscape)
                sWidth = "450";
                sHeight = "220";
            }

            sAttr = "width=" + sWidth + ",height=" + sHeight + ",top=150,left=150,toolbar=0,location=0,menubar=0,scrollbars=1,resizable=1";
            sWindowName = "Small";
            break;
        default:

            sAttr = "width=700,height=500,top=150,left=150,location=0,menubar=0,scrollbars=1,resizable=1";
            sWindowName = "PopUp";
    }

    popupwindow = window.open(sURL, sWindowName, sAttr);
}

function openpic( sURL, sType ) {
    var sAttr;
    var locationStr;
    var sWidth;
    var sHeight;
    var sWindowName;
    var IE = (document.all) ? 1 : 0;
    var left;
    var top;

    switch (sType)
    {
        case "Lookup": // lookup popup.

            if (IE)
            {
                // IE
                sWidth = "596";
                sHeight = "642";
            }
            else
            {
                // other (Netscape)
                sWidth = "700";
                sHeight = "500";
            }
            win_top=(window.screen.availHeight-sHeight)/2;	
	        win_left=(window.screen.availWidth-sWidth)/2;	
	        locationStr="directories=no,scrollbars=1,width="+sWidth+",height="+sHeight+",top="+win_top+",left="+win_left;
           // sAttr = "width=" + sWidth + ",height=" + sHeight + ",top=150,left=150,toolbar=0,location=0,menubar=0,scrollbars=1,resizable=1";
            sWindowName = "Lookup";
            break;
        case "Looking": // lookup popup.

            if (IE)
            {
                // IE
                sWidth = "596";
                sHeight = "700";
            }
            else
            {
                // other (Netscape)
                sWidth = "700";
                sHeight = "500";
            }
            win_top=0;	
	        win_left=(window.screen.availWidth-sWidth)/2;	
	        locationStr="directories=no,scrollbars=1,width="+sWidth+",height="+sHeight+",top="+win_top+",left="+win_left;
           // sAttr = "width=" + sWidth + ",height=" + sHeight + ",top=150,left=150,toolbar=0,location=0,menubar=0,scrollbars=1,resizable=1";
            sWindowName = "Lookup";
            break;
        case "Small": // lookup popup.

            if (IE)
            {
                // IE
                sWidth = "450";
                sHeight = "220";
            }
            else
            {
                // other (Netscape)
                sWidth = "450";
                sHeight = "220";
            }

            sAttr = "width=" + sWidth + ",height=" + sHeight + ",top=150,left=150,toolbar=0,location=0,menubar=0,scrollbars=1,resizable=1";
            sWindowName = "Small";
            break;
        default:

            sAttr = "width=700,height=500,top=150,left=150,location=0,menubar=0,scrollbars=1,resizable=1";
            sWindowName = "PopUp";
    }

    popupwindow = window.open(sURL, sWindowName, locationStr);
}

var lookupFld;
var lookupPrefix;
var lookupOthers;
function lookup(elementName, action, prefix, otherFields){
	lookupFld = elementName;
	lookupPrefix = prefix;
	lookupOthers = otherFields;
    openpopup(action,'Lookup');
}

function looking(elementName, action, prefix, otherFields){
	lookupFld = elementName;
	lookupPrefix = prefix;
	lookupOthers = otherFields;
    openpopup(action,'Looking');
}

/*
 * add by qingyuan 2007-9-4*/
 
function lookconsumer(array)
{
	var action="/user.do?method=list&_isLookup=true";
	
    for(i=0;i<array.length;i++)
	{		
		var fieldName=new String();
		
		fieldName=array[i];
		
		if(fieldName&&fieldName.length>0)
		{
			var emone=document.getElementsByName(fieldName);
			
			if(emone&&emone.length>0)
			{
				var param=emone[0].value;
				
				if(param&&param.length>0)
				{
					action+="&"+fieldName+"="+param;
				}
			}
		}
	}
	
	openpopup(action,"Lookup");
}

function bringbackConsumer(consumer)
{
	if(window.opener!=null)
	{
		var record=new Object();
		
		if(consumer)record.consumer=consumer;
		
		window.opener.bringBackConsumer(record,window);
	}
}
function bringbackSelect(id,name,valueArray){
	if (window.opener != null){
	   var rec=new Object();
       rec.id=id;
       rec.name=name;
       if(valueArray)
       	 rec.valueArray = valueArray;
       window.opener.bringback(rec, window);       
    }
}

function bringbackSelectVendor(id,name,valueArray){
	if (window.opener != null){
	   var rec=new Object();
       rec.id=id;
       rec.name=name;
       if(valueArray)
       	 rec.valueArray = valueArray;
       window.opener.bringbackVendor(rec, window);       
    }
}


/*function bringBackConsumer(record,subwindow)
{
	if(record.consumer)
	{
		var userForm=document.getElementsByName("userForm");
		
		if(userForm&&userForm.length>0)
		{
			elements=document.getElementsByName("consumer");
			
			if(elements&&elements.length>0)elements[0].value=record.consumer[0];
			
			userForm[0].submit();
		}
	}
	subwindow.close();
}*/
function bringBackConsumer(record,subwindow)
{
	if(record.consumer)
	{
		var process=document.getElementById("search_list");
		if(process)
		{
			process.method.value="consumerOrder";
			process.op.value="9";
			process.consumer.value=record.consumer[0];
			if(process.consumer)process.consumer.value=record.consumer[0];
			process.submit();
		}
	}	
	subwindow.close();
}
function bringbackSelectcon(id,name,cellPhone,homePhone,email,province,workAddress,valueArray){
	if (window.opener != null){
	   var rec=new Object();
       rec.id=id;
       rec.name=name;
       rec.cellPhone=cellPhone;
       rec.homePhone=homePhone;
       rec.email=email;
       rec.province=province;
       rec.workAddress=workAddress;
       if(valueArray)
       	 rec.valueArray = valueArray;
       window.opener.bringbackcon(rec, window);       
    }
}
function bringback(rec, subwindow){
	var idFld = lookupPrefix ? (lookupPrefix + lookupFld) : lookupFld;
	var elements = document.getElementsByName(idFld);
	var neenID ;
	var needPoItem;
	if(rec.id.indexOf('@')>0){
		needID = rec.id.split('@')[0];
		needPoItem = rec.id.split('@')[1];
	}else{
		needID = rec.id;
	}
	if(elements && elements.length > 0)
		elements[0].value = needID;
	var nameFld = lookupPrefix ? (lookupPrefix + 'name_' + lookupFld) : 'name_' + lookupFld;
	elements = document.getElementsByName(nameFld);
	if(elements && elements.length > 0)
		elements[0].value = rec.name;
	if(lookupOthers){
		for(var i = 0; i < lookupOthers.length; i++){
			var fieldName = lookupPrefix ? (lookupPrefix + lookupOthers[i]) : lookupOthers[i];
			elements = document.getElementsByName(fieldName);
			if(elements && elements.length > 0)
			{
				if(elements[0].src)
				{
					elements[0].src = rec.valueArray[i];
				}else{
					elements[0].value = rec.valueArray[i];
				}
			}
		}
	}
	
	subwindow.close();
	if(document.getElementById('dyna_add_sp')){
		dyna_obtain_selections(needID,needPoItem);
	}
	/**
	if(rec.valueArray && rec.valueArray.length>18)
	 appendDesc(rec);
	 * */
}

function dyna_obtain_selections(invyid,poitem){
	var callback = {
		success: dyna_obtain_selections_success, 
		failure: dyna_obtain_selections_fail,
		timeout: 8000
	}
	var cObj = YAHOO.util.Connect.asyncRequest('POST', '/stockpattern.do?method=stockpattern', callback, 'stock=' + invyid+'&poitem='+poitem); 
}

function dyna_obtain_selections_success(o){
	var responseP=eval('('+ o.responseText+')');
  	 	var selectObj = document.getElementById('selection_option_'+responseP.poitem);
  	 	for(var i = selectObj.length;i>=0;i--){
  	 		selectObj.remove(i);
  	 	}
  	 	for(var i=0;i<responseP.selections.length;i++){
  	 		option_key=eval('responseP.selections['+i+'].selectionId');
			option_value=eval('responseP.selections['+i+'].selection');
			if(selectObj){
  	          var optionItem=new Option(option_value,option_key);
  	          selectObj.options.add(optionItem);
			}
  	 	}  	 	
}
function dyna_obtain_selections_fail(){}

function bringbackVendor(rec, subwindow){
	var idFld = lookupPrefix ? (lookupPrefix + lookupFld) : lookupFld;
	var elements = document.getElementsByName(idFld);
	if(elements && elements.length > 0)
		elements[0].value = rec.id;
	var nameFld = lookupPrefix ? (lookupPrefix + 'name_' + lookupFld) : 'name_' + lookupFld;
	elements = document.getElementsByName(nameFld);
	
	if(elements && elements.length > 0)
		elements[0].value = rec.name;
	if(lookupOthers){
		
		for(var i = 0; i < lookupOthers.length; i++){
			var fieldName = lookupPrefix ? (lookupPrefix + lookupOthers[i]) : lookupOthers[i];
			elements = document.getElementsByName(fieldName);
			if(elements && elements.length > 0)
				elements[0].value = rec.valueArray[i];
		}
	}
	subwindow.close();
}
function bringbackcon(rec, subwindow){
	
	var elements = document.getElementsByName("consumer");
	if(elements && elements.length > 0){
		elements[0].value = rec.id;}
		
	elements=document.getElementsByName("issuerParty");
	if(elements&&elements.length>0)elements[0].value=rec.id;
	elements=document.getElementsByName("name_issuerParty");
	if(elements&&elements.length>0)elements[0].value=rec.name;
	
	elements = document.getElementsByName("consumerName");
	if(elements && elements.length > 0)
		elements[0].value = rec.name;
	elements = document.getElementsByName("confirmCellPhone");
	if(elements && elements.length > 0)
		elements[0].value = rec.cellPhone;
	elements = document.getElementsByName("confirmPhone");
	if(elements && elements.length > 0)
		elements[0].value = rec.homePhone;
	elements = document.getElementsByName("confirmMail");
	if(elements && elements.length > 0)
		elements[0].value = rec.email;
	elements = document.getElementsByName("confirmProvince");
	if(elements && elements.length > 0){
		elements[0].value = rec.province;}
	elements = document.getElementsByName("confirmAddr");
	if(elements && elements.length > 0)
		elements[0].value = rec.workAddress;
		
	if(lookupOthers){
		for(var i = 0; i < lookupOthers.length; i++){
			var fieldName = lookupPrefix ? (lookupPrefix + lookupOthers[i]) : lookupOthers[i];
			elements = document.getElementsByName(fieldName);
			if(elements && elements.length > 0)
				elements[0].value = rec.valueArray[i];
		}
	}
	subwindow.close();
}
function isDecimalDigits(argvalue) {
	  if(!argvalue)
	  	return false;
      argvalue = argvalue.toString();
      var validChars = "0123456789";

      var startFrom = 0;
      if (argvalue.charAt(0) == "-") {
          startFrom = 1;
      }

      for (var n = startFrom; n < argvalue.length; n++) {
          if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false;
      }
      return true;
 }
 
 
flushCity = function(provinceId, formName, cityField){
	var callback = {
		success: flushSuccess, 
		failure: flushFailure,
		timeout: 8000,
		argument: [formName, cityField]
	}
	var cObj = YAHOO.util.Connect.asyncRequest('POST', '/province.do', callback, 'province=' + provinceId); 
}

function flushSuccess(o){
	var selEl = eval('document.' + o.argument[0] +'.' + o.argument[1]);
	var length=selEl.options.length;
	while(length !=0 ){
       var length=selEl.options.length;
       for(var i=0;i<length;i++){
           selEl.options.remove(i);
       }
       length=length/2;
    }
    var responseObj = eval('('+ o.responseText +')');
	if(responseObj.citylist){
		for(var i = 0; i < responseObj.citylist.length; i++){
		    var el = document.createElement('OPTION');
		    var value = eval('responseObj.citylist[' + i  +'].name');
		    el.value = value;
		    el.text = value;
			selEl.add(el);
		}
	}
	
}
function subProdReview(){
	if(document.AddProdReview.review.value.length==0){
		alert("评论内容不能为空！");
		return false;
	}else return true;
}
function flushFailure(argument)
{
	alert("没有省份的城市信息!");
}

  function showImage()
  {
     var url=document.getElementById("image_source").value;
     openpic(url,'Lookup');
  }
  function show_image(source)
  {
    var prefix=source.substring(0,source.lastIndexOf("/")+1);
    var path=source.substring(source.lastIndexOf("/")+1,source.length);
    b_path="b"+path.substring(path.indexOf("_"),path.length);
    big_path=path.substring(path.indexOf("_")+1,path.length);
    var bel = document.getElementById("b_image");
    bel.src=prefix+b_path;
    bel.parentNode.href = prefix+big_path;
    if(document.getElementById("image_source"))
    document.getElementById("image_source").value=prefix+big_path;
  }  
  function addP(id,custom)
  {
    if(custom==4)
    {
      adding(id);
    }else if(custom==3)
    {
    	add_mitamin(id);
    }else{
      location.href='/shoppingcart.do?_methodName=add&_product_id='+id;
    }
  }
  function add_mitamin(id)
  {
  	var callback={success: mitaminSuccess, failure: mitaminFailure};	
	  var cObj=YAHOO.util.Connect.asyncRequest('POST', '/shoppingcart.do?_methodName=exist_mitamin&_product_id='+id, callback,''); 
  }
  function mitaminSuccess(argument)
  {
  	var responseObj=eval('('+ argument.responseText +')');
	  if(responseObj)
	  {
	  	if(responseObj.result=="1")
	  	{
	  		alert("购买的礼品不存在！");
	  	}else if(responseObj.result=="2")
	  	{
	  		alert("当前礼品未上架,暂时不能购买！");
		  }else if(responseObj.result=="3")
		  {
		  	alert('请选择美太美素产品！');
		  }else if(responseObj.result=="4")
		  {
		  	document.location.replace('/shoppingcart.do?_methodName=add&_product_id='+responseObj.id);
		  }else if(responseObj.result=="5")
		  {
		  	alert('每次购物只能选择一款美态美素产品！');
		  }	
	  }
 }
 function mitaminFailure(argument)
 {
 }
  function adding(id)
  {
    var msgw,msgh,bordercolor;
    msgw=300;//提示窗口的宽度
    msgh=150;//提示窗口的高度
    titleheight=25 //提示窗口标题高度
    bordercolor="#336699";//提示窗口的边框颜色
    titlecolor="#99CCFF";//提示窗口的标题颜色
    var sWidth,sHeight;
    sWidth=document.body.clientWidth;//浏览器工作区域内页面宽度
    sHeight=screen.height;//屏幕高度（垂直分辨率）
  //背景层（大小与窗口有效区域相同，即当弹出对话框时，背景显示为放射状透明灰色）
  var bgObj=document.createElement("div");//创建一个div对象（背景层）
  //定义div属性，即相当于
  //<div id="bgDiv" style="position:absolute; top:0; background-color:#777; filter:progid:DXImagesTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75); opacity:0.6; left:0; width:918px; height:768px; z-index:10000;"></div>
  bgObj.setAttribute('id','bgDiv');
  bgObj.style.position="absolute";
  bgObj.style.top="0";
  bgObj.style.background="#FFF";
  bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
  bgObj.style.opacity="0.6";
  bgObj.style.left="0";
  bgObj.style.width=sWidth + "px";
  bgObj.style.height=sHeight + "px";
  bgObj.style.zIndex = "10000";
  //document.body.style.overflow="hidden"
 // document.body.appendChild(bgObj);//在body内添加该div对象
  var msgObj=document.createElement("div")//创建一个div对象（提示框层）
  //定义div属性，即相当于
  //<div id="msgDiv" align="center" style="background-color:white; border:1px solid #336699; position:absolute; left:50%; top:50%; font:12px/1.6em Verdana,Geneva,Arial,Helvetica,sans-serif; margin-left:-225px; margin-top:npx; width:400px; height:100px; text-align:center; line-height:25px; z-index:100001;"></div>
  msgObj.setAttribute("id","msgDiv");
  msgObj.setAttribute("align","center");
  msgObj.style.backgroundImage="url('/images/common/body.jpg')";
  msgObj.style.position = "absolute";
  msgObj.style.left = "50%";
  msgObj.style.top = "50%";
  msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
  msgObj.style.marginLeft = "-150px" ;
  msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px";
  msgObj.style.width = msgw + "px";
  msgObj.style.height =msgh + "px";
  msgObj.style.textAlign = "left";
  msgObj.style.lineHeight ="25px";
  msgObj.style.zIndex = "10001";
  var title=document.createElement("h4");//创建一个h4对象（提示框标题栏）
title.setAttribute("id","msgTitle");
  title.setAttribute("align","right");
  title.style.margin="0";
  title.style.padding="3px";
  title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
  title.style.opacity="0.75";
  title.style.height="18px";
  title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
  title.style.color="white";
  title.style.cursor="pointer";
  title.innerHTML="<img src='/images/common/close.jpg'>";
  title.onclick=removeObj;
  var button=document.createElement("img");//创建一个input对象（提示框按钮）
  button.setAttribute("src",'/images/common/cancel.jpg');
  button.onclick=removeObj;
  function removeObj()
  {//点击标题栏触发的事件
   // document.body.removeChild(bgObj);//删除背景层Div
    document.getElementById("msgDiv").removeChild(title);//删除提示框的标题栏
    document.body.removeChild(msgObj);
//	document.body.style.overflow=""//删除提示框层
  }
  function addingSuccess(argument)
 {
	var responseObj=eval('('+ argument.responseText +')');
	if(responseObj)
	{
		if(responseObj.result=="1")
		{
			document.getElementById('msgTxt').innerHTML="指定的红包不存在！";
			document.getElementById('confirm').onclick=removeObj;
		}else if(responseObj.result=="2")
		{
			document.getElementById('msgTxt').innerHTML="指定的红包已经下架！";
			document.getElementById('confirm').onclick=removeObj;
		}else if(responseObj.result=="3")
		{
			document.getElementById('msgTxt').innerHTML="指定的礼品不是红包！";
			document.getElementById('confirm').onclick=removeObj;
		}else if(responseObj.result=="4")
		{
		    document.getElementById('msgTxt').innerHTML="当前红包已经在购物车中！";
			document.getElementById('confirm').onclick=removeObj;
		}else if(responseObj.result=="5")
		{
			document.getElementById('msgTxt').innerHTML="红包金额不能大于2000元！";
			document.getElementById('confirm').onclick=removeObj;
		}else{
		    removeObj();
			document.location.replace('/shoppingcart.do?_methodName=view');
		}		
	}
 }
 
 function addingFailure(argument)
 {
 }
  var button2=document.createElement('img');
  button2.setAttribute("src",'/images/common/confirm.jpg');
  button2.setAttribute("id","confirm");
  button2.style.marginRight="10px";
  var product=document.createElement('input');
  product.setAttribute("type",'hidden');
  product.setAttribute("value",id);
  product.setAttribute("id","product");
  button2.onclick=applayObj;
  function applayObj()
  {
     var result=document.getElementById("redbag").value;
     var _product=document.getElementById("product").value;
     var callback={success: addingSuccess, failure: addingFailure};	
	 var cObj=YAHOO.util.Connect.asyncRequest('POST', '/shoppingcart.do?_methodName=adding&_product_id='+_product, callback, 'mny='+result); 
  }  
  document.body.appendChild(msgObj);//在body内添加提示框div对象msgObj
  document.getElementById("msgDiv").appendChild(title);//在提示框div中添加标题栏对象title
  var txt=document.createElement("div");//创建一个p对象（提示框提示信息）
  txt.setAttribute("id","msgTxt");
  txt.style.textAlign="left";
  txt.style.paddingLeft="50px";
  txt.style.width="250px";
  txt.style.height="60px";
  txt.style.marginTop="30px"
 //输入文本框的位置
  txt.innerHTML="请输入红包金额(不能超过2000元)<br><input id='redbag' type='text' style='border:1px solid #9FB6CD;width:200px' />";//来源于函数调用时的参数值
  var buttonDiv=document.createElement("div");
  buttonDiv.style.marginLeft="90px";
  document.getElementById("msgDiv").appendChild(txt);//在提示框div中添加提示信息对象txt
  buttonDiv.appendChild(button2);
  buttonDiv.appendChild(button);
  document.getElementById("msgDiv").appendChild(buttonDiv);
//在提示框div中添加按钮对象button
  document.getElementById("msgDiv").appendChild(product);  
}
function bringBackConsumerByPhone(user,obj){
	var consumerForm = document.forms[0];
	consumerForm.consumerId.value=user[0];
  	consumerForm.consumerName.value=user[1];
  	document.getElementById('phone').innerHTML=user[2];
  	consumerForm.qq.value=user[5];
  	consumerForm.msn.value=user[6];
  	consumerForm.mail.value=user[3];
  	consumerForm.city.value=user[4];
  	obj.close();
}
 function xyk()
    {
     	window.open("/xyk.htm","_blank",'height=600px,width=650px,scrollbars=yes,top=50px,left=200px');
    }
     function zfb()
    {
     	window.open("/zfb.htm","_blank",'height=600px,width=650px,scrollbars=yes,top=50px,left=200px');
    }
    
function addR(id,custom){
	var callback={success : shopSuccess, failure : shopFail};
    YAHOO.util.Connect.asyncRequest('POST', '/shoppingcart.do?_methodName=add&_product_id='+id+'&custom='+custom, callback);
}
function shopSuccess(){
	alert('您已成功将礼品放入购物车');
_cart_ttc_()
}
function shopFail(){}
function searchByCondition(condition,value){
	var url = "/gift.do?_methodName=searchere";
	//var flag = document.getElementById('sflag').value;
	if(condition=='category'){
	 if(value != document.getElementById(condition).value){
	 	location.href=url+"&category="+value;
	 	return;
	 }
	}
	if(condition)
	document.getElementById(condition).value=value;
	var o = document.getElementById('object').value;
	var occassion = document.getElementById('occassion').value;
	var price = document.getElementById('price').value;
	var category = document.getElementById('category').value;
	var sort = document.getElementById('sort').value;
	var page = document.getElementById('page').value;
	var totalpage = document.getElementById('totalPage').value;
	 if(page && page<=0)
	    page =1;
	 if(page && totalpage && page-totalpage>0)
	    page = totalpage;
	var display = document.getElementById('display').value;	
	var filedArray = new Array([7]);
	var filedValueArray = new Array([7]);
	
	filedArray[0]='category';
	filedArray[1]='object';
	filedArray[2]='occassion';
	filedArray[3]='price';
	filedArray[4]='sort';
	filedArray[5]='page';
	filedArray[6]='display';
	
	filedValueArray[0]=category;
	filedValueArray[1]=o;
	filedValueArray[2]=occassion;
	filedValueArray[3]=price;
	filedValueArray[4]=sort;
	filedValueArray[5]=page;
	filedValueArray[6]=display;
	for(var i = 0;i<7;i++){
		if(filedValueArray[i] !='0' && filedValueArray[i] != null && filedValueArray[i] != '')
		url+='&'+filedArray[i]+'='+filedValueArray[i];
	}
	location.href=url;
}
function showSelect(category){
	var tags = document.getElementsByTagName("A");
	for(var i=0;i<tags.length;i++){
		if(tags[i].href=="/gift.do?_methodName=searchere&category="+category){
		 tags[i].style.background="#FFF6C5";
		 tags[i].style.color="#CC0000";
		 return ;
		}
	}
}

function addAnswer()
  {
	var answerTable = document.getElementById('answerTable');
	var _index=answerTable.rows.length;
	_index=_index-1;
    var trObj = answerTable.insertRow(2);
    var tdObj=null;
    tdObj = trObj.insertCell(0);
    tdObj.align="center";
    tdObj.width="50%";
    tdObj.innerHTML="<input type='hidden' name='answers["+_index+"].answerId'>"
    +"<input type='hidden' name='answers["+_index+"].questionId'>"
    +"<input type='hidden' name='answers["+_index+"]._deleted_' value='false'>"
    +"<input type='hidden' name='answers["+_index+"].product'>"
    +"<textarea name='answers["+_index+"].answer' cols='70' rows=5'></textarea>";
    tdObj = trObj.insertCell(1);
    tdObj.align="center";
    tdObj.innerHTML="";
    tdObj = trObj.insertCell(2);
    tdObj.align="center";
    tdObj.width="20%";
    tdObj.innerHTML="<input type='text' name='answers["+_index+"].nickName' size='30'>";
    tdObj = trObj.insertCell(3);
    tdObj.align="center";
    tdObj.innerHTML="<select name='answerStatus'><option value='0' selected='selected'>待审核</option><option value='1'>待生成</option><option value='2'>已生成</option></select>";
    tdObj = trObj.insertCell(4);
    tdObj.innerHTML="<br/><input type='text' name='answers["+_index+"].name_product' readonly='readonly'><br/>"
    +"<a href='javascript:lookup(\'product\', \'product.do?_isLookup=true&_methodName=list\',\'answers["+_index+"].\')'><img src='images/lookup_icon.gif' width='15' height='15' border='0'></a>";
    tdObj = trObj.insertCell(5);
    tdObj.align="center";
    tdObj.innerHTML="<img src='/images/dustbin.gif' height='15' width='15' align='middle' border='0' hspace='3' alt='删除' onclick='javascript:removeAnswer("+_index+")'>";
  }
  
  function another_relate_products(product_id,currentpage){
  	var callback={
		success: another_relate_products_success, 
		failure: another_relate_products_failure,
		timeout: 8000
	}
	
	var cObj=YAHOO.util.Connect.asyncRequest('get','/gift.do?_methodName=another_relate_products&productId='+product_id+'&currentpage='+currentpage,callback);
  }
  function another_relate_products_success(o){
  	 var responseP=eval('('+ o.responseText+')');
  	 if(responseP.result == '2')
  	 return;
  	 else{
  	 	var divObj = document.getElementById('anthoer_relate_products');
  	 	var next_page = responseP.next_page;
  	 	var previous = responseP.previous_page;
  	 	var product_id = responseP.product;
  	 	var content='<div class="jt_content_you_nr1"><a href="javascript:another_relate_products(\''+product_id+'\',\''+previous+'\')"><img src="../images/scnd/jt_up_button.jpg" border="0" /></a></div><div class="jt_content_you_nr2">' +
  	 			'<table width="200" border="0" cellspacing="0" cellpadding="0">';
  	 	for(var i=0;i<responseP.products.length;i++){
  	 		productid=eval('responseP.products['+i+'].id');
			smallPicture=eval('responseP.products['+i+'].picture');
			productName=eval('responseP.products['+i+'].name') ? eval('responseP.products['+i+'].name') : "";
			liYi99price=eval('responseP.products['+i+'].liyi99price') ? eval('responseP.products['+i+'].liyi99price') : "";
			usd_price=eval('responseP.products['+i+'].usdprice') ? eval('responseP.products['+i+'].usdprice') : "";
			costomType = eval('responseP.products['+i+'].customType') ? eval('responseP.products['+i+'].customType') : "";
  	 		content+='<tr><td height="90">'
                   +'<div class="jt_content_you_one">'
                   +'<div class="jt_content_you_one1">';
            if(costomType == 6)
              content +='<a href="/flower/giftview'+productid+'.html" target="_blank"><img src="'+smallPicture+'" alt="'+productName+'" border="0" /></a>' ;
            else
              content +='<a href="/giftview'+productid+'.html" target="_blank"><img src="'+smallPicture+'" alt="'+productName+'" border="0" /></a>' ;
           content+='</div>'
                   + '<div class="jt_content_you_one2">'
                   +'<p class="jt_content_you_one2_name">';
           if(costomType == 6)
             content+='<a href="/flower/giftview'+productid+'.html" target="_blank">'+productName+'</a>';
           else
             content+='<a href="/giftview'+productid+'.html" target="_blank">'+productName+'</a>';
            content+='</p>'
                   +'<p class="jt_content_you_one2_liyi">￥<span>'+liYi99price+'</span>元</p>'
                   +'<p class="jt_content_you_one2_usd">USD$'+usd_price+'</p>'
                   +'</div></div></td></tr>';
  	 	}
  	 	content+='</table></div><div class="jt_content_you_nr3"><a href="javascript:another_relate_products(\''+product_id+'\',\''+next_page+'\')"><img src="../images/scnd/jt_down_button.jpg" border="0" /></a></div></div>';
  	   divObj.innerHTML=content;
  	 }
  }
  function another_relate_products_failure(o){
  	
  }
  var same_flag = 'moral';
    function same_category_products(product_id,currentpage,flag){
    	if(same_flag == 'category' && flag =='init' ){
    		return;
    	}
    	same_flag = 'category';
    	document.getElementById('same_category').className ='jt_content_3tab_select';
    	document.getElementById('same_moral').className ='jt_content_3tab_normal';
    	document.getElementById('same_price').className ='jt_content_3tab_normal';
  	var callback={
		success: same_category_products_success, 
		failure: same_category_products_failure,
		timeout: 8000
	}
	
	var cObj=YAHOO.util.Connect.asyncRequest('get','/gift.do?_methodName=same_category_products&productId='+product_id+'&currentpage='+currentpage,callback);
  }
  function same_category_products_success(o){
  	 var responseP=eval('('+ o.responseText+')');
  	 var product_id = responseP.product;
  	 if(responseP.result == '2'){
  	 	var divObj = document.getElementById('the_some_same_products').innerHTML='<div class="jt_content_3tab_ti1"><a href="javascript:same_category_products(\''+product_id+'\',\''+1+'\',\'no_init\');"><img src="../images/scnd/jt_other_zuo_bt.jpg" border="0" /></a></div><div class="jt_content_3tab_ti2">'
                    +'<div class="jt_content_3tab_ti2_content"></div></div><div class="jt_content_3tab_ti3"><a href="javascript:same_category_products(\''+product_id+'\',\''+1+'\',\'no_init\');"><img src="../images/scnd/jt_other_you_bt.jpg" border="0" /></a></div></div>';
  	 return;
  	 }
  	 else{
  	 	var divObj = document.getElementById('the_some_same_products');
  	 	var next_page = responseP.next_page;
  	 	var previous = responseP.previous_page;  	 	
  	 	var content='<div class="jt_content_3tab_ti1"><a href="javascript:same_category_products(\''+product_id+'\',\''+previous+'\',\'no_init\');"><img src="../images/scnd/jt_other_zuo_bt.jpg" border="0" /></a></div><div class="jt_content_3tab_ti2">'
                    +'<div class="jt_content_3tab_ti2_content">';
  	 	for(var i=0;i<responseP.products.length;i++){
  	 		productid=eval('responseP.products['+i+'].id');
			smallPicture=eval('responseP.products['+i+'].picture');
			productName=eval('responseP.products['+i+'].name') ? eval('responseP.products['+i+'].name') : "";
			liYi99price=eval('responseP.products['+i+'].liyi99price') ? eval('responseP.products['+i+'].liyi99price') : "";
			mrprice=eval('responseP.products['+i+'].mrprice') ? eval('responseP.products['+i+'].mrprice') : "";
			customType = eval('responseP.products['+i+'].mrprice') ? eval('responseP.products['+i+'].mrprice') : "";
  	 		content+='<div class="jt_content_3tab_ti_one"><p class="jt_content_3tab_ti_one_pic">';
  	 		if(customType == 6)
  	 		content+='<a href="/flower/giftview'+productid+'.html" target="_blank"><img src="'+smallPicture+'" border="0" /></a>';
  	 	    else
  	 	    content+='<a href="/giftview'+productid+'.html" target="_blank"><img src="'+smallPicture+'" border="0" /></a>';
  	 		content+='</p>'
                     +'<p class="jt_content_3tab_ti_one_name">';
             if(customType == 6)
             content+='<a href="/flower/giftview'+productid+'.html" target="_blank">'+productName+'</a>';
             else
             content+='<a href="/giftview'+productid+'.html" target="_blank">'+productName+'</a>';
             content+='</p>'
                     +'<p class="jt_content_3tab_ti_one_liyi">￥<span>'+liYi99price+'</span>元</p>'
                     +'<p class="jt_content_3tab_ti_one_shichang">￥'+mrprice+'元</p></div>';
  	 	}
  	 	content+='</div></div><div class="jt_content_3tab_ti3"><a href="javascript:same_category_products(\''+product_id+'\',\''+next_page+'\',\'no_init\');"><img src="../images/scnd/jt_other_you_bt.jpg" border="0" /></a></div></div>';
  	   divObj.innerHTML=content;
  	 }
  }
  function same_category_products_failure(o){
  	
  }
 function same_price_products(product_id,currentpage,flag){
 	if(same_flag == 'price'  && flag == 'init'){
 		return;
 	}
 	same_flag = 'price';
 	    	document.getElementById('same_category').className ='jt_content_3tab_normal';
    	document.getElementById('same_moral').className ='jt_content_3tab_normal';
    	document.getElementById('same_price').className ='jt_content_3tab_select';
  	var callback={
		success: same_price_products_success, 
		failure: same_price_products_failure,
		timeout: 8000,
		cache: true
	}
	
	var cObj=YAHOO.util.Connect.asyncRequest('get','/gift.do?_methodName=same_price_products&productId='+product_id+'&currentpage='+currentpage,callback);
  }
  function same_price_products_success(o){
  	 var responseP=eval('('+ o.responseText+')');
  	 	var product_id = responseP.product;
  	 if(responseP.result == '2'){
  	 document.getElementById('the_some_same_products').innerHTML='<div class="jt_content_3tab_ti1"><a href="javascript:same_price_products(\''+product_id+'\',\''+1+'\',\'no_init\');"><img src="../images/scnd/jt_other_zuo_bt.jpg" border="0" /></a></div><div class="jt_content_3tab_ti2">'
                    +'<div class="jt_content_3tab_ti2_content"></div></div><div class="jt_content_3tab_ti3"><a href="javascript:same_price_products(\''+product_id+'\',\''+1+'\',\'no_init\');"><img src="../images/scnd/jt_other_you_bt.jpg" border="0" /></a></div></div>';
  	 return;
  	 }
  	 else{
  	 	var divObj = document.getElementById('the_some_same_products');
  	 	var next_page = responseP.next_page;
  	 	var previous = responseP.previous_page;
  	 	var content='<div class="jt_content_3tab_ti1"><a href="javascript:same_price_products(\''+product_id+'\',\''+previous+'\',\'no_init\');"><img src="../images/scnd/jt_other_zuo_bt.jpg" border="0" /></a></div><div class="jt_content_3tab_ti2">'
                    +'<div class="jt_content_3tab_ti2_content">';
  	 	for(var i=0;i<responseP.products.length;i++){
  	 		productid=eval('responseP.products['+i+'].id');
			smallPicture=eval('responseP.products['+i+'].picture');
			productName=eval('responseP.products['+i+'].name') ? eval('responseP.products['+i+'].name') : "";
			liYi99price=eval('responseP.products['+i+'].liyi99price') ? eval('responseP.products['+i+'].liyi99price') : "";
			mrprice=eval('responseP.products['+i+'].mrprice') ? eval('responseP.products['+i+'].mrprice') : "";
			customType=eval('responseP.products['+i+'].customType') ? eval('responseP.products['+i+'].customType') : "";
  	 		content+='<div class="jt_content_3tab_ti_one">';
  	 		if(customType == 6){
  	 		content+='<p class="jt_content_3tab_ti_one_pic"><a href="/flower/giftview'+productid+'.html" target="_blank"><img src="'+smallPicture+'" border="0" /></a></p>'
                     +'<p class="jt_content_3tab_ti_one_name"><a href="/flower/giftview'+productid+'.html" target="_blank">'+productName+'</a></p>';
  	 		}else{
  	 			content+='<p class="jt_content_3tab_ti_one_pic"><a href="/giftview'+productid+'.html" target="_blank"><img src="'+smallPicture+'" border="0" /></a></p>'
                     +'<p class="jt_content_3tab_ti_one_name"><a href="/giftview'+productid+'.html" target="_blank">'+productName+'</a></p>';
  	 		}
            content+='<p class="jt_content_3tab_ti_one_liyi">￥<span>'+liYi99price+'</span>元</p>'
                     +'<p class="jt_content_3tab_ti_one_shichang">￥'+mrprice+'元</p></div>';
  	 	}
  	 	content+='</div></div><div class="jt_content_3tab_ti3"><a href="javascript:same_price_products(\''+product_id+'\',\''+next_page+'\',\'no_init\');"><img src="../images/scnd/jt_other_you_bt.jpg" border="0" /></a></div></div>';
  	   divObj.innerHTML=content;
  	 }
  }
  function same_price_products_failure(o){
  	
  }
  
  function same_moral_products(product_id,currentpage,flag){
  	if(same_flag == 'moral'  && flag == 'init')
  	return;
  	same_flag = 'moral';
  	    document.getElementById('same_category').className ='jt_content_3tab_normal';
    	document.getElementById('same_moral').className ='jt_content_3tab_select';
    	document.getElementById('same_price').className ='jt_content_3tab_normal';
  	var callback={
		success: same_moral_products_success, 
		failure: same_moral_products_failure,
		timeout: 8000
	}
	
	var cObj=YAHOO.util.Connect.asyncRequest('post','/gift.do?_methodName=same_moral_products&productId='+product_id+'&currentpage='+currentpage,callback);
  }
  function same_moral_products_success(o){
  	 var responseP=eval('('+ o.responseText+')');
  	 var product_id = responseP.product;
  	 if(responseP.result == '2'){
  	 document.getElementById('the_some_same_products').innerHTML='<div class="jt_content_3tab_ti1"><a href="javascript:same_moral_products(\''+product_id+'\',\''+1+'\',\'no_init\');"><img src="../images/scnd/jt_other_zuo_bt.jpg" border="0" /></a></div><div class="jt_content_3tab_ti2">'
                    +'<div class="jt_content_3tab_ti2_content"></div></div><div class="jt_content_3tab_ti3"><a href="javascript:same_moral_products(\''+product_id+'\',\''+1+'\',\'no_init\');"><img src="../images/scnd/jt_other_you_bt.jpg" border="0" /></a></div></div>';
  	 return;
  	 }
  	 else{
  	 	var divObj = document.getElementById('the_some_same_products');
  	 	var next_page = responseP.next_page;
  	 	var previous = responseP.previous_page;
  	 	var content='<div class="jt_content_3tab_ti1"><a href="javascript:same_moral_products(\''+product_id+'\',\''+previous+'\',\'no_init\');"><img src="../images/scnd/jt_other_zuo_bt.jpg" border="0" /></a></div><div class="jt_content_3tab_ti2">'
                    +'<div class="jt_content_3tab_ti2_content">';
  	 	for(var i=0;i<responseP.products.length;i++){
  	 		productid=eval('responseP.products['+i+'].id');
			smallPicture=eval('responseP.products['+i+'].picture');
			productName=eval('responseP.products['+i+'].name') ? eval('responseP.products['+i+'].name') : "";
			liYi99price=eval('responseP.products['+i+'].liyi99price') ? eval('responseP.products['+i+'].liyi99price') : "";
			mrprice=eval('responseP.products['+i+'].mrprice') ? eval('responseP.products['+i+'].mrprice') : "";
			customType=eval('responseP.products['+i+'].customType') ? eval('responseP.products['+i+'].customType') : "";
  	 		content+='<div class="jt_content_3tab_ti_one">';
  	 			if(customType == 6){	
  	 			content+='<p class="jt_content_3tab_ti_one_pic"><a href="/flower/giftview'+productid+'.html" target="_blank"><img src="'+smallPicture+'" border="0" /></a></p>'
                     +'<p class="jt_content_3tab_ti_one_name"><a href="/flower/giftview'+productid+'.html" target="_blank">'+productName+'</a></p>';
  	 			}else{
  	 				content+='<p class="jt_content_3tab_ti_one_pic"><a href="/giftview'+productid+'.html" target="_blank"><img src="'+smallPicture+'" border="0" /></a></p>'
                     +'<p class="jt_content_3tab_ti_one_name"><a href="/giftview'+productid+'.html" target="_blank">'+productName+'</a></p>';
  	 			}
                content+='<p class="jt_content_3tab_ti_one_liyi">￥<span>'+liYi99price+'</span>元</p>'
                     +'<p class="jt_content_3tab_ti_one_shichang">￥'+mrprice+'元</p></div>';
  	 	}
  	 	content+='</div></div><div class="jt_content_3tab_ti3"><a href="javascript:same_moral_products(\''+product_id+'\',\''+next_page+'\',\'no_init\');"><img src="../images/scnd/jt_other_you_bt.jpg" border="0" /></a></div></div>';
  	   divObj.innerHTML=content;
  	 }
  }
  function same_moral_products_failure(o){
  	
  }
  
    function my_other_products(product_id,currentpage){
  	var callback={
		success: my_other_products_success, 
		failure: my_other_products_failure,
		timeout: 8000
	}
	
	var cObj=YAHOO.util.Connect.asyncRequest('get','/gift.do?_methodName=my_other_products&productId='+product_id+'&currentpage='+currentpage,callback);
  }
  function my_other_products_success(o){
  	 var responseP=eval('('+ o.responseText+')');
  	 if(responseP.result == '2')
  	 return;
  	 else{
  	 	var divObj = document.getElementById('other_gift');
  	 	var next_page = responseP.next_page;
  	 	var previous = responseP.previous_page;
  	 	var product_id = responseP.product;
  	 	var content='<div class="jt_content_3tab_ti1"><a href="javascript:my_other_products(\''+product_id+'\',\''+previous+'\');"><img src="../images/scnd/jt_other_zuo_bt.jpg" border="0" /></a></div><div class="jt_content_3tab_ti2">'
                    +'<div class="jt_content_3tab_ti2_content">';
  	 	for(var i=0;i<responseP.products.length;i++){
  	 		productid=eval('responseP.products['+i+'].id');
			smallPicture=eval('responseP.products['+i+'].picture');
			productName=eval('responseP.products['+i+'].name') ? eval('responseP.products['+i+'].name') : "";
			liYi99price=eval('responseP.products['+i+'].liyi99price') ? eval('responseP.products['+i+'].liyi99price') : "";
			mrprice=eval('responseP.products['+i+'].mrprice') ? eval('responseP.products['+i+'].mrprice') : "";
			customType = eval('responseP.products['+i+'].customType') ? eval('responseP.products['+i+'].customType') : "";
  	 		content+='<div class="jt_content_3tab_ti_one">';
  	 		if(customType == 6){
  	 		content+='<p class="jt_content_3tab_ti_one_pic"><a href="/flower/giftview'+productid+'.html" target="_blank"><img src="'+smallPicture+'" border="0" /></a></p>'
                     +'<p class="jt_content_3tab_ti_one_name"><a href="/flower/giftview'+productid+'.html" target="_blank">'+productName+'</a></p>';
  	 		}else{
  	 			content+='<p class="jt_content_3tab_ti_one_pic"><a href="/giftview'+productid+'.html" target="_blank"><img src="'+smallPicture+'" border="0" /></a></p>'
                     +'<p class="jt_content_3tab_ti_one_name"><a href="/giftview'+productid+'.html" target="_blank">'+productName+'</a></p>';
  	 		}
            content+='<p class="jt_content_3tab_ti_one_liyi">￥<span>'+liYi99price+'</span>元</p>'
                     +'<p class="jt_content_3tab_ti_one_shichang">￥'+mrprice+'元</p></div>';
  	 	}
  	 	content+='</div></div><div class="jt_content_3tab_ti3"><a href="javascript:my_other_products(\''+product_id+'\',\''+next_page+'\');"><img src="../images/scnd/jt_other_you_bt.jpg" border="0" /></a></div></div>';
  	   divObj.innerHTML=content;
  	 }
  }
  function my_other_products_failure(o){
  	
  }
    function their_other_products(product_id,currentpage){
  	var callback={
		success: their_other_products_success, 
		failure: their_other_products_failure,
		timeout: 8000
	}
	
	var cObj=YAHOO.util.Connect.asyncRequest('get','/gift.do?_methodName=their_other_products&productId='+product_id+'&currentpage='+currentpage,callback);
  }
  function their_other_products_success(o){
  	 var responseP=eval('('+ o.responseText+')');
  	 if(responseP.result == '2')
  	 return;
  	 else{
  	 	var divObj = document.getElementById('their_other_products');
  	 	var next_page = responseP.next_page;
  	 	var previous = responseP.previous_page;
  	 	var product_id = responseP.product;
  	 	var content='<div class="jt_content_3tab_ti1"><a href="javascript:their_other_products(\''+product_id+'\',\''+previous+'\');"><img src="../images/scnd/jt_other_zuo_bt.jpg" border="0" /></a></div><div class="jt_content_3tab_ti2">'
                    +'<div class="jt_content_3tab_ti2_content">';
  	 	for(var i=0;i<responseP.products.length;i++){
  	 		productid=eval('responseP.products['+i+'].id');
			smallPicture=eval('responseP.products['+i+'].picture');
			productName=eval('responseP.products['+i+'].name') ? eval('responseP.products['+i+'].name') : "";
			liYi99price=eval('responseP.products['+i+'].liyi99price') ? eval('responseP.products['+i+'].liyi99price') : "";
			mrprice=eval('responseP.products['+i+'].mrprice') ? eval('responseP.products['+i+'].mrprice') : "";
			customType=eval('responseP.products['+i+'].customType') ? eval('responseP.products['+i+'].customType') : "";
  	 		content+='<div class="jt_content_3tab_ti_one">';
  	 		if(customType == 6){
  	 			content+='<p class="jt_content_3tab_ti_one_pic"><a href="/flower/giftview'+productid+'.html" target="_blank"><img src="'+smallPicture+'" border="0" /></a></p>'
                     +'<p class="jt_content_3tab_ti_one_name"><a href="/flower/giftview'+productid+'.html" target="_blank">'+productName+'</a></p>';
  	 		}else{
  	 			content+='<p class="jt_content_3tab_ti_one_pic"><a href="/giftview'+productid+'.html" target="_blank"><img src="'+smallPicture+'" border="0" /></a></p>'
                     +'<p class="jt_content_3tab_ti_one_name"><a href="/giftview'+productid+'.html" target="_blank">'+productName+'</a></p>';
  	 		}
             content+='<p class="jt_content_3tab_ti_one_liyi">￥<span>'+liYi99price+'</span>元</p>'
                     +'<p class="jt_content_3tab_ti_one_shichang">￥'+mrprice+'元</p></div>';
  	 	}
  	 	content+='</div></div><div class="jt_content_3tab_ti3"><a href="javascript:their_other_products(\''+product_id+'\',\''+next_page+'\');"><img src="../images/scnd/jt_other_you_bt.jpg" border="0" /></a></div></div>';
  	   divObj.innerHTML=content;
  	 }
  }
  function their_other_products_failure(o){
  	
  }
  
  function show_login(obj){
if(obj.checked){
  document.getElementById('login_tr').style.display='none';
}else{
  if(document.cookie)
  {
  	var cookieParts = document.cookie.split(/;\s/g);
  	var len = 0;
  	var user_name = "";
  	var name_id = "";
  	for(var i=0, len=cookieParts.length; i < len; i++)
  	{
  		cookieNameValue = cookieParts[i].match(/([^=]+)=/i);
  		if(cookieNameValue instanceof Array)
  		{ 
  			try{
  				cookieName = cookieNameValue[1];
  				if(cookieName == '_usr_lgn') user_name=decodeURIComponent(cookieParts[i].substring(cookieNameValue[1].length+1));
          if(cookieName == '_usr_lgn_id') name_id=decodeURIComponent(cookieParts[i].substring(cookieNameValue[1].length+1));
        }catch(ex){ }
      }
    }
    if(name_id == null || name_id == "")
      document.getElementById('login_tr').style.display='block';
  }
}
}

function login_ping(){
	var name = document.getElementById('name').value;
	var word = document.getElementById('word').value;
	if(name != null && name !="" && word != null && word != "")
	 location.href="/account.do?method=login&loginName="+name+"&password="+word;
}
function reviews(product_id,currentpage){
	var callback={
		success: reviews_success, 
		failure: reviews_failure,
		timeout: 8000
	}
	
	var cObj=YAHOO.util.Connect.asyncRequest('get','/gift.do?_methodName=reviews&productId='+product_id+'&currentpage='+currentpage,callback);
}
   function reviews_success(o){
  	 var responseP=eval('('+ o.responseText+')');
  	 if(responseP.result == '2')
  	 return;
  	 else{
  	 	var divObj = document.getElementById('review_content');
  	 	var next_page = responseP.review_next_page;
  	 	var previous = responseP.review_previous_page;
  	 	var product_id = responseP.product;
  	 	var total_page = responseP.review_total_page;
  	 	var total_reivew = responseP.total_review;
  	 	var start_page = responseP.start_page;
  	 	var end_page = responseP.end_page;
  	 	var content='<div class="jt_content_online_fanye" style="border-bottom:#CCCCCC solid 1px;"><b style="font-weight:normal; margin-right:30px;"><a name="aa">共有</a><em style="font-style:normal; color:#CC0000;">'+total_reivew+'</em>条评论</b><a href="javascript:reviews(\''+product_id+'\',1)">首页</a><a href="javascript:reviews(\''+product_id+'\',\''+previous+'\')">上一页</a>';
  	 	for(var j=start_page;j<=end_page;j++){
  	 		content+='<a href="javascript:reviews(\''+product_id+'\',\''+j+'\')">'+j+'</a>';
  	 	}
  	 	content+='<a href="javascript:reviews(\''+product_id+'\',\''+next_page+'\')">下一页</a><a href="javascript:reviews(\''+product_id+'\',\''+total_page+'\')">尾页</a>'
	             +'</div><div class="jt_content_online_nr">';
  	 	for(var i=0;i<responseP.reviews.length;i++){
  	 		reviewid=eval('responseP.reviews['+i+'].reviewid')? eval('responseP.reviews['+i+'].reviewid') : "";
  	 		review_person=eval('responseP.reviews['+i+'].review_person')? eval('responseP.reviews['+i+'].review_person') : "";
			review_time=eval('responseP.reviews['+i+'].review_time')? eval('responseP.reviews['+i+'].review_time') : "";
			review_ip=eval('responseP.reviews['+i+'].review_ip') ? eval('responseP.reviews['+i+'].review_ip') : "";
			content_review=eval('responseP.reviews['+i+'].review_content') ? eval('responseP.reviews['+i+'].review_content') : "";
			review_respnonse_person=eval('responseP.reviews['+i+'].review_respnonse_person') ? eval('responseP.reviews['+i+'].review_respnonse_person') : "";
			review_response_time=eval('responseP.reviews['+i+'].review_response_time') ? eval('responseP.reviews['+i+'].review_response_time') : "";
			review_response_ip=eval('responseP.reviews['+i+'].review_response_ip') ? eval('responseP.reviews['+i+'].review_response_ip') : "";
			review_response_content=eval('responseP.reviews['+i+'].review_response_content') ? eval('responseP.reviews['+i+'].review_response_content') : "";
  	 		content+='<div class="jt_content_online_three">'; 
  	 		 if(review_person == "" || review_person == null)
  	 		 content+='<h6>'+review_time+'&nbsp;&nbsp;&nbsp;&nbsp;'+review_ip+'</h6>';
  	 		 else
  	 		 content+='<h6>'+review_person+'&nbsp;'+review_time+'</h6>';
  	 		 content+='<p>'+content_review+'</p>';
  	 		 if(review_response_content == null || review_response_content == "" )
  	 		 content+='<div id="reviewLI'+reviewid+'"></div>';
  	 		 else{
  	 		 content+='<div style=" margin:10px 0px; line-height:30px;"><span><b style="color:#878787; font-weight:normal;"><em style="font-style:normal; margin-left:10px; color:#920000;">';
  	 		 if(review_respnonse_person == null || review_respnonse_person == "")
  	 		 	content+=review_response_ip;
  	 		 else
  	 		  content+=review_respnonse_person;
  	 		 content+= '</em>&nbsp;&nbsp;回复时间：'+review_response_time+'</b></span><p style="line-height:25px;">'+review_response_content+'</p></div>'; 
  	 		 }
  	 		 content+='</div>';
  	 	}
  	 	content+='</div><div class="jt_content_online_fanye" style="border-top:#CCCCCC solid 1px;"><b style="font-weight:normal; margin-right:30px;">共有<em style="font-style:normal; color:#CC0000;">'+total_reivew+'</em>条评论</b><a href="javascript:reviews(\''+product_id+'\',1)">首页</a><a href="javascript:reviews(\''+product_id+'\',\''+previous+'\')">上一页</a>';
  	 	for(var j=start_page;j<=end_page;j++){
  	 		content+='<a href="javascript:reviews(\''+product_id+'\',\''+j+'\')">'+j+'</a>';
  	 	}
  	 	content+='<a href="javascript:reviews(\''+product_id+'\',\''+next_page+'\')">下一页</a><a href="javascript:reviews(\''+product_id+'\',\''+total_page+'\')">尾页</a></div></div>';
  	   divObj.innerHTML=content;
  	 }
  	 location.href="#aa";
  }
  function reviews_failure(o){
  	
  } 
function clickNext_li(obj){
	var ulObj =  document.getElementById(obj);
     var lisNum = ulObj.childNodes.length;
     for(var i=0;i<lisNum-1;i++){
	  tempNum = i+1;
	  if(tempNum>lisNum-1)tempNum=0;
	  if( ulObj.childNodes[tempNum].innerHTML && ulObj.childNodes[i].innerHTML){
	  var temp = ulObj.childNodes[tempNum].innerHTML;
	  ulObj.childNodes[tempNum].innerHTML = ulObj.childNodes[i].innerHTML;
	    ulObj.childNodes[i].innerHTML = temp;
	  }
     }	
}
function clickPriv_li(obj){
	var ulObj =  document.getElementById(obj);
     var lisNum = ulObj.childNodes.length;
     for(var i=lisNum-1;i>0;i--){
	  tempNum = i-1;
	  if(tempNum<0)tempNum=lisNum;
	  if(ulObj.childNodes[tempNum] && ulObj.childNodes[tempNum].innerHTML &&  ulObj.childNodes[i] &&  ulObj.childNodes[i].innerHTML ){
	  var temp = ulObj.childNodes[tempNum].innerHTML;
	  ulObj.childNodes[tempNum].innerHTML = ulObj.childNodes[i].innerHTML;
	    ulObj.childNodes[i].innerHTML = temp;
	  }
     }	
}
function bringbackSelectconOrder(id,valueArray){
	if (window.opener != null){
	   var rec=new Object();
       rec.id=id;
       if(valueArray)
       	 rec.valueArray = valueArray;
       window.opener.bringbackconOrder(rec, window);       
    }
  }
    function bringbackconOrder(rec, subwindow){
	
	var elements = document.getElementsByName("consumer");
	if(elements && elements.length > 0){
		elements[0].value = rec.id;}
		
	elements=document.getElementsByName("issuerParty");
	if(elements&&elements.length>0)elements[0].value=rec.id;
	elements=document.getElementsByName("name_issuerParty");
	if(elements&&elements.length>0)elements[0].value=rec.name;
	elements = document.getElementsByName("consumerName");
	if(lookupOthers){
		for(var i = 0; i < lookupOthers.length; i++){
			var fieldName = lookupPrefix ? (lookupPrefix + lookupOthers[i]) : lookupOthers[i];
			elements = document.getElementsByName(fieldName);
			if(elements && elements.length > 0)
				elements[0].value = rec.valueArray[i];
		}
	}
	subwindow.close();
}
 function trim(s) {
   		return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
    }  
 function validsearch()
    {
    	
    	var s=document.getElementById("_search_condition1").value
    	var s1=document.getElementById("_search_condition")   
    	if(trim(s).length<=0)
    	{  
    		if(s1){
    			if(trim(s1.value).length >0){
    				document.SearchForm3.submit();
    				return;
    			}
    		}
    		alert("请输入搜索条件");
    		return false;
    	}
    	return true;
    }

  function appendDesc(obj){
  var fck = new FCKeditor('longDesc');
  if(fck){
    var oEditor = FCKeditorAPI.GetInstance(fck.InstanceName);
    if(oEditor){ 
    	var descValue = oEditor.GetXHTML(true);
    if(obj){
     if(obj.valueArray[3] && obj.valueArray[3].length>0)
        descValue+='品牌：'+obj.valueArray[3]+'<br />';
     if(obj.valueArray[4] && obj.valueArray[4].length>0)
        descValue+='产地：'+obj.valueArray[4]+'<br />';
     if(obj.valueArray[5] && obj.valueArray[5].length>0)
        descValue+='材质：'+obj.valueArray[5]+'<br />';
     if(obj.valueArray[6] && obj.valueArray[6].length>0)
         descValue+='礼品尺寸(长*宽*高)：'+obj.valueArray[6]+'<br />';
     if(obj.valueArray[7] && obj.valueArray[7].length>0)
        descValue+='包装尺寸(长*宽*高)：'+obj.valueArray[7]+'<br />';
     if(obj.valueArray[8] && obj.valueArray[8].length>0)
        descValue+='重量：'+obj.valueArray[8]+'<br />';
     if(obj.valueArray[9] && obj.valueArray[9].length>0)
       descValue+='颜色：'+obj.valueArray[9]+'<br />';
     if(obj.valueArray[10] && obj.valueArray[10].length>0){
     	 if(obj.valueArray[10]=='1')
         descValue+='是否防水：是<br />';
         else if(obj.valueArray[10]=='2')
          descValue+='是否防水：否<br />';
     }
     if(obj.valueArray[11] && obj.valueArray[11].length>0){
     	 if(obj.valueArray[11]=='1')
         descValue+='是否有证书：是<br />';
         else if(obj.valueArray[11]=='2')
          descValue+='是否有证书：否<br />';
     }
     if(obj.valueArray[12] && obj.valueArray[12].length>0)
         descValue+='使用方法：'+obj.valueArray[12]+'<br />';
     if(obj.valueArray[13] && obj.valueArray[13].length>0)
         descValue+='保修期：'+obj.valueArray[13]+'<br />';
     if(obj.valueArray[14] && obj.valueArray[14].length>0){
     	 if(obj.valueArray[14]=='1')
         descValue+='内存是否可扩充：是<br />';
         else if(obj.valueArray[14]=='2')
          descValue+='内存是否可扩充：否<br />';
     }
      if(obj.valueArray[15] && obj.valueArray[15].length>0){
     	 if(obj.valueArray[15]=='1')
         descValue+='是否有售后服务：是<br />';
         else if(obj.valueArray[15]=='2')
          descValue+='是否有售后服务：否<br />';
     }
   if(obj.valueArray[16] && obj.valueArray[16].length>0){
     	 if(obj.valueArray[16]=='1')
         descValue+='定制周期：'+obj.valueArray[17]+'<br />';
     }
    if(obj.valueArray[18] && obj.valueArray[18].length>0){
     	 if(obj.valueArray[18]=='1')
         descValue+='是否可空运：是<br />';
         else if(obj.valueArray[18]=='2')
          descValue+='是否可空运：否<br />';
     }
    if(obj.valueArray[19] && obj.valueArray[19].length>0)    	 
         descValue+='注意事项：'+obj.valueArray[19]+'<br />';
    if(obj.valueArray[20] && obj.valueArray[20].length>0)    	 
         descValue+='补充说明：'+obj.valueArray[20]+'<br />';
    }
       oEditor.SetHTML(descValue);
  }   
  }
  }
  
  function show_christmas_gifts(arg1,arg2){
  	if(document.getElementById(arg1)){
  	 document.getElementById(arg1).style.display='block';
  	 if(document.getElementById(arg2))
  	   document.getElementById(arg2).style.display='none';
  	}
  }
var christmas_now_page = 0;
function view_christmas_gifts(source,page){
	var callback={
		success: view_christmas_gifts_success, 
		failure: view_christmas_gifts_failure,
		timeout: 8000
	}
	
	var cObj=YAHOO.util.Connect.asyncRequest('get','/gift.do?_methodName=view_christmas_gifts&source='+source+'&page='+page,callback);
}
//after later to modify
function view_christmas_gifts_success(o){
	var responseP=eval('('+ o.responseText+')');
  	 if(responseP.result == '2')
  	 return;
  	 else{
  	 	var divObj = document.getElementById('christmas_sale');
  	 	var nextP = responseP.nextP;
  	 	var previousP = responseP.previousP;
  	 	var source = responseP.source;
  	 	var content='<div class="Xmas_jiantou"><a href="javascript:view_christmas_gifts(\''+source+'\',\''+previousP+'\');"><img src="../images/chrismas/Xmas_jiantou_L.png" border="0" /></a></div><div class="Xmas_gift" ><ul>';
  	 	for(var i=0;i<responseP.products.length;i++){
  	 		productid=eval('responseP.products['+i+'].id');
			picture=eval('responseP.products['+i+'].picture');
			productName=eval('responseP.products['+i+'].name') ? eval('responseP.products['+i+'].name') : "";
			liYi99price=eval('responseP.products['+i+'].liyi99price') ? eval('responseP.products['+i+'].liyi99price') : "";			
			customType=eval('responseP.products['+i+'].customType') ? eval('responseP.products['+i+'].customType') : 0;
  	 		content+='<li>';
  	 		if(customType == 6){
  	 			content+='<p class="Xmas_gift_img"><a href="/flower/giftview'+productid+'.html" target="_blank"><img src="'+picture+'" border="0" /></a></p>'
                     +'<p><a href="/flower/giftview'+productid+'.html" target="_blank">'+productName+'</a></p>'
                     +'<p class="Xmas_gift_jiage">￥<span>'+liYi99price+'</span>元</p>'
                     +'<p><a class="Xmas_gift_bt" href="/flower/giftview'+productid+'.html" target="_blank"><img border="0" src="/images/scnd/scndbot_r1_c5_c.gif"></a><a class="Xmas_gift_bt" href="javascript:addR('+productid+','+customType+')"><img border="0" src="/images/scnd/scndbot_r1_c5_j.gif"></a></p>';
  	 		}else{
  	 			content+='<p class="Xmas_gift_img"><a href="/giftview'+productid+'.html" target="_blank"><img src="'+picture+'" border="0" /></a></p>'
                     +'<p><a href="/giftview'+productid+'.html" target="_blank">'+productName+'</a></p>'
                     +'<p class="Xmas_gift_jiage">￥<span>'+liYi99price+'</span>元</p>'
                     +'<p><a class="Xmas_gift_bt" href="/giftview'+productid+'.html" target="_blank"><img border="0" src="/images/scnd/scndbot_r1_c5_c.gif"></a><a class="Xmas_gift_bt" href="javascript:addR('+productid+','+customType+')"><img border="0" src="/images/scnd/scndbot_r1_c5_j.gif"></a></p>';
  	 		}
             content+='</li>';
  	 	}
  	 	content+='</ul></div><div class="Xmas_jiantou"><a href="javascript:view_christmas_gifts(\''+source+'\',\''+nextP+'\');"><img src="../images/chrismas/Xmas_jiantou_R.png" border="0" /></a></div>';
  	   divObj.innerHTML=content;
  	 }
}
function view_christmas_gifts_failure(){
	
}

