﻿// 寬度同步(px)
function autoWidth(id,id2,fixwd){	
	var obj1 = window.document.getElementById(id);
	var obj2 = window.document.getElementById(id2);
	var v =  obj1.clientWidth;	
	obj2.style.width = v - fixwd + 'px';
}

// 開啟Dialog視窗
function openDialog(url,w,h){
	window.showModalDialog(url, window, 'dialogWidth=' + w + 'px;dialogHeight=' + h + 'px;scroll=no;status=no;');	
}

// 開啟Dialog視窗(Debug)
function openDialogDebug(url,w,h){	
	window.showModalDialog(url, window, 'dialogWidth=' + w + 'px;dialogHeight=' + h + 'px;scroll=yes;status=yes;');	
}


// 開啟Window視窗
function openWindow(url,name,w,h){
	var left, top;
	left = (window.screen.Width - w) / 2;
	top = (window.screen.Height - h) / 2 - 20;
	
	window.open(url, name , 'left='+ left +'px,top='+ top +'px,width=' + w +'px,height=' + h + 'px,location=no,menubar=no,resizable=yes,scrollbars=no,toolbar=no,status=yes,directories=no');
}

// 開啟Window視窗
function openWindowEx(url,name,w,h){
	var left, top;
	left = (window.screen.Width - w) / 2;
	top = (window.screen.Height - h) / 2 - 20;
		
	window.open(url, name , 'left='+ left +'px,top='+ top +'px,width=' + w +'px,height=' + h + 'px,location=yes,menubar=yes,resizable=yes,scrollbars=yes,toolbar=yes,status=yes,directories=yes');
}

// 開啟滿版的視窗
function openfullWindow(url,name,toolbar){
	var w, h;
	w = window.screen.Width - 12;
	h = window.screen.Height - 90;
	var str_toolbar
	if(toolbar==1){str_toolbar='yes';h=h-40}
	else{str_toolbar='no'}
	
	window.open(url, name , 'left=0px,top=0px,width=' + w +'px,height=' + h + 'px,location=no,menubar=no,resizable=yes,scrollbars=no,toolbar=' + str_toolbar + ',status=yes,directories=no');
}

// 開啟滿版Dialog視窗
function openfullDialog(url){
	var w,h;
	w = window.screen.Width - 12;
	h = window.screen.Height - 30;
	openDialog(url,w,h)
}
