function strCode(str)
{
	if(encodeURIComponent)
	{
		str.replace(/ /g,'_').replace(/-/g,'^');
		return encodeURIComponent(str).replace(/%/g,"%25");	
	}
	if(escape)
	{
		return escape(str).replace(/%/g,"%25");
	}
}

function gotopage(url) {
	window.location=url;
}

function goconnect(kw,src,country,title1,title2,title3,title4,key1,value1,key2,value2) {
	//	/buy-garment/src_product,country_156,selectrefine_TQS-Rank_4_stars_and_up/
	var url="";
	kw=strCode(kw);
	country=strCode(country);
	if(country=='0'||country=="")
	{
		country=156;
	}
	if(src=="company")
	{
		url=url+"/manufacturer-"+kw+"-/src_"+src+",country_"+country;
	}
	else if(src=="product")
	{
		url=url+"/buy-"+kw+"/src_"+src+",country_"+country;
	}
	
	if(title1!="")
	{
		url=url+",selectrefine_Quality-Cert_"+strCode(title1);
	}
	if(title2!="")
	{
		url=url+",selectrefine_Business-Type_"+strCode(title2);
	}
	if(title3!="")
	{
		url=url+",selectrefine_TQS-Rank_"+strCode(title3);
	}
	if(title4!="")
	{
		url=url+",selectrefine_Main-Markets_"+strCode(title4);
	}
	if(value1!="")
	{
		url=url+",selectrefine_"+key1+"_"+strCode(value1);
	}
	if(value2!="")
	{
		url=url+",selectrefine_"+key2+"_"+strCode(value2);
	}
	
	url =url+"/";
	window.location=url;
}

function gobusiness(kw,src,code,country,pos){
	var url ="";
	kw=strCode(kw);
	country=strCode(country);
	switch(pos)
	{
		case 1:
			url =url+"/buy-"+kw+"/src_"+src;
			if(code!="")
			{
				url =url+",code_"+code;
			}
			url=url+",country_"+country+",selectrefine_Business-Type_Manufacturer/selectrefine[Business_Type]-Manufacturer";
			break;
		case 2:
			url =url+"/buy-"+kw+"/src_"+src;
			if(code!="")
			{
				url =url+",code_"+code;
			}
			url=url+",country_"+country+",selectrefine_Business-Type_Trading/selectrefine[Business_Type]-Trading";
			break;
		case 3:
			url =url+"/buy-"+kw+"/src_"+src;
			if(code!="")
			{
				url =url+",code_"+code;
			}
			url=url+",country_"+country+",selectrefine_Business-Type_"+strCode("Distributor/Wholesaler")+"/selectrefine[Business_Type]-"+strCode("Distributor/Wholesaler");
			break;
		case 4:
			url =url+"/buy-"+kw+"/src_"+src;
			if(code!="")
			{
				url =url+",code_"+code;
			}
			url=url+",country_"+country+",selectrefine_Business-Type_Agent/selectrefine[Business_Type]-Agent";
			break;
	
	}
	window.location=url;
}

function goregion(kw,src,id,name) {
	// /buy-mp3-Indonesia/src_product,country_360/
	
	kw=strCode(kw);
	
	var url ="/buy-"+kw+"-"+name.replace(/ /g,"_")+"/src_"+src+",country_"+id+"/";
	window.location=url;
}







