function fsetGetVar(pUrl, pVar, pValue){
	var curUrl=new String(pUrl);
	var reg=new RegExp(pVar+'=[^&]*');
	var result=curUrl;
	if (curUrl.search(reg)>=0){
		curUrl=curUrl.replace(reg, (pValue=='')? '' : pVar+'='+pValue);
	}
	else {
			if (pValue!=''){
				if (curUrl.search(/[^?]*\?/)>=0) {
					curUrl=curUrl+'&'+pVar+'='+pValue;
				}
				else {
					curUrl=curUrl+'?'+pVar+'='+pValue;
				}
			}
	}
	reg=new RegExp('&{2,}');
	curUrl=curUrl.replace(reg,'&');
	reg=new RegExp('&{1,}$');
	curUrl=curUrl.replace(reg,'');
	return (curUrl);
}

function fSearch(myForm){
	mySearch=document.forms[0].search.value;
	var newUrl=fsetGetVar(String(document.location),'search',mySearch);
	newUrl=fsetGetVar(newUrl,'page',1);
	document.location=newUrl;
}

function fOpenDetail(id){
	var newUrl=fsetGetVar(String(document.location),'id',id);
	document.location=newUrl;
}

function fOpenCustWin(url,width,height){
	myScreenHeight=(window.screen.availHeight-height)/2;
	myScreenWidth=(window.screen.availWidth-width)/2;
	newWindow=window.open(url,"subWind", "HEIGHT="+height+",WIDTH="+width+",menubar=no,toolbar=no,titlebar=yes,TOP="+myScreenHeight+",LEFT="+myScreenWidth+",scrollbars=yes");
	newWindow.focus();
}

function fOpenWin(url){
	myScreenHeight=(window.screen.availHeight-600)/2;
	myScreenWidth=(window.screen.availWidth-800)/2;
	newWindow=window.open(url,"subWind", "HEIGHT=600,WIDTH=800,menubar=no,toolbar=no,titlebar=yes,TOP="+myScreenHeight+",LEFT="+myScreenWidth+",scrollbars=yes");
	newWindow.focus();
}
