	function general_check_required(formHandle, transfer_type, section_type)

	{	//text fields only



		var stringHandler = formHandle[transfer_type].value

		var sh2 = stringHandler.substring(0,2)



		if( stringHandler == "")



		{		alert( "Please fill in the required " + section_type + " field.");		



				formHandle[transfer_type].focus();



				return 0;	

		}	

		return 1;

	}	



	function email_required(formHandle, transfer_type, section_type)

	{	//text fields only



		var stringHandler = formHandle[transfer_type].value

		var sh2 = stringHandler.substring(0,2)



		if( stringHandler == "")

		{		alert( "Please Enter A Valid E-mail Address.");		

				formHandle[transfer_type].focus();

				return 0;	

		}	

		return 1;

	}

	

	function validateEmailAt(formHandle, transferType)

	{

		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(formHandle[transferType].value)){

			return (true)

		}

		alert("Invalid E-mail Address. Please Re-enter.")

		return (false)

	}

	



	function gotoSubmit()

	{

		var formHandle = document.emailform;

		

		var requiredArray = ["E-MAIL"]

		

		for(var ii=0; ii<requiredArray.length; ii++)

		{ if(!(email_required(formHandle, requiredArray[ii], "form"))){ return false; } }



		if(!(validateEmailAt(formHandle, "E-MAIL"))) {return false;}



		formHandle.submit();

	}



//******************************************

//********************************************************************************************

//***********      ROTATE IMAGES                               *******************************

var ID = "imageRotate"; //id of the span or div in the HTML

var POS = 0; //position of the item to display in the IMAGEARRAY

var firstCase = true; //is this the first image being loaded

var IMAGEARRAY = new Array('PNB-1055A_cust_mort_app.gif','PNB-1055D_hb_mort_ctr.gif','PNB-1055E_loan_decision.gif', 'PNB-1055F_mortgage_rates.gif','PNB-1055G_mortwebrect.gif','PNB-1055H_rate_watch.gif');

var IMAGEARRAYLENGTH = IMAGEARRAY.length - 1; //Length of array in terms of array positioning



//HREF LOCATIONS

var SECONDARYLOCATION = "http://parknatl.mortgagewebcenter.com/Default.asp?bhcp=1";

var PRIMARYLOCATION = "http://parknatl.mortgagewebcenter.com/Default.asp?bhcp=1";

var SECONDARYGIFNAME = "PNB-1055A_cust_mort_app.gif";

var NOLINK = "";

var ADDENDTAG = false;



function rotateImage()

{	

	//This can be removed this is only optional

	//If this is the first time the code is loaded we will randomly start the 

	//image rotation with a random image in the array. If this section is omitted

	//the images will just be displayed in the order they appear in the IMAGEARRAY

	if(firstCase)

	{

		POS = randomStart();

		firstCase = false;

	}

	//**************************************************//

	//**************************************************//

	

	document.getElementById(ID).innerHTML = generateImageString(IMAGEARRAY[POS]);

	

	if(POS == IMAGEARRAYLENGTH)

		POS = 0;

	else

		POS++;



	setTimeout("rotateImage()",4000);

}



function generateImageString(imageName)

{

	var imageString = '';

	

	//************************************

	//Special script for parkNational to apply <a> tag (can be removed)

	if(IMAGEARRAY[POS] == SECONDARYGIFNAME)

	{		

		imageString +='<a href="';

		imageString += SECONDARYLOCATION;

		imageString += '">';

		ADDENDTAG = true;		

	}	

	else if(!(IMAGEARRAY[POS] == NOLINK)) 

	{

		imageString +='<a href="';

		imageString += PRIMARYLOCATION;

		imageString += '">';

		ADDENDTAG = true;	

	}

	//************************************

	//************************************

	

	imageString +='<img src="\/shared\/img\/local-promos\/';

	imageString += imageName;

	imageString += '" border="0" width="192" height="145" alt="Park National Bank">';

	

	//************************************

	//Special script for parkNational to apply </a> tag (can be removed)

	if(ADDENDTAG)

		imageString += "<\/a>";

	//************************************

	//************************************

	

	return imageString;

}//end function generateImageString



function randomStart()

{

	if(IMAGEARRAYLENGTH == null || IMAGEARRAYLENGTH == 0)

		return 0;

	

	//generate the random number	

	var randomnumber = Math.floor(Math.random()*(IMAGEARRAYLENGTH + 1));

	

	//additional validation that the number is a valid array position

	if(randomnumber >= 0 && randomnumber <= IMAGEARRAYLENGTH)

		return randomnumber;

	else 

		return 0;

}

//********************************************************************************************

//***********     END ROTATE IMAGES                            *******************************

//********************************************************************************************

//

//

//

//******************************************

//********************************************************************************************

//***********      ROTATE MAIN PROMO                           *******************************

var ID = "mainPromo"; //id of the span or div in the HTML

var POS = 0; //position of the item to display in the IMAGEARRAY

var firstCase = true; //is this the first image being loaded

var IMAGEARRAY = new Array('mad-atm-promo.jpg');

var IMAGEARRAYLENGTH = IMAGEARRAY.length - 1; //Length of array in terms of array positioning



//HREF LOCATIONS

var TERTIARYLOCATION = "https://www.rewardsnow.com/BankRewards/index.asp";

var PRIMARYLOCATION = "http://www.prosperitybanktx.com/ContentPage.aspx?name=announcement";

var TERTIARYGIFNAME = "global-promo-template-new_rewards.jpg";


var NOLINK = "";

var ADDENDTAG = false;



function rotateMainPromo()

{	

	//This can be removed this is only optional

	//If this is the first time the code is loaded we will randomly start the 

	//image rotation with a random image in the array. If this section is omitted

	//the images will just be displayed in the order they appear in the IMAGEARRAY

	if(firstCase)

	{

		POS = randomStart();

		firstCase = false;

	}

	//**************************************************//

	//**************************************************//

	

	document.getElementById(ID).innerHTML = generateImageString(IMAGEARRAY[POS]);

	

	if(POS == IMAGEARRAYLENGTH)

		POS = 0;

	else

		POS++;



	setTimeout("rotateImage()",40000);

}



function generateImageString(imageName)

{

	var imageString = '';

	

	//************************************

	//Special script for parkNational to apply <a> tag (can be removed)

	if(IMAGEARRAY[POS] == TERTIARYGIFNAME)

	{		

		imageString +='<a href="';

		imageString += TERTIARYLOCATION;

		imageString += '">';

		ADDENDTAG = true;		

	}	

	else if(IMAGEARRAY[POS] == SECONDARYGIFNAME)

	{		

		imageString +='<a href="';

		imageString += SECONDARYLOCATION;

		imageString += '">';

		ADDENDTAG = true;		

	}	

	else if(!(IMAGEARRAY[POS] == NOLINK)) 

	{

		imageString +='<a href="';

		imageString += PRIMARYLOCATION;

		imageString += '">';

		ADDENDTAG = true;	

	}

	//************************************

	//************************************

	

	imageString +='<img src="\/shared\/img\/';

	imageString += imageName;

	imageString += '" border="0" alt="Special Bank Promotion">';

	

	//************************************

	//Special script for parkNational to apply </a> tag (can be removed)

	if(ADDENDTAG)

		imageString += "<\/a>";

	//************************************

	//************************************

	

	return imageString;

}//end function generateImageString



function randomStart()

{

	if(IMAGEARRAYLENGTH == null || IMAGEARRAYLENGTH == 0)

		return 0;

	

	//generate the random number	

	var randomnumber = Math.floor(Math.random()*(IMAGEARRAYLENGTH + 1));

	

	//additional validation that the number is a valid array position

	if(randomnumber >= 0 && randomnumber <= IMAGEARRAYLENGTH)

		return randomnumber;

	else 

		return 0;

}

//********************************************************************************************
//***********     END ROTATE MAIN PROMO                         *******************************
//********************************************************************************************

//***********     Leave Site Popup Message                     *******************************

	function leaveSite(url){

		if (url == "https://www.rewardsnow.com/BankRewards/index.asp") {		
			var BankRewards = new Array();
			BankRewards[0] = new Image();
			BankRewards[0].src = "/wt_tracking/bankrewards/bankrewards_tracking.html";
		}//end-if

		if (confirm("You are now leaving www.madisonvillestatebank.com. Please note that 3rd party sites may have different standards in privacy and security. You should review that site's privacy and security policy.")) {
		window.open(url,'','');
		}//end-if

	}//end leaveSite

//***********     End Leave Site Popup Message                 *******************************

//***********     Leave Email Popup Message                     *******************************

	function leaveEmail(address){

		if (confirm("E-mail is not private or secure, therefore, please do not include any personal data such as Social Security Numbers or Account Numbers in any E-Mail Correspondence.")) {
		window.open(url,'','');	
		}//end-if
	}//end leaveEmail

//***********     End Email Site Popup Message                 *******************************

//***********     Web Trends Tracking                          *******************************
	function adtracking(ad){
		//alert("in adtracking");
		var tracking = new Array();
		tracking[0] = new Image();

		if (ad == "per_mkt_rate") {		
			tracking[0].src = "/wt_tracking/bannerads/per_mktrate_ad.html";
		}//end-if
		else if (ad == "per_heloc") {
			tracking[0].src = "/wt_tracking/bannerads/per_heloc_ad.html";
		}//end-else if
		else if (ad == "bus_mkt_rate") {
			tracking[0].src = "/wt_tracking/bannerads/bus_mktrate_ad.html";
		}//end-else if
		else if (ad == "bus_heloc") {
			tracking[0].src = "/wt_tracking/bannerads/bus_heloc_ad.html";
		}//end-else if
		else if (ad == "per_online") {
			tracking[0].src = "/wt_tracking/onlineaccts/per_onl_click.html";
		}//end-else if
		else if (ad == "bus_online") {
			tracking[0].src = "/wt_tracking/onlineaccts/bus_onl_click.html";
		}//end-else if
		else if (ad == "credit_online") {
			tracking[0].src = "/wt_tracking/onlineaccts/credit_onl_click.html";
		}//end-else if
		else if (ad == "portfolio_online") {
			tracking[0].src = "/wt_tracking/onlineaccts/portfolio_onl_click.html";
		}//end-else if
		else if (ad == "desktop_teller") {
			tracking[0].src = "/wt_tracking/onlineaccts/desktop_tel_click.html";
		}//end-else if
		else if (ad == "home_eq_line") {
			tracking[0].src = "/wt_tracking/rightcolads/home_line_click.html";
		}//end-else if
		else if (ad == "home_eq_loan") {
			tracking[0].src = "/wt_tracking/rightcolads/home_loan_click.html";
		}//end-else if
		else if (ad == "mortgage") {
			tracking[0].src = "/wt_tracking/rightcolads/mortgage_click.html";
		}//end-else if
		else if (ad == "open_acct") {
			tracking[0].src = "/wt_tracking/rightcolads/open_acct_click.html";
		}//end-else if
		else if (ad == "credit_card") {
			tracking[0].src = "/wt_tracking/rightcolads/credit_card_click.html";
		}//end-else if

	}//end adtracking

//***********     End Web Trends Tracking                      *******************************
