/*
	Decode Special characters in Form 
*/
function DecodeForm() {
	var formName = document.forms[0].name;
	eval(document.name);
	
	var len = document.forms[0].length;
	
	for(var i=0 ; i<len ; i++)
	{
		if(document.forms[0].elements[i].type == 'text' || document.forms[0].elements[i].type == 'textarea' || document.forms[0].elements[i].type == 'file')
		{
			document.forms[0].elements[i].value = getDecodeString(document.forms[0].elements[i].value);
		}
	}
}

/*
	Decode String 
*/
function getDecodeString(newStr){	

	newStr = newStr.split("<br>").join("\r");	
	return newStr;
}

/*
	Cancel Confirm messege 
*/
function CancelConfirm(action,URL) {
	if(action=="Cancel"){
		var result = confirm('This will cancel the operation and abandon your changes. The record will not be saved. Are you sure?'); 
		if(result){
			window.open(URL,'_parent');
		}
	}
}	
function CancelConfirm2(action,URL,Id) {
	if(action=="Cancel"){
		var result = confirm('This will cancel the operation and abandon your changes. The record will not be saved. Are you sure?'); 
		if(result){
			window.open(URL+Id,'_parent');
		}
	}
}	

/*
	Open URL in New Window
*/
function PrintPage(pagename) {
	var width = 625;
	var Xpos = (screen.availWidth-625)/2;
	var height = screen.availHeight - (screen.availHeight*0.2)/2;
	var features = 'top=25,ScreenX='+Xpos+',ScreenY=10,left='+Xpos+',directories=no,location=no,menubar=no,resizable=no,status=no,toolbar=no,scrollbars=yes,width='+width+',height='+height;	
	window.open(pagename,'_blank',features);
}

/*
	Open URL in New Window
*/
function OpenPage(pagename) {
	var width = screen.availWidth-40; 
	var height = screen.availHeight-40;
	var features = 'top=20,ScreenX=20,ScreenY=20,left=20,directories=yes,location=yes,menubar=yes,resizable=yes,status=yes,toolbar=yes,scrollbars=yes,width='+width+',height='+height;	
	window.open(pagename,'_blank',features);
}