var HashSetting;
function setBase(sid){
	if(!sid || !HashSetting) return false;
	var s = HashSetting;
	var p = pgtype;
	if(!s['title']){s['title'] = '百科事典';}
	if( p == 'art'){
		wgServer = 'http://'+location.hostname;
		var entrytitle = '';
		if('wgTitle' in window){
			if(wgTitle) entrytitle = wgTitle;
		}
		document.write('<title>'+ entrytitle + ' - '+ s['title'] + '</title>\n');
	}
	if( p == 'top' ){
		document.write('<title>'+  s['title'] + '</title>\n');
	}
	if(s['faviUrl']) document.write('<link rel="shortcut icon" href="'+s['faviUrl']+'" />\n');
	if(s['isRightClm']) document.write('<link rel="stylesheet" type="text/css" href="http://img.newswatch.jp/asp_pedia/css/asp_sub02.css" />\n');
	if(s['cuscssUrl']) document.write('<link rel="stylesheet" type="text/css" href="'+s['cuscssUrl']+'" />\n');
}
function setHF(sid, mode, cs){
	if(!sid || !HashSetting) return false;
	if(!cs) cs = 'utf-8';
	var s = HashSetting;
	if(s['HF'] && s['HF'][mode]){
		var url = s['HF'][mode];
		document.write('<scr'+'ipt type="text/javascr'+'ipt" charset="'+cs+'" src="' + url + '" ></scr' + 'ipt>');
	}else if(s['jsUrl']) {
		var url = s['jsUrl'] + sid + "_" + mode + ".js";
		document.write('<scr'+'ipt type="text/javascr'+'ipt" charset="'+cs+'" src="' + url + '" ></scr' + 'ipt>');
	}
}
function setMente(sid){
	if(!sid) return false;
	document.write('<link rel="stylesheet" type="text/css" href="http://img.newswatch.jp/asp_pedia/css/asp_mente_'+sid+'.css" />\n');
}
function setSearch(sid,query,bname,cs){
	if(!sid || !HashSetting) return false;
	if(!query)query = '';
	if(!bname)bname = '検索';
	if(!cs)   cs    = 'utf-8';
	var s = HashSetting;
	var htmltxt ='';
	htmltxt += '<div id="asp_searchbox"><form method="get" action="'+s['DomainSrc']+'">\n';
	htmltxt += '<input type="text" value="'+query+'" name="kw" class="txtbox" />';
	htmltxt += '<input type="submit" value="'+bname+'" class="sbutton" />\n';
	htmltxt += '<input type="hidden" value="'+sid+'" name="sid" />\n';
	htmltxt += '<input type="hidden" value="wiki_svc_'+sid+'" name="rt" />\n';
	htmltxt += '<input type="hidden" value="'+cs+'" name="ics" />\n<input type="hidden" value="'+cs+'" name="ocs" />\n';
	htmltxt += '</form></div>';
	if(s['isSrcbox4p'] != false && pgtype != 'sch'){
		document.write(htmltxt);
	}
	if(s['isSrcbox4s'] != false && pgtype == 'sch'){
		document.write(htmltxt);
	}
}
function setRltArt(sid,thid,query){
	if(!sid || !HashSetting) return false;
	if(!query) query = '';
	if(!thid) thid= '';
	var s = HashSetting;
	if(s['isRltArt']){
		document.write('<scr'+'ipt type="text/javascr'+'ipt">var NWREL_thid="'+thid+'";var NWREL_sid="'+sid+'";var NWREL_query="'+query+'"</scr' + 'ipt>');
		var url = 'http://img.newswatch.jp/asp_pedia/js/rlt/asp_pedia_NWRelart02.js';
		document.write('<scr'+'ipt type="text/javascr'+'ipt" charset="utf-8" src="' + url + '" ></scr' + 'ipt>');
	}
}
function CheckSiteID() {
	var sid = '';
	var args = new Array();
	var q = location.search ;
	if (q.length > 0) {
		q = q.replace("?","") ;
		var vars = q.split("&") ;
		for (var i=0;i<vars.length;i++) { 
			var tmp = vars[i].split("=") ;
			args[tmp[0]] = tmp[1] ;
		}
	}
	if(args['sid']) sid = args['sid'];
	return sid ;
}
if(!sid){ sid = CheckSiteID();}
if(sid) { document.write('<script type="text/javascript" src="http://img.newswatch.jp/asp_pedia/js/asp_wkpsearch_' + sid + '.js" ></scr' + 'ipt>');}  
