	
	// PopUp WIndow
	
	function soopaPop(URL, width, height, resize, scroll) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=' + scroll + ',location=0,statusbar=0,menubar=0,resizable=' + resize +',width=' + width + ',height=' + height + ',innerWidth=' + width + ',innerHeight=' + height + ',screenX=150,screenY=150,left=150,right=150');");
	}

	
	var centeredWindow = null

	function centeredPop(url, width, height){

		if(!centeredWindow || centeredWindow.closed){
			centeredWindow = window.open(url, "centeredWindow", "location=no,menubar=no,resizable=yes,scrollbars=yes," + centerWindow(width,height));
		}
		
		centeredWindow.focus();

	}
	
	
	var newsletterSignUp = null

	function newsletterSignUpPop(url, width, height){

		if(!newsletterSignUp || newsletterSignUp.closed){
			newsletterSignUp = window.open(url, "newsletterSignUp", "location=no,menubar=no,resizable=yes,scrollbars=auto," + centerWindow(width,height));
		}
		
		newsletterSignUp.focus();

	}
	
	
	var sendMail = null

	function sendMailPop(url, width, height){

		if(!sendMail || sendMail.closed){
			sendMail = window.open(url, "sendMail", "location=no,menubar=no,resizable=yes,scrollbars=auto," + centerWindow(width,height));
		}
		
		sendMail.focus();

	}
	
	
	var printWindow = null

	function openPrintWindow(url){

		if(!printWindow || printWindow.closed){
			printWindow = window.open(url, "printWindow", "location=no,menubar=no,resizable=yes,scrollbars=yes");
		}
		
		printWindow.focus();

	}
	
	
	function centerWindow(width,height) {
		var str = "height=" + height + ",innerHeight=" + (height+30);
		str += ",width=" + width + ",innerWidth=" + width;
		if (window.screen) {
			var ah = screen.availHeight - 30;
			var aw = screen.availWidth - 10;
	
			var xc = (aw - width) / 2;
			var yc = (ah - height) / 2;
	
	    	str += ",left=" + xc + ",screenX=" + xc;
	    	str += ",top=" + yc + ",screenY=" + yc;
	  	}
	  	return str;
	}
	
	
	
	function forwardURL(CategoryID,mfs,mfl,des,del,section){

		location.href = "memberServices_informationExchange.asp?CategoryID=" + CategoryID + "&mfs=" + mfs + "&mfl=" + mfl + "&des=" + des + "&del=" + del;
	
	}
	
	
	function copyMailingAddress(form){

		if(form.elements['MailingAddress1']) form.elements['StreetAddress1'].value = form.elements['MailingAddress1'].value;
		if(form.elements['MailingAddress2']) form.elements['StreetAddress2'].value = form.elements['MailingAddress2'].value;
		if(form.elements['MailingCity']) form.elements['StreetCity'].value = form.elements['MailingCity'].value;
		if(form.elements['MailingState']) form.elements['StreetState'].value = form.elements['MailingState'].value;
		if(form.elements['MailingZipCode']) form.elements['StreetZipCode'].value = form.elements['MailingZipCode'].value;
	
	}
	


	function eagleCalculateStartingPledge(form){

		if(form.elements['PledgeAmount'] && form.elements['PaymentSchedule']){

			if(form.elements['PledgeAmount'].value != "" && form.elements['PaymentSchedule'].options[form.elements['PaymentSchedule'].selectedIndex].value != ""){

				switch(form.elements['PaymentSchedule'].options[form.elements['PaymentSchedule'].selectedIndex].value){
			
					case "Annual":
						return formatTwoDecimals(form.elements['PledgeAmount'].value);
						break;
					case "Semi-Annual":
						return formatTwoDecimals(form.elements['PledgeAmount'].value / 2);
						break;
					case "Quarterly":
						return formatTwoDecimals(form.elements['PledgeAmount'].value / 4);
						break;
					case "Monthly":
						return formatTwoDecimals(form.elements['PledgeAmount'].value / 12);
						break;
			
				}
				
			}
					
		}
		
	}
	
	
	
	function stripLeadingZeros(num){

		var newTerm;
	
		while (num.charAt(0) == "0") {
			newTerm = num.substring(1, num.length);
			num = newTerm;
		}
		
		if (num == "")
			num = "0";

		return num;
	}



	function formatTwoDecimals(X) {
	
		var number = Math.round(100*X) +'';
		var prefix;
	
		if(number.length < 2){
			prefix = '00';
			number = prefix.concat(number);	
		}else if(number.length < 3){
			prefix = '0';
			number = prefix.concat(number);
		}
		 
		with(number){
			if( substring(0,length-2)+'.'+substring(length-2,length) == "0.00"){
				return "";
			}else{
				return substring(0,length-2)+'.'+substring(length-2,length);
			}
		}
	}
	
	
	
	function totalPayDuesForm(form){

		var total = 0;
		var x;
		var keepGoing;		
		
		
		x = 1;
		keepGoing = true;

		while(keepGoing){

			if(form.elements['EagleInvoice[' + x + '][PaymentAmount]']){

				if(form.elements['EagleInvoice[' + x + '][PaymentAmount]'].value != "") total += parseFloat(form.elements['EagleInvoice[' + x + '][PaymentAmount]'].value);
			
				x++;

			}else{
			
				keepGoing = false;

			}
			
		}
		

		x = 1;
		keepGoing = true;
		
		while(keepGoing){
		
			if(form.elements['MembershipDues[' + x + '][PaymentAmount]']){
		
				if(form.elements['MembershipDues[' + x + '][PaymentAmount]'].value != "") total += parseFloat(form.elements['MembershipDues[' + x + '][PaymentAmount]'].value);
		
				x++;
		
			}else{
		
				keepGoing = false;
		
			}
		
		}
		
		
		x = 1;
		keepGoing = true;
	
		while(keepGoing){
		
			if(form.elements['FlagDues[' + x + '][PaymentAmount]']){
		
				if(form.elements['FlagDues[' + x + '][PaymentAmount]'].value != "") total += parseFloat(form.elements['FlagDues[' + x + '][PaymentAmount]'].value);
		
				x++;
		
			}else{
			
				keepGoing = false;
			
			}
			
		}
	
	
		x = 1;
		keepGoing = true;
		
		while(keepGoing){
		
			if(form.elements['TlelDues[' + x + '][PaymentAmount]']){
		
				if(form.elements['TlelDues[' + x + '][PaymentAmount]'].value != "") total += parseFloat(form.elements['TlelDues[' + x + '][PaymentAmount]'].value);
		
				x++;
		
			}else{
		
				keepGoing = false;
		
			}
		
		}

		
		x = 1;
		keepGoing = true;
		
		while(keepGoing){
		
			if(form.elements['NursingDues[' + x + '][PaymentAmount]']){
		
				if(form.elements['NursingDues[' + x + '][PaymentAmount]'].value != "") total += parseFloat(form.elements['NursingDues[' + x + '][PaymentAmount]'].value);
		
				x++;
		
			}else{
		
				keepGoing = false;
		
			}
		
		}
		
		
		x = 1;
		keepGoing = true;
		
		while(keepGoing){
		
			if(form.elements['JournalDues[' + x + '][PaymentAmount]']){
		
				if(form.elements['JournalDues[' + x + '][PaymentAmount]'].value != "") total += parseFloat(form.elements['JournalDues[' + x + '][PaymentAmount]'].value);
		
				x++;
		
			}else{
		
				keepGoing = false;
		
			}
		
		}
		
		
		return formatTwoDecimals(total);
		
	}
	
	



	function calculateEditProfileDues(form){

		var total;
		var purchaseEmailChecked;
		var purchaseUrlChecked;
		var purchaseSpecialtiesChecked;

		
		if(form.elements['PurchaseEmail']){
			purchaseEmailChecked = form.elements['PurchaseEmail'].checked;
		}else if(form.elements['RenewEmail']){
			purchaseEmailChecked = form.elements['RenewEmail'].checked;
		}else{
			purchaseEmailChecked = false;
		}
		
		if(form.elements['PurchaseUrl']){
			purchaseUrlChecked = form.elements['PurchaseUrl'].checked;
		}else if(form.elements['RenewUrl']){
			purchaseUrlChecked = form.elements['RenewUrl'].checked;			
		}else{
			purchaseUrlChecked = false;
		}
		
		if(form.elements['PurchaseSpecialties']){
			purchaseSpecialtiesChecked = form.elements['PurchaseSpecialties'].checked;
		}else if(form.elements['RenewSpecialties']){
			purchaseSpecialtiesChecked = form.elements['RenewSpecialties'].checked;			
		}else{
			purchaseSpecialtiesChecked = false;
		}

		
		if(purchaseEmailChecked && purchaseUrlChecked && purchaseSpecialtiesChecked){

			total = pricing['All3'];
		
		}else if((purchaseEmailChecked && purchaseUrlChecked) || (purchaseEmailChecked && purchaseSpecialtiesChecked) || (purchaseUrlChecked && purchaseSpecialtiesChecked)){

			total = pricing['Any2'];
		
		}else if(purchaseEmailChecked){

			total = pricing['Email'];
		
		}else if(purchaseUrlChecked){

			total = pricing['Url'];
		
		}else if(purchaseSpecialtiesChecked){

			total = pricing['Specialties'];
		
		}else{

			total = "";
		
		}
		
		return total;

	}
	
	
	
	// Mail To A Friend

	function mailpage()
	{
	mail_str = "mailto:?subject=Check out the " + document.title;
	mail_str += "&body=I thought you might be interested in the " + document.title;
	mail_str += ". You can view it at, " + location.href; 
	location.href = mail_str;
	}
	

	function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=460,height=400,left = 290,top = 262');");
	}


