//単純にウインドウオープン
function PopupWinDef(url, name) {
	if(url != ""){
		var PopWinName;
		PopWinName=window.open(url,name);
		PopWinName.focus();
		return;
	}
}
//サイズ指定でウインドウオープン
function PopupWin(url, name, win_w, win_h, too, loc, dir, sta, men, scr, res) {
	if(url != ""){
		var PopWinName;
		var x = (screen.width  - win_w) / 2;
		var y = (screen.height - too*40 - loc*40 - dir*40 - sta*40 - men*40 - win_h) / 2;
		if(x < 0) x = 0;
		if(y < 0) y = 0;
		PopWinName=window.open(url,name,'toolbar='+too+',location='+loc+',directories='+dir+',status='+sta+',menubar='+men+',scrollbars='+scr+',resizable='+res+',left=' + x + ',top=' + y + ',width=' + win_w + ',height=' + win_h);
		PopWinName.focus();
		return;
	}
}
//位置とサイズ指定でウインドウオープン
function PopupWinPos(url, name, x, y, win_w, win_h, too, loc, dir, sta, men, scr, res) {
	if(url != ""){
		var PopWinName;
		if(x < 0) x = 0;
		if(y < 0) y = 0;
		PopWinName=window.open(url,name,'toolbar='+too+',location='+loc+',directories='+dir+',status='+sta+',menubar='+men+',scrollbars='+scr+',resizable='+res+',left=' + x + ',top=' + y + ',width=' + win_w + ',height=' + win_h);
		PopWinName.focus();
		return;
	}
}
//1つのテキストボックスのID(値は無し)を指定してウインドウオープン
function PopupWinEleID(ele, url, name, win_w, win_h, too, loc, dir, sta, men, scr, res) {
	if(url != ""){
		var PopWinName;
		var x = (screen.width  - win_w) / 2;
		var y = (screen.height - too*40 - loc*40 - dir*40 - sta*40 - men*40 - win_h) / 2;
		if(x < 0) x = 0;
		if(y < 0) y = 0;
		var myUrl;
		if(url.indexOf("\?",0) == -1){
			myUrl = url+'?element='+ele;
		}else{
			myUrl = url+'&element='+ele;
		}
		PopWinName=window.open(myUrl,name,'toolbar='+too+',location='+loc+',directories='+dir+',status='+sta+',menubar='+men+',scrollbars='+scr+',resizable='+res+',left=' + x + ',top=' + y + ',width=' + win_w + ',height=' + win_h);
		PopWinName.focus();
		return;
	}
}
//1つのテキストボックスとその値を指定して、その時点でセットされている値と共にウインドウオープン
function PopupWinEle(ele, url, name, win_w, win_h, too, loc, dir, sta, men, scr, res) {
	if(url != ""){
		var PopWinName;
		var x = (screen.width  - win_w) / 2;
		var y = (screen.height - too*40 - loc*40 - dir*40 - sta*40 - men*40 - win_h) / 2;
		if(x < 0) x = 0;
		if(y < 0) y = 0;
		var myUrl;
		if(url.indexOf("\?",0) == -1){
			myUrl = url+'?element='+ele;
		}else{
			myUrl = url+'&element='+ele;
		}
		if(document.getElementById(ele).value){
			myUrl += '&elementvalue='+escape(document.getElementById(ele).value);
		}
		PopWinName=window.open(myUrl,name,'toolbar='+too+',location='+loc+',directories='+dir+',status='+sta+',menubar='+men+',scrollbars='+scr+',resizable='+res+',left=' + x + ',top=' + y + ',width=' + win_w + ',height=' + win_h);
		PopWinName.focus();
		return;
	}
}
//2つのテキストボックスとその値を指定して、その時点でセットされている値と共にウインドウオープン
function PopupWinEle2(ele1, ele2, url, name, win_w, win_h, too, loc, dir, sta, men, scr, res) {
	if(url != ""){
		var PopWinName;
		var x = (screen.width  - win_w) / 2;
		var y = (screen.height - too*40 - loc*40 - dir*40 - sta*40 - men*40 - win_h) / 2;
		if(x < 0) x = 0;
		if(y < 0) y = 0;
		var myUrl;
		if(url.indexOf("\?",0) == -1){
			myUrl = url+'?element1='+ele1;
		}else{
			myUrl = url+'&element1='+ele1;
		}
		if(document.getElementById(ele1).value){
			myUrl += '&elementvalue1='+escape(document.getElementById(ele1).value)+'&element2='+ele2;
		}else{
			myUrl += '&element2='+ele2;
		}
		if(document.getElementById(ele2).value){
			myUrl += '&elementvalue2='+escape(document.getElementById(ele2).value);
		}
		//alert(myUrl);
		PopWinName=window.open(myUrl,name,'toolbar='+too+',location='+loc+',directories='+dir+',status='+sta+',menubar='+men+',scrollbars='+scr+',resizable='+res+',left=' + x + ',top=' + y + ',width=' + win_w + ',height=' + win_h);
		PopWinName.focus();
		return;
	}
}
//ポップアップでカラーパレットを表示。
function PUCP(ele){
    PopupWin('/program/common/controls/colorpallet/ColorPalletSelector.aspx?CodeElement='+ele+'','SelColor',800,130,0,0,0,0,0,0,0)
}
