
//TOP page searchbox

function selectSearch(){
	var q=document.search_sup_form2.search_sup_box.value;
	if(document.search_sup_form2.search_support.checked){
		var s_url="http://site-search.nifty.com/generalsearch/search?";
		var s_type=document.search_sup_form2.wgs_service_id_index.value;
		var s_cflg=document.search_sup_form2.cfg.value;
		var s_tmpl=document.search_sup_form2.tmpl.value;
		
		// ---------------v1.0
		//s_urlq=encodeURIComponent(s_url);
		//s_type=encodeURIComponent(s_type);
		//s_cflg=encodeURIComponent(s_cflg);
		//s_tmpl=encodeURIComponent(s_tmpl);
		//q=encodeURL(q.replace(/\"/g,"%22").replace(/\'/g,"%27").replace(/</g," ").replace(/>/g," "));
		//var pram="search-target=&type="+s_type+"&cflg="+s_cflg+"&tmpl="+s_tmpl+"&q="+encodeURIComponent(q);
		//location.href=s_url+pram;
		// --------------v1.2
		document.search_sup_form_h.q.value=q;
		document.search_sup_form_h.submit();
		return false;
	}
	if(document.search_sup_form2.search_qa.checked){
		var s_url="http://faq.nifty.com/nft5795/web2210/faq/result.asp?";
		var pram="Option=1&DispNodeID=0&CID=0&NodeID=0&Rows=&KW=1&KWAnd=0&Field=2&text="+escape(q);
		location.href=s_url+pram;
		return false;
	}
	return false;
}

function encodeURL(str){
	var s0, i, s, u;
	s0 = "";
	for (i = 0; i < str.length; i++){
			s = str.charAt(i);
			u = str.charCodeAt(i);
			if (s == " "){s0 += "+";}
			else {
					if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){
							s0 = s0 + s;
					} else {
							if ((u >= 0x0) && (u <= 0x7f)){
									s = "0"+u.toString(16);
									s0 += "%"+ s.substr(s.length-2);
							} else if (u > 0x1fffff){
									s0 += "%" + (oxf0 + ((u & 0x1c0000) >> 18)).toString(16);
									s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16);
									s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
									s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
							} else if (u > 0x7ff){
									s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16);
									s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
									s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
							} else {
									s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16);
									s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
							}
					}
			}
	}
	return s0;
}






// side-bar banner

function randomAdv() {
	m = 0, x = 0, y = 0;
	ad= new Array();
	adv = new Array();
	hit = new Array();

	hit[0] = 3; adv[0] = "<a href='http://clink.nifty.com/r/support/ct/?http://www.nifty.com/card/'><img src='/support/common/images/ad/ad_bana06.gif' width='260' height='60' alt='常時安全カード' /></a>";
	hit[1] = 3; adv[1] = "<a href='http://clink.nifty.com/r/support/ct/?http://shopping.nifty.com/sp/fmv/fmv1/'><img src='/support/common/images/ad/ad_bana12.jpg' width='260' height='60' alt='富士通 WEB MART' /></a>";

for(i=0; i<=hit.length - 1; i++) {
	m += hit[i];
	}
	n = Math.floor(Math.random() * m);
	n++;
	for(i=0; i<=hit.length - 1; i++) {
		x = y;
		y += hit[i];
		if(x<n && n<=y) ad = adv[i];
	}
	document.write(ad);
}