﻿// JavaScript Document
// line 59 : 2011/1/28 matt modify 
//           修正 firefox 瀏覽器不支援reset() 需重新設定pageID caseBox actions 不然會錯誤

//移動至頁面
function gotoPage(pID,box, urlPame){
	if (pID == undefined) { pID = 1; }
	var xx;
	for (xx=0;xx<document.forms.length;xx++){
		if (document.forms[xx].pageID != undefined){
			theForm = document.forms[xx];
			break;
		}
	}
	theForm.reset();
	theForm.pageID.value = pID;
	if (box != undefined){ theForm.caseBox.value = box; }
	if (location.search != ''){ theForm.action = 'index.cfm'; }
	if (urlPame != undefined)
		if (pID < 100){ theForm.action = theForm.action + '?p=' + pID + '&' + urlPame; }
	else
		if (pID < 100){ theForm.action = theForm.action + '?p=' + pID; }
	theForm.submit();
}

function gotoRoot(pID,box){
	if (pID == undefined) { pID = 1; }
//	for (xx=0;xx<document.forms.length;xx++){
	var xx;
	for (xx=document.forms.length-1;xx>-1;xx--){
		if (document.forms[xx].id == 'rootForm'){
			theForm = document.forms[xx];
			break;
		}
	}
	theForm.pageID.value = pID;
	if (box != undefined){ theForm.caseBox.value = box; }
	if (pID < 100){ theForm.action = theForm.action + '?p=' + pID; }
	theForm.submit();
}

function goAction(act){
	
}

function goBack(pID){
//	for (xx=0;xx<document.forms.length;xx++){
	for (xx=document.forms.length-1;xx>-1;xx--){
		if (document.forms[xx].id == 'postForm'){
			theForm = document.forms[xx];
			break;
		}
	}
	if (pID == undefined) { pID = theForm.LASTPAGE.value; }
	theForm.PAGEID.value = pID;
	if (pID < 100){ theForm.action = theForm.action + '?p=' + pID; }
	theForm.submit();
}

//移至結果頁 
function sheetOf(obj,No,pageID,caseBox,actions){
	theform = findForm(obj);
	theform.reset();
	if(pageID!= undefined){
		if(theform.pageID != undefined){
			theform.pageID.value=pageID;
			
		}
		if(theform.pageId != undefined){
			theform.pageId.value=pageID;
			
		}
	}
	if(pageID!= caseBox){
		if(theform.caseBox != undefined){
			theform.caseBox.value=caseBox;
		}
	}
	if(pageID!= actions){
		if(theform.actions != undefined){
			theform.actions.value=actions;
		}
	}
	//alert(theform.pageID.value);
	theform.sheetNo.value = No;
	//setTimeout("theform.submit()", 500);
	theform.submit();
}

//用Google搜尋
function googleSearch(key,type){x
	if (type == undefined || type == ''){
		window.open('http://www.google.com/search?q='+key,'','');
	} else if (type == 'maps'){
		window.open('http://maps.google.com/maps?q='+key,'','');
	}
}

//顯示隱藏元件
function show(id){
	if (document.getElementById(id) != undefined){
		obj = document.getElementById(id);
	} else {
		obj = id;
	}
	obj.style.display = '';
}
function showObj(id){
	if (document.getElementById(id) != undefined){
		obj = document.getElementById(id);
	} else {
		obj = id;
	}
	obj.style.display = '';
}

//隱藏顯示元件
function hidden(id){
	if (document.getElementById(id) != undefined){
		obj = document.getElementById(id);
	} else {
		obj = id;
	}
	obj.style.display = 'none';
}
function hiddenObj(id){
	if (document.getElementById(id) != undefined){
		obj = document.getElementById(id);
	} else {
		obj = id;
	}
	obj.style.display = 'none';
}

//重新讀取圖片
function reloadImg(id){
	if (document.getElementById(id) != undefined){
		obj = document.getElementById(id);
	} else {
		obj = id;
	}
	obj.setAttribute('src', obj.getAttribute('src'));
}

//清除表單填入資料
function clearAll(theform){
	for( xx=0 ; xx<theform.elements.length; xx++ ) {
		var theobj = theform.elements[xx];
		if(theobj.type.toLowerCase() == 'text') theobj.value = '';
		if(theobj.type.toLowerCase() == 'password') theobj.value = '';
		if(theobj.type.toLowerCase() == 'textarea') theobj.value = '';
		if(theobj.type.toLowerCase() == 'checkbox') theobj.checked = false;
		if(theobj.type.toLowerCase() == 'radio') theobj.checked = false;
		if(theobj.type.toLowerCase() == 'select-one') theobj.options[0].selected = true;
	}
}

//點選後全選並複製表單輸入框之內容
function focusSelectAll(obj,alt,copyOK,copyFail){
	if (copyOK == undefined || copyOK == ''){
		copyOK = '內文已複製於剪貼簿內。';
	}
	if (copyFail == undefined || copyFail == ''){
		copyFail = '瀏覽器不支援複製功能！\n請直接按下"Ctrl+C"以複製整段文字\n或在瀏覽器網址欄輸入"about:config"並按Enter\n然後將"signed.applets.codebase_principal_support"設置為"true"。';
	}
	txt = obj.value;
	obj.select();
	if(window.clipboardData) {
		window.clipboardData.clearData();
		window.clipboardData.setData("Text", txt);
	} else if(navigator.userAgent.indexOf("Opera") != -1) {
		//alert(txt);
	} else if (window.netscape) {
		try {
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
		} catch (e) {
			//if (alt){ alert(copyFail); }
			obj.focus();
		}
		var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
		if (!clip){ return; }
		var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
		if (!trans){ return; }
		trans.addDataFlavor('text/unicode');
		var str = new Object();
		var len = new Object();
		var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
		var copytext = txt;
		str.data = copytext;
		trans.setTransferData("text/unicode",str,copytext.length*2);
		var clipid = Components.interfaces.nsIClipboard;
		if (!clip){ return false; }
		clip.setData(trans,null,clipid.kGlobalClipboard);
		if (alt){ alert(copyOK); };
	}
}



//取得網頁中同TAG的同名元素，傳回值=Array
function getElementsByObjName(obj) {
	var objTags = document.getElementsByTagName(obj.tagName);
	var objName = obj.getAttribute('name');
	returns = new Array();
	for (xx=0; xx<objTags.length; xx++){
		if (objTags[xx].getAttribute('name') == objName){
			returns[returns.length] = objTags[xx];
		}
	}
	return returns;
}




//取得表單中同名元素，傳回值=Array
function getFormElementsByObjName(obj) {
	var objForm = obj.form;
	var objName = obj.name;
	returns = new Array();
	for (xx=0; xx<objForm.elements.length; xx++){
		if (objForm.elements[xx].getAttribute('name') == objName){
			returns[returns.length] = objForm.elements[xx];
		}
	}
	return returns;
}

//取得Form中所有Name屬性為指定值之元素，傳回Array
function getFormElementsByName(theform,name){
	returns = new Array();
	for (xx=0; xx<theform.elements.length; xx++){
		if (theform.elements[xx].getAttribute('name') == name){
			returns[returns.length] = theform.elements[xx];
		}
	}
	return returns;
}

//找出元件所在位置所使用之Form
function findForm(obj){
	theform = obj;
	while (theform.tagName.toUpperCase() != 'FORM'){
		theform = theform.parentNode;
	}
	return theform;
}


//取得Form中Radio的值
function getCheckedValue(radioObj) {
	if (!radioObj){ return ''; }
	var radioLength = radioObj.length;
	if (radioLength == undefined){
		if (radioObj.checked){
			return radioObj.value;
		} else {
			return '';
		}
	}
	for (var xx=0;xx<radioLength;xx++){
		if (radioObj[xx].checked){
			return radioObj[xx].value;
		}
	}
	return '';
}


//確認Radio/Checkbox是否有勾選
function chkChecked(obj){
	var checkType = false;
	if (obj){
		if (obj.length == undefined){
			checkType = obj.checked;
		} else {
			for (xx=0;xx<obj.length;xx++){
				if (obj[xx].checked){
					checkType = true;
					break;
				}
			}
		}
	}
	return checkType;
}


//確認同名之CheckBox只勾選一個
function chkOne(obj,cancel) {
	chkTF = obj.checked;
	theForm = obj.form;
	for (xx=0;xx<theForm.elements.length;xx++) {
		if (theForm.elements[xx].name == obj.name){
			theForm.elements[xx].checked = false;
		}
	}
	if (cancel != undefined && cancel.toUpperCase() == 'Y'){
		obj.checked = chkTF;//可取消勾選
	} else {
		obj.checked = true;
	}
	//return true;
}


//限制輸入數字
// onKeyPress="return chkIsNum(event)"
function chkIsNum(e) {
	var keynum;
	var keychar;
	var numcheck;
	
	if(window.event) {
	// IE
		keynum = e.keyCode;
	} else if(e.which) {
	// Netscape/Firefox/Opera
		keynum = e.which;
	}
		keychar = String.fromCharCode(keynum);
		numcheck =  /\d|\r|[\b]/;
	return numcheck.test(keychar);
}

// 限制輸入數字+斜線 By Young   (for  年/月  輸入欄位)
// onKeyPress="return chkIsDate(event)"
function chkIsDate(e) {     
	var keynum;
	var keychar;
	var numcheck;
	var obj;
	
	if(window.event) {
	// IE
		keynum = e.keyCode;
		obj = e.srcElement;
	} else if(e.which) {
	// Netscape/Firefox/Opera
		keynum = e.which;
		obj = e.target;
	}
	keychar = String.fromCharCode(keynum);
	if(obj.value.indexOf('/') != -1){
		numcheck =  /\d|\r|[\b]/;
	}else{
		numcheck =  /\d|\r|[\b]|\x2F/;
	}
	return numcheck.test(keychar);
}

// 限制<input>輸入數字(小數) by Young
// onKeyPress="return chkIsFloat(event)"
function chkIsFloat(e){
	var keynum;
	var keychar;
	var numcheck;
	var obj;
	
	if(window.event) {
	// IE
		keynum = e.keyCode;
		obj = e.srcElement;
	} else if(e.which) {
	// Netscape/Firefox/Opera
		keynum = e.which;
		obj = e.target;
	}
	
	keychar = String.fromCharCode(keynum);
	if(obj.value.indexOf('.') != -1){
		numcheck =  /\d|\r|[\b]/;
	}else{
		numcheck =  /\d|\r|[\b]|[.]/;
	}
	return numcheck.test(keychar);
}

//限制輸入數字 (傳入欲做判斷的欄位)
function Number_Check(obj){     
	var data = obj.value;  
	var valid = "0123456789.";
	var checktemp;
	var YN = 0;
	// 輸入值的長度，一個個判斷是否在 valid 裡找的到，找不到即表示輸入的值不為數字或「.」
	for (var i=0; i<data.length; i++) {
		checktemp = "" + data.substring(i, i+1);
		if (valid.indexOf(checktemp) == "-1"){ 
			//alert("數字格式輸入錯誤!!");
			obj.focus();
			return false; 
		}else{
			YN = YN+1;                      // 一個個判斷，若輸入的值為數字即累加1
		}		
	}
	if (YN == data.length) return true;            //累加到最後的值  會=   輸入值的長度，即表示該字串皆為數字
}

function chkIsWord(e) {     //限制輸入英文,數字及底線   // onKeyPress="return chkIsWord(event)"
	var keynum;
	var keychar;
	var numcheck;
	
	if(window.event) {
	// IE
		keynum = e.keyCode;
	} else if(e.which) {
	// Netscape/Firefox/Opera
		keynum = e.which;
	}
		keychar = String.fromCharCode(keynum);
		/*numcheck =  /[_0-9A-Za-z]|\r|[\b]/;*/
		numcheck =  /\w|\-|\r|[\b]/;
	return numcheck.test(keychar);
}


function chkNumbers(obj){
	if (obj.value != undefined){ data = obj.value; }
	else { data = obj; }
	valid = /\d/;
	return valid.test(data);
}
// 在輸入欄位按下Enter時所呼叫之按鈕功能
// onKeyPress="onPressEnter(event,buttonName)"
function onPressEnter(e,id) {
	var keyin;
	var keychar;
	var keycheck;
	
	if(window.event) {
	// IE
		keyin = e.keyCode;
	} else if(e.which) {
	// Netscape/Firefox/Opera
		keyin = e.which;
	}
		keychar = String.fromCharCode(keyin);
		keycheck =  /\r/;
	if (keycheck.test(keychar)){
		document.getElementById(id).click();
	}
}

// ---- Check Email -----------------------
function chkEmailFormat(Obj,Msg){
	checkData = Obj.value;
	if(checkData.length == 0){
		return false;
	}
	data = checkData.match(/.+@.+\..+/);
	if(!data || !checkData)	{
		alert(Msg);
		Obj.focus();
	} else {
		return true;
	}
}

// 顯示剩餘字數
// onKeyDown="textCounter(this,this.form.remLen,500);"
// onKeyUp="textCounter(this,this.form.remLen,500);"
function textCounter(field,countField,maxlimit,alertString) {
	//定義函數，傳入３個參數，分別為TextArea元素名，文字欄元素名，字數限制
	if (field.value.length > maxlimit) {
		//如果元素區字數大於最大字數，按最大字數截斷
		field.value = field.value.substring(0,maxlimit);
		if (alertString != undefined){ alert(alertString); }
	} else {
		//在計數區框內顯示剩餘的字數
		countField.value = maxlimit - field.value.length;
	}
}

// 輸入欄位限制字數
// onblur="chkLength(this,'1000');"
function chkLength(obj,words){
	if (obj.value.length > words){
		over = obj.value.length - words ;
		alert('字數限制為'+words+'字，請減少'+over+'字後再試');
		//setCursor(obj,words,obj.value.length);
	}
}

// 指定選取範圍
// 
function setCursor(obj,start,end){
	if (!end){ end = start; }
	if (obj.setSelectionRange){
		obj.focus();
		obj.setSelectionRange(start,end);
	} else {
		if (obj.createTextRange){
			range = obj.createTextRange();
			range.collapse(true);
			range.moveStart('character',start);
			range.moveEnd('character',end);
			range.select();
		}
	}
	cursorPosition(obj.id);
}




// 取得 URL 參數的方法
function getParameter(variableName) {  
	//Get Type = 1;
	var queryString = location.search.substring(1);  // 略過 "?"  
	var paramName = variableName + "=";  // 把 "=" 當成參數名稱的一部分  
	if (queryString.length > 0) {  
		begin = queryString.indexOf(paramName);  // 取得 paramName 在 queryString 位置  
		
		if (begin != -1) {  // 在 queryString 裡面找得到 paramName  
			begin += paramName.length;  // 設定參數值的啟始位置  
		
			// 取得參數結束位置  
			end = queryString.indexOf("&" , begin);  
			if ( end == -1 ) end = queryString.length  
		
			return unescape(queryString.substring(begin, end));  
		}  
		return "null";  
	}
//	//Get Type = 2;
//	var queryString = location.search;
//	if (queryString != null || queryString != ''){
//		queryString = queryString.replace(/^\?+/, '');
//		var qArray = queryString.split("&");
//		var len = qArray.length;
//		if (len > 0){
//			for (var i=0; i<len; i++){
//				var sArray = qArray[i].split('=', 2);
//				if (sArray[0] && sArray[1] && sArray[0] == variableName){
//					return unescape(sArray[1]);
//				}
//			}
//		}
//	}
//	return null;
}

function OrderAct(theform,varA) {  //查詢QUERY排序使用：FormObject, 欄位名稱
	if (varA == theform.orderField.value){
		if(theform.orderSort.value == 'ASC'){ theform.orderSort.value='DESC'; } else { theform.orderSort.value='ASC'; } //遞增或遞減
	} else {
		theform.orderSort.value = 'DESC'; //預設 遞減
	}
	theform.orderField.value = varA;
	theform.submit();
}







<!--
//以下為自動關聯選單功能
//----------↓↓↓↓↓↓↓↓↓↓----------
/*
需先叫用[initialSelect]功能，以賦予表單第一層選項(或預設值)
第一層選單onchange時加入[changeMenu]功能，以動態更新子選單
如需傳值至第三欄位，則於第二層選單加入onchange = [setExtCode]功能
子選單欄位名需為【主選單欄位名_Sub】
Target 為接受傳值之欄位名稱
*/

// 預設第一層選單項目。
// ObjID -> 主項單欄位名(id), SubID -> 次選單欄位名(id), DefMain -> 主項單之預設值(不需時可留空), DefSub -> 次項單之預設值(不需時可留空)

function initialSelect(Option1_ID,Option2_ID,Option3_ID,DefMain,DefSub,DefSpec){

	var ObjName=mainArray;
	var ObjValue=mainIDArray;
	var SubName=subArray;
	var SubValue=subIDArray;
	var ItemName=SpecArray;
	var ItemValue=SpecIDArray;
	
	var Opt1 = document.getElementById(Option1_ID);
	var Opt2 = document.getElementById(Option2_ID);
	var Opt3 = document.getElementById(Option3_ID);
			
	var listName = ObjName[0];
	var listID = ObjValue[0];
	
	for(i=0;i<listID.length;i++) {
		Opt1.options[i] = new Option(listName[i],listID[i]);/*Option(Text,Value)*/
		if (DefMain != undefined && listID[i] == DefMain){
			tmpMainID = i;
  			Opt1.selectedIndex = i;
		}
		Opt1.options[0].value = '';
	}
	
	if (DefMain != undefined && DefMain != ''){
		var listSubName = SubName[DefMain];
		var listSubID = SubValue[DefMain];
		for(i=0;i<listSubID.length;i++){
			Opt2.options[i] = new Option(listSubName[i],listSubID[i]);/*Option(Text,Value)*/
			if (DefSub != undefined && listSubID[i] == DefSub){
				Opt2.selectedIndex = i;
			}
		}
		if(DefSub != undefined && DefSub != ''){
			var listName = ItemName[DefSub];
			var listCode = ItemValue[DefSub];
			for(i=0;i<listCode.length;i++){
				Opt3.options[i] = new Option(listName[i],listCode[i]); /*Option(Text,Value)*/
				if (DefSpec != undefined && listCode[i] == DefSpec){
					Opt3.selectedIndex = i;
				}
			}
			Opt3.style.display = '';
		}
		Opt2.style.display = '';
	} else {
		
	}
	
}

// 選取第一層選單時，更改子選單內容。
// ObjID -> 主項單欄位名(id), SubID -> 次選單欄位名(id), DefSub -> 次項單之預設值(不需時可留空)
function onChangeOption1 (Option1_ID,Option2_ID,Option3_ID,DefOpt2,DefOpt3){
	var SubName=subArray;
	var SubValue=subIDArray;
	var ItemName=SpecArray;
	var ItemValue=SpecIDArray;
	
	var Opt1 = document.getElementById(Option1_ID);
	var Opt2 = document.getElementById(Option2_ID);
	var Opt3 = document.getElementById(Option3_ID);
	
	while (Opt2.options.length) {
		Opt2.remove(0);
	}
	Opt2.style.display = 'none';
	Opt3.style.display = 'none';
	
	var number = Opt1.options[Opt1.selectedIndex].value;
	if (!number) return;
	
	var listName = SubName[number];
	var listCode = SubValue[number];
	for(i=0;i<listCode.length;i++){
		Opt2.options[i] = new Option(listName[i],listCode[i]); /*Option(Text,Value)*/
		if (DefOpt2 != undefined && listCode[i] == DefOpt2){
  			Opt2.selectedIndex = i;
		}
	}
	if(DefOpt3 != undefined && DefOpt3 != ''){
		number = Opt2.options[Opt2.selectedIndex].value;
		if (number){
			var my_listName = ItemName[number];
			var my_listCode = ItemValue[number];
			for(i=0;i<my_listCode.length;i++){
				Opt3.options[i] = new Option(my_listName[i],my_listCode[i]); /*Option(Text,Value)*/
				if (my_listCode[i] == DefOpt3){
					Opt3.selectedIndex = i;
					Opt3.style.display = '';
				}
			}
		}
	}
	Opt2.style.display = '';
	Opt2.options[0].value = '';
}

// 選取第二層選單時，更改子選單內容。
// ObjID -> 主項單欄位名(id), SubID -> 次選單欄位名(id), DefSub -> 次項單之預設值(不需時可留空)
function onChangeOption2 (Option2_ID,Option3_ID,DefOpt3){
	var ItemName=SpecArray;
	var ItemValue=SpecIDArray;
	
	var Opt2 = document.getElementById(Option2_ID);
	var Opt3 = document.getElementById(Option3_ID);
	
	while (Opt3.options.length) {
		Opt3.remove(0);
	}
	Opt3.style.display = 'none';
	
	var number = Opt2.options[Opt2.selectedIndex].value;
	if (!number) return;
	
	var listName = ItemName[number];
	var listCode = ItemValue[number];
	for(i=0;i<listCode.length;i++){
		Opt3.options[i] = new Option(listName[i],listCode[i]); /*Option(Text,Value)*/
		if (DefOpt3 != undefined && listCode[i] == DefOpt3){
			Opt3.selectedIndex = i;
		}
	}
	Opt3.style.display = '';
}













// ---- testing function ----
function cursorPosition(id){
	var textarea = document.getElementById(id);
	textarea.focus();

	// get selection in firefox, opera, …

	if (typeof(textarea.selectionStart) == 'number'){
		alert(textarea.selectionStart);
	} else if(document.selection){
		var selection_range = document.selection.createRange().duplicate();

		if (selection_range.parentElement() == textarea){
			// Check that the selection is actually in our textarea
			// Create three ranges, one containing all the text before the selection,
			// one containing all the text in the selection (this already exists), and one containing all
			// the text after the selection.
			var before_range = document.body.createTextRange();
			before_range.moveToElementText(textarea); // Selects all the text
			before_range.setEndPoint('EndToStart', selection_range); // Moves the end where we need it
			
			var after_range = document.body.createTextRange();
			after_range.moveToElementText(textarea); // Selects all the text
			after_range.setEndPoint('StartToEnd', selection_range); // Moves the start where we need it
			
			var before_finished = false, selection_finished = false, after_finished = false;
			var before_text, untrimmed_before_text, selection_text, untrimmed_selection_text, after_text, untrimmed_after_text;
			
			// Load the text values we need to compare
			before_text = untrimmed_before_text = before_range.text;
			selection_text = untrimmed_selection_text = selection_range.text;
			after_text = untrimmed_after_text = after_range.text;
			
			// Check each range for trimmed newlines by shrinking the range by 1 character and seeing
			// if the text property has changed. If it has not changed then we know that IE has trimmed
			// a \r\n from the end.
			do {
				if (!before_finished){
					if (before_range.compareEndPoints('StartToEnd', before_range) == 0){
						before_finished = true;
					} else {
						before_range.moveEnd('character', -1)
						if (before_range.text == before_text){
							untrimmed_before_text += '\r\n';
						} else {
							before_finished = true;
						}
					}
				}
				if (!selection_finished){
					if (selection_range.compareEndPoints('StartToEnd', selection_range) == 0){
						selection_finished = true;
					} else {
						selection_range.moveEnd('character', -1)
						if (selection_range.text == selection_text){
							untrimmed_selection_text += '\r\n';
						} else {
							selection_finished = true;
						}
					}
				}
				if (!after_finished){
					if (after_range.compareEndPoints('StartToEnd', after_range) == 0){
						after_finished = true;
					} else {
						after_range.moveEnd('character', -1)
						if (after_range.text == after_text){
						untrimmed_after_text += '\r\n';
						} else {
							after_finished = true;
						}
					}
				}
			} while ((!before_finished || !selection_finished || !after_finished));

			// Untrimmed success test to make sure our results match what is actually in the textarea
			// This can be removed once you’re confident it’s working correctly
			var untrimmed_text = untrimmed_before_text + untrimmed_selection_text + untrimmed_after_text;
			var untrimmed_successful = false;
			if (textarea.value == untrimmed_text){
				untrimmed_successful = true;
			}
			// ** END Untrimmed success test
		
			var startPoint = untrimmed_before_text.length;
			alert(startPoint);
	
		}
	}
}




// add by matt @2010/11/22 回報機制共用function

function goToReportPage(actionPath,pageID,reportType,reportID){
				var submitForm = document.createElement("FORM");
				
				submitForm.action = actionPath;
				submitForm.method = "POST";
				var objPageID =  document.createElement("input");
				objPageID.type = 'hidden';
				objPageID.name = 'pageID';
				objPageID.value= pageID;
				var objPostType = document.createElement("input");
				objPostType.type = 'hidden';
				objPostType.value= reportType;
				objPostType.name = 'reportType';
				var objReportID = document.createElement("input");
				objReportID.type = 'hidden';
				objReportID.value= reportID;
				objReportID.name = 'reportID';
				submitForm.appendChild(objPageID);
				submitForm.appendChild(objPostType);
				submitForm.appendChild(objReportID);
				document.body.appendChild(submitForm);
				window.open('', 'formpopup', 'width=550,height=400,resizeable,scrollbars');
				submitForm.target = "formpopup";
    			submitForm.submit();
				submitForm.outerHTML='';
			}
