function getcheck_query(vpage,querykey,keyword,querycategory)
{
var curvalue;
curvalue="";
j=document.queryform.length-1;
for (i=0;i<j;i++)
  {
   if (document.queryform[i].checked)
        {
                curvalue=curvalue+document.queryform[i].value+";";
        }
  }
str="productlist.php";
str += '?querykey='+querykey;
str += '&page='+vpage;
str += '&keyword='+keyword;
str += '&querycategory='+querycategory;
str += '&curvalue='+document.form2.allvalue.value+curvalue;
window.location.href=str;
}

function getcheck_union(vpage,subcateid,manuid,catename,subname,categoryid,paramid,paramvalue)
{
	var curvalue;
	curvalue="";
	j=document.queryform.length-1;
	for (i=0;i<j;i++){
	   if (document.queryform[i].checked)
			{
				curvalue=curvalue+document.queryform[i].value+";";
			}
	}
	str="productlist.php";
	str += '?page='+vpage;
	str += '&manuid='+manuid;
	str += '&subcateid='+subcateid;
	str += '&paramid=' + paramid;
	str += '&paramvalue=' + paramvalue;
	str += '&curvalue='+document.form2.allvalue.value+curvalue;
	window.location.href=str;
}
//==end==

function getcheck_manuid(vpage,subcateid,manuid,catename,subname,categoryid)
{
var curvalue;
curvalue="";
j=document.manuform.length-1;
for (i=0;i<j;i++)
  {
   if (document.manuform[i].checked)
        {
                curvalue=curvalue+document.manuform[i].value+";";
        }
  }
str="productlist.php";
str += '?page='+vpage;
str += '&manuid='+manuid;
str += '&subcateid='+subcateid;
str += '&curvalue='+document.form2.allvalue.value+curvalue;
window.location.href=str;
}


function getcheck_paramid(vpage,subcateid,paramid,paramvalue,catename,subname,categoryid)
{
var curvalue;
curvalue="";
j=document.paramform.length-1;
for (i=0;i<j;i++)
{
if (document.paramform[i].checked)
        {
                curvalue=curvalue+document.paramform[i].value+";";
        }
}
str="productlist.php";
str += '?page='+vpage;
str += '&paramid='+paramid;
str += '&paramvalue='+paramvalue;
str += '&subcateid='+subcateid;
str += '&curvalue='+document.form2.allvalue.value+curvalue;
window.location.href=str;
}

function getcheck(vpage,subcateid,catename,subname,categoryid)
{
var curvalue;
curvalue="";
j=document.formname.length-1;
for (i=0;i<j;i++)
{
if (document.formname[i].checked)
        {
                curvalue=curvalue+document.formname[i].value+";";
        }
}
str="productlist.php";
str += '?page='+vpage;
str += '&subcateid='+subcateid;
str += '&curvalue='+document.form2.allvalue.value+curvalue;
window.location.href=str;
}


function getallvalue(subcateid,varform,catename,subname,categoryid)
{
var comvalue,checkvalue;
comvalue="";
j=varform.length-1;
for (i=0;i<j;i++)
{
if (varform[i].checked)
        {
                comvalue=comvalue+varform[i].value+";";
        }
}
checkvalue=document.form2.allvalue.value+comvalue;
checkvaluearray=checkvalue.split(";");
checkvalue=checkvaluearray.join("");
if (checkvalue=="")
{
alert("对不起，您还没有选择要比较的产品！");
}
else
{
str="compare.php";
str += '?subcateid='+subcateid;
str += '&curvalue='+document.form2.allvalue.value+comvalue;
window.location.href=str;
}
}


function getallvalue_query()
{
var comvalue,checkvalue;
comvalue="";
j=document.queryform.length-1;
for (i=0;i<j;i++)
{
if (document.queryform[i].checked)
        {
                comvalue=comvalue+document.queryform[i].value+";";
        }
}
checkvalue=document.form2.allvalue.value+comvalue;
checkvaluearray=checkvalue.split(";");
checkvalue=checkvaluearray.join("");
if (checkvalue=="")
{
alert("对不起，您还没有选择要比较的产品！");
}
else
{
str="query_produ_compare.php3";
str += '?curvalue='+document.form2.allvalue.value+comvalue;
window.location.href=str;
}
}


function checkuseropinion()
{
	if (document.add_useropinion.summary.value.length<2){
		alert("对不起，请填写一句话短评！");
		document.add_useropinion.summary.focus();
		return false;
	}
	else if(document.add_useropinion.verify_code.value==""){
		alert('请输入验证码！');
		document.add_useropinion.verify_code.focus();
		return false;
	}
	else{
		document.add_useropinion.submit();
		return true;
	}
}

//-------------------------------add by jove---------------------
// goToPage
function gopage(filename,pgnum,manuid,catid,subcatid,keyword,sort,params_str)  {
	var curvalue;
	curvalue="";
	for (i=0;i<document.queryform.length;i++){
	   if (document.queryform[i].checked){
		curvalue=curvalue+document.queryform[i].value+";";
	   }
	}
	str=filename+"?";
	str += 'page='+pgnum;
	str += '&manuid='+manuid;
	str += '&catid='+catid;
	str += '&subcatid='+subcatid;
	str += '&keyword='+keyword;
	//str += '&paramids=' + paramids;
	//str += '&paramvalues=' + paramvalues;
	str+=params_str;
	str += '&sort='+ sort;
	str += '&selected='+document.formselected.prod_selected.value+curvalue;
	window.location.href=str;
}

// goToPage
function gotopage(pgnum,manuid,catid,subcatid,minprice,maxprice,keyword,sort,params_str)  {
	/*var curvalue;
	curvalue="";
	for (i=0;i<document.queryform.length;i++){
	   if (document.queryform[i].checked){
		curvalue=curvalue+document.queryform[i].value+";";
	   }
	}
	*/
	if((keyword=='') && (params_str=='')){
		str="/products/productlist,"+subcatid+","+manuid+","+minprice+","+maxprice+","+sort+","+pgnum+".html";
	}
	else{
		str="productlist.php?";
		str += 'page='+pgnum;
		str += '&manuid='+manuid;
		//str += '&catid='+catid;
		str += '&subcatid='+subcatid;
		str += '&keyword='+keyword;
		//str += '&paramids=' + paramids;
		//str += '&paramvalues=' + paramvalues;
		str+=params_str;
		str += '&sort='+ sort;
		//str += '&selected='+document.formselected.prod_selected.value+curvalue;
		str += '&selected='+document.formselected.prod_selected.value;
	}
	window.location.href=str;
}

function productlist_url(subcatid,manuid,minprice,maxprice,keyword,sort,params_str,param_value_sign,,pagesize){
	if(param_value_sign==0){
		params_str='';
		keyword='';
	}
	gotopage(1,manuid,0,subcatid,minprice,maxprice,keyword,sort,params_str,pagesize);
	return false;
}
function shop_gotopage(pgnum,manuid,catid,subcatid,keyword,paramids,paramvalues)  {
	var curvalue;
	curvalue="";
	for (i=1;i<document.queryform.length-1;i++){
	   if (document.queryform[i].checked){
		curvalue=curvalue+document.queryform[i].value+";";
	   }
	}
	str="price_list.php?";
	str += 'page='+pgnum;
	str += '&manuid='+manuid;
	str += '&catid='+catid;
	str += '&subcatid='+subcatid;
	str += '&keyword='+keyword;
	str += '&paramids=' + paramids;
	str += '&paramvalues=' + paramvalues;
	str += '&selected='+document.formselected.prod_selected.value+curvalue;
	window.location.href=str;
}

function all_product_compare(filename,catid,subcatid,varform){
	var comvalue,checkvalue;
	comvalue="";
	j=varform.length-1;
	num=0;
	for (i=0;i<=j;i++)
	{
   	  if (varform[i].checked){
		  num++;
	     comvalue=comvalue+varform[i].value+";";
	  }
	}
	if(num>7){
		alert("比较的产品最多七种！");
		return false;
	}
	checkvalue=document.formselected.prod_selected.value+comvalue;
	checkvaluearray=checkvalue.split(";");
	checkvalue=checkvaluearray.join(" ");
	if (checkvalue=="")
	{
		alert("请选择产品！");
		return false;
	}
	else{
		str=filename+"?";
		//str += 'controller=product_compare';
		str += 'catid='+catid;
		str += '&subcatid='+subcatid;
		str += '&selected='+document.formselected.prod_selected.value+comvalue;
		window.location.href=str;
	}
}

function product_compare(catid,subcatid,varform){
	var comvalue,checkvalue;
	comvalue="";
	j=varform.length-1;
	num=0;
	//alert(j);
	for (i=0;i<=j;i++)
	{
   	  if (varform[i].checked){
		  num++;
	     comvalue=comvalue+varform[i].value+";";
	  }
	}
	//alert(comvalue);
	if(num>7){
		alert("比较的产品最多七种！");
		return false;
	}
	checkvalue=document.formselected.prod_selected.value+comvalue;
	checkvaluearray=checkvalue.split(";");
	checkvalue=checkvaluearray.join(" ");
	if (checkvalue=="")
	{
		alert("请选择产品！");
		return false;
	}
	else{
		str="compare.php?";
		//str += 'controller=product_compare';
		str += 'catid='+catid;
		str += '&subcatid='+subcatid;
		str += '&selected='+document.formselected.prod_selected.value+comvalue;
		//alert(str);
		window.location.href=str;
	}
}

// goToSort
function goToSort(orderBy, oid)  {
    // override the orderBy value with the argument
    document.mainForm.orderby.value = orderBy;
    // redirect action back to this page
    document.mainForm.action = oid + ".html";
    // submit the form
    document.mainForm.submit();
}


function merch_list()
{
var produ_form_id,j;
produ_form_id="";
j=document.produ_form.length-1;
var flag;
flag=0;
for (i=1;i<j;i++)
 {
   if (document.produ_form[i].checked)
   {
	   if (flag==0)
		   {
		   produ_form_id=produ_form_id+document.produ_form[i].value;
		   flag=1;
		   }
	   else
		   {
		   produ_form_id=produ_form_id+";"+document.produ_form[i].value;
		   }
   }
 }
if (flag==0){
  alert ("没有可比较的产品！");
  return true;
}
str ="viewlist.php";
str +='?produ_form_id='+produ_form_id;
window.location.href=str;
}


function emailfriend(page)
{
var i,produ_form_id,j,flag;
produ_form_id="";
j=document.produ_form.length-1;
flag=0;
for (i=1;i<j;i++)
 {
       if (document.produ_form[i].checked)
       {
               if (flag==0)
                       {
                       produ_form_id=produ_form_id+document.produ_form[i].value;
                       flag=1;
                       }
               else
                       {
                       produ_form_id=produ_form_id+";"+document.produ_form[i].value;
                       }
       }
 }
 if (flag==1)
 {
 window.open("emailfriend.php?produ_form_id="+produ_form_id+"&page="+page,null,"height=540,width=460,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
 }
 else
 {alert("对不起，请选中你推选的产品！");}
}
//-------------------------------------------------