﻿var UrlMap = {
	root:'enter.action',
	price:'price.action',
	download:'download.action',
	purchase :'purchase.action',
	newfunction:'newfunction.action',
	tryIt:'tryIt.action',
	support:'support/online.action',
	support_online:'support/online.action',
	support_faq:'support/faq.action',
	channel:'channel/system.action',
	channel_system:'channel/system.action',
	channel_apply:'channel/apply.action',
	channel_agents:'channel/agents.action',
	boka:'boka/info.action',
	boka_info:'boka/info.action',
	boka_recruit:'boka/recruit.action',
	boka_news:'boka/news.action',
	boka_contact:'boka/contact.action',
	boka_bank:'boka/bank.action',
	boka_law:'boka/law.action',
	boka_website:'boka/website.action',
	custom:'custom/all.action',
	custom_all:'custom/all.action',
	custom_comment:'custom/comments.action',
	custom_typical:'custom/typical.action',
	custom_show:'custom/showClient.action',
	product:'product/group.action',
	product_group:'product/group.action',
	product_middle:'product/middle.action',
	business:'business/hair.action',
	business_hair:'business/hair.action',
	business_healthcare:'business/health_care.action',
	business_spa:'business/spa.action',
	business_others:'business/others.action',
	case_hair:'custom/caseList.action',
	case_spa:'custom/caseList.action',
	case_health:'custom/caseList.action',
	case_others:'custom/caseList.action'
}
// 绝对路径
var basePath ;
function dispatch(pathId,pathName){
	if(!UrlMap[pathName]){
		alert("尚未实现");
		return;
	}
	if(pathName == 'newfunction') {
		window.location = basePath + UrlMap[pathName] + "?pathId=" + pathId + "&pagerName=function" ;
	} else  if(pathName == 'custom' || pathName == 'custom_all') {
		window.location =  basePath + UrlMap[pathName] + "?pathId=" + pathId 
																				+ "&parentId=22&pager.pageOffset=20" ;
	} else if(pathName == 'support_faq'){
		window.location =  basePath + UrlMap[pathName] + "?pathId=" + pathId + "&pagerName=faq&faqTitle=" ;
	} else {
		window.location =  basePath + UrlMap[pathName] + "?pathId=" + pathId;
	}
}

function dispatchToCustom(pathId,pathName){
	if(!UrlMap[pathName]){
		alert("尚未实现");
		return;
	}
	if(pathName == 'custom' || pathName == 'custom_all'){
		window.location =  basePath + UrlMap[pathName] + "?pathId=" + pathId 
																				+ "&parentId=22&pager.pageOffset=20" ;
	}  else {
		window.location =  basePath + UrlMap[pathName] + "?pathId=" + pathId + "&parentId=" + pathId;
	}
}

function openInNewWindow(pathId,pathName){
	if(!UrlMap[pathName]){
		alert("尚未实现");
		return;
	}
	window.open( basePath + UrlMap[pathName] + "?pathId=" + pathId + "&parentId=" + pathId);
}


function readNews(newsId,pathId){
	window.location =  basePath + "readNews.action?" + "newsId=" + newsId + "&pathId=" + pathId;
}

function encodeParam(){
	var title = document.getElementById('title_txt');
	alert(title.value);
	document.getElementById('title').value = escape(escape(document.getElementById('title_txt').value));
}

function processParams(names,values){
		 var params = new Array();
		 for(var i=0,len=names.length;i<len;i++){
				params.push(names[i] + "=" + values[i]);
		 }
		return params.join('&');
}
