function printpage() {
window.print();  
}

function tutup() {
window.close();  
}

function PopWindow(mypage,myname,w,h,scroll,mb){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',toolbar='+mb+',resizable'
win = window.open(mypage,myname,settings)
}

function Check_Mail(address) {
	var Pattern = new RegExp('^[a-zA-Z][0-9a-zA-Z_/-]*[a-zA-Z][0-9a-zA-Z_.]*@[a-zA-Z][0-9a-zA-Z_/-]*(\\.[a-zA-Z][0-9a-zA-Z_]*)+$');
	Status = Pattern.test(address);
	if (address!="") if (Status==false) return false;
	return true;
}

function formatcurrency(st) {
	st += "";
	var theValue = st;
	var finalString = '';

	if(theValue.length < 4) {
		finalString = theValue;
	}
	else {
		if(theValue.indexOf(".")==-1) {
			theValueEx = "";
		}
		else {
			temp = theValue.split(".");
			theValue=temp[0];
			theValueEx= "." + temp[1];
		}

		var modulus = theValue.length % 3
		var count = 0
		finalString = theValue.substring(0, modulus)

		if(modulus != 0) finalString += ','
		for(i = modulus; i < theValue.length; i++) {
			if(count == 3){ 
				finalString += ',';
				count = 0;
			}
			finalString += theValue.charAt(i);
			count++;
		}
		finalString = finalString + theValueEx;
	}
	
	return finalString;
}

