
var timerID = null;
var timerRunning = false;
m = new Array(
"Januari",
"Februari",
"Maret",
"April",
"Mei",
"Juni",
"Juli",
"Agustus",
"September",
"Oktober",
"Nopember",
"Desember"
);

openWins = new Array();
curWin = 0;

function openWin(page) { openWins[curWin++] = window.open(page,'_blank'); }

function closeAll() {
	//alert('close');
    for(i=0; i<openWins.length; i++){ 
		if (openWins[i] && !openWins[i].closed){ 
			openWins[i].closeAll();
			openWins[i].close();
		}
	}
}


function stopclock (){
	if(timerRunning)
		clearTimeout(timerID);
	timerRunning = false;
}

function showtime () {
	var now = new Date();
	var date = now.getDate();
	var month = now.getMonth();
	var year = now.getYear();
	var hours = now.getHours();
	var minutes = now.getMinutes();
	var seconds = now.getSeconds();
	var dateValue = "" + date +" "+m[month]+" "+year+", "
	var timeValue = "" + ((hours >12) ?hours -12 :hours)
	if (timeValue == "0") timeValue = 12;
	timeValue += ((minutes < 10) ?":0" : ":") + minutes
	timeValue += ((seconds < 10) ?":0" : ":") + seconds
	timeValue += (hours >= 12) ?" P.M." : " A.M."
	document.clock.face.value = dateValue + timeValue;
	timerID = setTimeout("showtime()",1000);
	timerRunning = true;
}

function startclock() {
	stopclock();
	showtime();
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n);
	return x;
}
function MM_swapImgRestore() { //v3.0
		var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments;
	document.MM_sr=new Array;
	for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;
	if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function ltrim(str) { 
	for(var k = 0; k < str.length && isWhitespace(str.charAt(k)); k++);
	return str.substring(k, str.length);
}
function rtrim(str) {
	for(var j=str.length-1; j>=0 && isWhitespace(str.charAt(j)) ; j--) ;
	return str.substring(0,j+1);
}
function trim(str) {
	return ltrim(rtrim(str));
}
function isWhitespace(charToCheck) {
	var whitespaceChars = " \t\n\r\f";
	return (whitespaceChars.indexOf(charToCheck) != -1);
}

function cek_field_form(frm){
	valid=true;
	var i=0;
	while(i<document.forms[frm].elements.length && valid){
		if(document.forms[frm].elements[i].value==""){
			valid=false;
		}else{
			i++;
		}
	}
	if(!valid){
		j=i+1;
		alert('Masukan Anda Tidak Valid Pada Field Ke-'+j);		
		document.forms[frm].elements[i].select();
	}
	return valid;
}

function cek_field_form_array(frm,array){
	valid=true;
	var i=0;
	//alert('Masuk');
	while(i<array.length && valid){

		j = array[i];
		document.forms[frm].elements[j].style.backgroundColor = '';		
		if(trim(document.forms[frm].elements[j].value)==""){
			valid=false;
		}else{
			i++;
		}
	}
	if(!valid){
		k=j+1;
		alert('Masukan Anda Tidak Valid Pada Field '+document.forms[frm].elements[j].name);	
		document.forms[frm].elements[j].style.backgroundColor = 'yellow';		
		document.forms[frm].elements[j].select();
	}
	return valid;
}

function lengthvalid(field,lebar){
	if(field.value.length==lebar){
		event.returnValue = false;
	}
}
			
function cek_login(){
	valid=true;
	var firstselect = "dummy";
	if(frm_login.username.value==""){
		alert('Username Kosong');
		if(firstselect=="dummy"){
			firstselect="username";
		}
		valid=false;
	}
	if(frm_login.password.value==""){
		alert('Password Kosong');
		if(firstselect=="dummy"){
			firstselect="password";
		}
		valid=false;
	}
	if(firstselect!="dummy"){
		frm_login.elements[firstselect].select();
	}
	return valid;
}

function cek_cari(){
	valid=true;
	var firstselect = "dummy";
	if(frm_cari.elements[0].value==""){
		alert('Katacari Kosong');
		if(firstselect=="dummy"){
			firstselect="0";
		}
		valid=false;
	}
	if(firstselect!="dummy"){
		frm_cari.elements[firstselect].select();
	}
	return valid;
}

function cek_hapus(frm){
	valid=false;
	//alert(document.forms[0].elements[0]);
	for(var i=0;i<document.forms[frm].elements.length;i++){
		//alert(document.forms[0].elements[i]);
		if(document.forms[frm].elements[i].type=="checkbox"){
			if(document.forms[frm].elements[i].checked){
				valid=true;
				//alert('Halo');
			}
		}
	}
	if(valid){
		if(confirm('Apakah anda benar-benar ingin menghapus data tersebut ?')){
		}else{
			valid=false;
		}
	}else{
		alert('Tidak Ada Item Yang Dipilih');
	}
	return valid;
}

function cek_preview(){
	valid=true;
	var firstselect = "dummy";
	if(frm_preview.lokasi.value==""){
		alert('Lokasi Kosong');
		if(firstselect=="dummy"){
			firstselect="lokasi";
		}
		valid=false;
	}
	if(firstselect!="dummy"){
		frm_preview.elements[firstselect].select();
	}
	return valid;
}

function cek_buat_memo(){
	valid=true;
	var firstselect = "dummy";
	if(frm_buat_memo.jml_penerima.value=="" || (frm_buat_memo.jml_penerima.value!="" && frm_buat_memo.elements[5].value=="")){
		alert('Penerima Kosong');
		if(firstselect=="dummy"){
			firstselect="jml_penerima";
		}
		valid=false;
	}
	if(frm_buat_memo.subject.value==""){
		alert('Perihal Kosong');
		if(firstselect=="dummy"){
			firstselect="subject";
		}
		valid=false;
	}
	if(frm_buat_memo.message.value==""){
		alert('Isi Memo Kosong');
		if(firstselect=="dummy"){
			firstselect="message";
		}
		valid=false;
	}
	if(firstselect!="dummy"){
		frm_buat_memo.elements[firstselect].select();
	}
	return valid;
}

function cek_forward(){
	valid=true;
	var firstselect = "dummy";
	if(frm_forward.jml_penerima.value=="" || (frm_forward.jml_penerima.value!="" && frm_forward.elements[13].value=="")){
		alert('Penerima Kosong');
		if(firstselect=="dummy"){
			firstselect="jml_penerima";
		}
		valid=false;
	}
	if(firstselect!="dummy"){
		frm_forward.elements[firstselect].select();
	}
	return valid;
}

function cek_report(){
	valid=true;
	var firstselect = "dummy";
	if(frm_report.pekerjaan.value==""){
		alert('Nama Proyek');
		if(firstselect=="dummy"){
			firstselect="pekerjaan";
		}
		valid=false;
	}
	if(firstselect!="dummy"){
		frm_report.elements[firstselect].select();
	}
	return valid;
}


function change_action(frm,file,index){
	//alert(index+' '+frm.elements[index].type+' '+frm.elements[index].value);
	if(frm.elements[index].value=="yes"){
		frm.elements[index].value="no";
	}else{
		frm.elements[index].value="yes";
	}
	//alert(index+' '+frm.elements[index].type+' '+frm.elements[index].value);
	frm.action = file;
	frm.submit();
	return true;
}

function cek_passwd(){
	valid=true;
	var firstselect = "dummy";
	if(frm_ganti_passwd.old_password.value==""){
		alert('Password Lama Kosong');
		if(firstselect=="dummy"){
			firstselect="old_password";
		}
		valid=false;
	}
	if(frm_ganti_passwd.password.value==""){
		alert('Password Kosong');
		if(firstselect=="dummy"){
			firstselect="password";
		}
		valid=false;
	}
	if(frm_ganti_passwd.password.value!=frm_ganti_passwd.confirm_password.value){
		alert('Password dan Konfirmasi Tidak Sama');
		if(firstselect=="dummy"){
			firstselect="password";
		}
		valid=false;
	}
	if(firstselect!="dummy"){
		frm_ganti_passwd.elements[firstselect].select();
	}
	return valid;
}

function cek_jam_all(arr){
	if(isArray(arr)){
		var i=0;
		valid = true;
		while(i<arr.length&&valid){
			if(!cek_jam(arr[i])){
				valid=false;
			}else{
				i++;
			}
		}
		return valid;
	}else{
		alert("bukan array");
		return false;
	}
}

function cek_jam(i){
	valid=true;
	var firstselect = "dummy";
	var jumlah_jam,stbh,sdth,udth;
	stbh = i+1;
	sdth = i+2;
	udth = i+3;
	jumlah_jam = parseFloat(frm_operasional_harian.elements[i].value) + parseFloat(frm_operasional_harian.elements[stbh].value) + parseFloat(frm_operasional_harian.elements[sdth].value) + parseFloat(frm_operasional_harian.elements[udth].value);
	if(jumlah_jam!=24){
		alert('Jumlah Jam Tidak Valid');
		if(firstselect=="dummy"){
			firstselect=i;
		}
		valid=false;
	}
	if(firstselect!="dummy"){
		frm_operasional_harian.elements[firstselect].select();
	}
	return valid;
}

function cek_pasang_komponen(){
	valid=false;
	var radioGrp = frm_pasang_komponen.id_unit;
	//alert(isArray(radioGrp));
	if(isArray(radioGrp)){
		var i=0;
		while(i<radioGrp.length && !valid){
			if(radioGrp[i].status){
				valid=true;
			}
			i++;
		}
	}else{
		if(radioGrp.status){
			valid=true;
		}
	}
	if(valid){
		if(confirm('Apakah anda benar-benar ingin memasang komponen tersebut pd unit terpilih ?')){
		}else{
			valid=false;
		}
	}else{
		alert('Tidak Ada Unit Yang Dipilih');
	}
	return valid;
}

function isArray(obj){return(typeof(obj.length)=="undefined")?false:true;}

var marked_row = new Array;

function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it
    if (currentColor.indexOf("rgb") >= 0)
    {
        var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1,
                                     currentColor.indexOf(')'));
        var rgbValues = rgbStr.split(",");
        currentColor = "#";
        var hexChars = "0123456789ABCDEF";
        for (var i = 0; i < 3; i++)
        {
            var v = rgbValues[i].valueOf();
            currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16);
        }
    }

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
            // Garvin: deactivated onclick marking of the checkbox because it's also executed
            // when an action (like edit/delete) on a single item is performed. Then the checkbox
            // would get deactived, even though we need it activated. Maybe there is a way
            // to detect if the row was clicked, and not an item therein...
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = false;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function


///////

var marked_row1 = new Array;

function setTabelDefault(theTable,theDefaultColor){
    var theCells = null;

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theTable.getElementsByTagName('td');
    }
    else if (typeof(theTable.cells) != 'undefined') {
        theCells = theTable.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;

    var domDetect    = null;
 
	 // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        domDetect    = false;
    } // end 3

	var c = null;

	if (domDetect) {
		for (c = 0; c < rowCellsCnt; c++) {
			theCells[c].setAttribute('bgcolor', theDefaultColor, 0);
		} // end for
	}
	// 5.2 ... with other browsers
	else {
		for (c = 0; c < rowCellsCnt; c++) {
			theCells[c].style.backgroundColor = theDefaultColor;
		}
	}
}

function setPointer1(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it
    if (currentColor.indexOf("rgb") >= 0)
    {
        var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1,
                                     currentColor.indexOf(')'));
        var rgbValues = rgbStr.split(",");
        currentColor = "#";
        var hexChars = "0123456789ABCDEF";
        for (var i = 0; i < 3; i++)
        {
            var v = rgbValues[i].valueOf();
            currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16);
        }
    }

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row1[theRowNum] = true;
            // Garvin: deactivated onclick marking of the checkbox because it's also executed
            // when an action (like edit/delete) on a single item is performed. Then the checkbox
            // would get deactived, even though we need it activated. Maybe there is a way
            // to detect if the row was clicked, and not an item therein...
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row1[theRowNum]) == 'undefined' || !marked_row1[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            setTabelDefault('document','#FFFFFF');
			newColor              = theMarkColor;
			marked_row1[theRowNum] = true;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.3 Current color is the marker one
    //else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
    //    if (theAction == 'click') {
    //        newColor              = (thePointerColor != '')
    //                              ? thePointerColor
    //                             : theDefaultColor;
    //        marked_row1[theRowNum] = (typeof(marked_row1[theRowNum]) == 'undefined' || !marked_row1[theRowNum])
    //                              ? true
    //                              : null;
    //        // document.getElementById('id_rows_to_delete' + theRowNum).checked = false;
    //    }
    //} // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
				theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
				theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function


//function isArray(){
//	if (typeof arguments[0] == 'object'){  
//		var criterion = arguments[0].constructor.toString().match(/array/i); 
//		return (criterion != null);
//	}
//	return false;
//}

function setCheckboxes(the_form, do_check)
{
    var elts      = document.forms[the_form].elements['hapus[]'];
    var elts_cnt  = elts.length;

	if(elts_cnt>0){
		for (var i = 0; i < elts_cnt; i++) {
			elts[i].checked = do_check;
		} // end for
	}else{
		elts.checked = do_check;
	}

    return true;
}

function HandleKeyDown(obj) {
   var tabKeyCode = 9;
   if (event.keyCode == tabKeyCode && event.srcElement == obj) {
      obj.selection = document.selection.createRange();
      obj.selection.text = String.fromCharCode(tabKeyCode);
      event.returnValue = false;
   }
}

function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+'.'+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + num + ',' + cents);
}

function jumpScroll(x,y) {
	//alert('Aloha');
   	window.scroll(x,y); // horizontal and vertical scroll targets
}

__=function positioningNamespace(){
     function gP(e){var left=0;var top=0; while (e.offsetParent){ left+=e.offsetLeft-e.scrollLeft;top+=e.offsetTop-e.scrollTop;e=e.offsetParent;}left+=e.offsetLeft-e.scrollLeft;top+=e.offsetTop-e.scrollTop;return {x:left, y:top};}

     window.getPos = gP;
}();

var rowBefore = null;

function changeRowColor(idRow,newColor){
	if(rowBefore!=idRow && rowBefore!=null){
		changeRowColor(rowBefore,'white');
	}
	rowBefore = idRow;
	var theRow = document.getElementById(idRow);
    var theCells = null;

	// 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
	var rowCellsCnt  = theCells.length;
	
	//alert(theRow);

	for (c = 0; c < rowCellsCnt; c++) {
		theCells[c].style.backgroundColor = newColor;
	}

}

function cek_more(x,y,a,b){
	if(x>=y){
		return true;
	}else{
		alert(b+' lebih besar dari '+a);
		return false;
	}
}

function changeSizeTable(){
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	var obj = document.getElementById('table_container');
	obj.style.height = 0.76*y;

}

function changeSizeTableDetil(){
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	var obj = document.getElementById('table_container');
	obj.style.height = 0.75*y;

}

function changeSizeTableDetil1(){
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	var obj = document.getElementById('table_container');
	obj.style.height = 0.43*y;

}

function changeSizeTableSearch(){
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	var obj = document.getElementById('table_container');
	obj.style.height = 0.6*y;

}

function flexibleOpenWindow(openWins,file,index){
	var width;
	width = screen.width - 330;
	openWins[index]=window.open(file,'subWin','scrollbars height=650 width='+width+' top=30 left=320');
}