var newWin = null; 
function popUp(strURL, strType, strHeight, strWidth) { 
 var strOptions=""; 
 if (strType=="console") 
   strOptions="resizable,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="fixed") 
   strOptions="status,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="fixedscroll") 
   strOptions="status,scrollbars,height="+ 
     strHeight+",width="+strWidth; 
if (strType=="fixedpos") 
   strOptions="status,height,screenX=300,left=300,screenY=300,top=300,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="elastic") 
   strOptions="scrollbars,"+ 
     "resizable,height="+
     strHeight+",width="+strWidth; 
 if (strType=="elasticmenu") 
   strOptions="menubar,scrollbars,"+ 
     "resizable,height="+ 
     strHeight+",width="+strWidth; 
 newWin = window.open(strURL, 'newWin', strOptions); 
 newWin.focus();
 
}

function validateDisclaimer( frm ){
	var error = "";
	var field_name = document.getElementById("name");
	var field_password = document.getElementById("password");
}


function disclaimWin(theUrl, winName) 
{
window.open(theUrl,winName,'toolbar=yes,status=yes,width=420,height=265,directories=no,SCROLLbars=yes,resize=no,menubar=yes,top=10,left=10')
}

function WindowPrint(){
	window.print();
}





//alert (document.enqForm.configName.value);
function validate()
{
if (document.enqForm.txtName.value=="")
	{
		alert ("Please enter your Full Name")
		document.enqForm.txtName.focus()
		return false;
	}
if (document.enqForm.txtCompany.value=="")
	{
		alert ("Please enter your Company")
		document.enqForm.txtCompany.focus()
		return false;
	}	
if (document.enqForm.txtEmail.value=="")
	{
		alert ("Please enter your E-mail Address")
		document.enqForm.txtEmail.focus()
		return false
	}
if(document.enqForm.txtEmail.value.indexOf("@")==-1)
	{
			alert (" E-mail Address should be in the form of xyz@domainname ");
			document.enqForm.txtEmail.focus()
			return false;
	}
if(document.enqForm.txtEmail.value.indexOf(".")==-1)
	{
		alert (" E-mail Address should be in the form of xyz@domainname.com ");
		document.enqForm.txtEmail.focus()
		return false;
	}
}



function format(expr) {
	var decplaces = 2;
	var str = "" + Math.round (eval(expr) * Math.pow(10,decplaces));
	while (str.length <= decplaces) {
		str = "0" + str;
	}
	var decpoint = str.length - decplaces;
	return str.substring(0,decpoint) + "." + str.substring(decpoint,str.length);
}

// main function
function Calculate() {
	var dividend = document.DivCalc.dividend_menu.value;
	// dividend per share
	var intercalc = dividend / 100;
	// dividend in £
	document.DivCalc.div_per_share.value = format(intercalc);
	// total dividend paid
	document.DivCalc.dividend_paid.value = format(intercalc * document.DivCalc.Shares.value);
}

// validation for integer fields
function isIntegerNumber() {
	var GoodChars = "0123456789";
	var V = document.DivCalc.Shares;
	if (V.value == 0)	{
       	alert("Please enter the number of shares");
		return false;
		}
    for (var i=0; i <= V.value.length -1; i++) {
		if (GoodChars.indexOf(V.value.charAt(i)) == -1){
        	alert("Please use numbers only: 1000 not 1,000 1.000");
			return false;
        }
	}
	Calculate();
}


