
function changeperiod(id) {
	if (id==1) {
		idate=document.getElementById("dy1").value;//frm.dy1.value;
		imonth=document.getElementById("mth1").value;//frm.mth1.value;
		iyear=document.getElementById("yr1").value;//frm.yr1.value;
	} 
	if (idate!=99 & imonth!=99 & iyear!=99) {
	isdatevalid=true;
	if (imonth==0 | imonth==1 | imonth==3 | imonth==5 | imonth==7 | imonth==8 | imonth==10 | imonth==12) {
		if (idate > 31) {isdatevalid = false;}
	}
	if (imonth==4 | imonth==6 | imonth==9 | imonth==11) {
		if (idate > 30) {isdatevalid = false;}
	}
	if (imonth==2) {
		if (iyear%4 == 0) {
	    if (idate > 29) {isdatevalid = false;}
	  } else {
	    if (idate > 28) {isdatevalid = false;}
	  }
	}
	if (!isdatevalid) {
		alert ("Tanggal Salah.");
		if (id==1) {
			document.getElementById("dy1").value = 1;
			//document.getElementById("dy1").focus;
		}
	}
	}
}

var validNums = '0123456789.';
var validInt = '0123456789';
var validLetters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
var validAlphanumericNoSpace = '-+_0123456789.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\'';
var validAlphanumeric = ' -+_0123456789.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\'';
var validEMailOnly = '@_0123456789.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
var validLogin = '_0123456789.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';

function validateKeyPress(e, validSet)
{

    var key;
    var keychar;
        
    if(window.event || !e.which) // IE
        key = e.keyCode; // IE
    else if(e) 
        key = e.which;   // Netscape
    else
        return true;     // no validation

    keychar = String.fromCharCode(key);
    validSet += String.fromCharCode(8); //backspace
		validSet += String.fromCharCode(9); //tab

    if (validSet.indexOf(keychar) < 0)
      return false;

    return true; 
} 

var progress_bar = new Image();
		progress_bar.src = 'images/loader.gif';

function show_progressbar(id) {
			document.getElementById(id).innerHTML= '<img src="images/loader.gif" border="0" alt="Loading, please wait..." valign=middle />';
}

function photodetail(id) {
	//myWin.self.close();
	myWin = window.open("photodetail.php?id=" + id,"photo", "left=0,width=640,height=580,status=no,toolbar=no,menubar=no,scrollbars=no");
	myWin.self.focus();
	//myWin.document.write("<head><title>Example</title></head>");
	//myWin.document.write ("<BODY>ABC");
	//myWin.document.write ("</BODY></HTML>");
	//myWin.document.close()
}

function closeIt(){
	if (!myWin.closed) {myWin.self.close();}
}

function datadetail(id) {
	myWin2 = window.open("datadetail.php?id=" + id,"data", "left=0,width=640,height=580,status=no,toolbar=no,menubar=no,scrollbars=no");
	myWin2.self.focus();
}

function profileedit(eid) {
	myWin3 = window.open("dataedit.php?eid=" + eid, "dataedit", "left=0,width=640,height=580,status=no,toolbar=no,menubar=no,scrollbars=no");
	myWin3.self.focus();
}

function varheight(){
var myHeight;
if( typeof( window.innerWidth ) == 'number' ) { 
myHeight = window.innerHeight; 
} else if( document.documentElement && 
( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { 
myHeight = document.documentElement.clientHeight; 
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { 
myHeight = document.body.clientHeight; 
} 
myHeight=myHeight-36-36-33-31;
document.getElementById("tablecontent").style.height = myHeight;
//alert(myHeight);
}
window.onresize=function() {
	varheight();
}

function changeperiodarea() {
	//alert('d');
	document.location="rptins.php?idp=" + document.getElementById("idp").value;
}


