	function wr(txt){
		document.write(txt);
	}

	function isSecure(){
		return window.location.protocol == 'https:';
	}

	//	NBC affiliate sponsor code
	function writeSponsorBar(){
		wr('<table width="770" border="0" cellspacing="0" cellpadding="0">');
		wr('<tr bgcolor="' + sponsorHexColor + '">');
		wr('<td align="left"><a href="http://'+sponsorURL+'" target="_top"><img src="' + img_farm_main + sponsorImage+'" border=0></a></td>');
		wr('<td align="right" valign="top"><a target="_top" href="http://wedding.weddingchannel.com/nbc/nbc.asp?affiliate='+sponsorUID+'" style="color: #fff; text-decoration:none;">Back to '+sponsorName+' Weddings</a>&nbsp;&nbsp;</td>');
		wr('</tr></table>');
	}

	//	Determine if "https" should be changed to "http", old getUrl functionality has changed
	function getUrl(url){
		if(typeof(isUnsecure) != "undefined" && isUnsecure) {
        	//	Replace https with http using RegExp
			var secureURL = new RegExp("https://", "gi");
			url = url.replace(secureURL, 'http://');
		}
		return url;
	}

	function getSearchOrigin() {
		//	get the URL
		var url = document.URL;

		// check for wedshop
        if(url.indexOf('/catalog/wed_shop/') != -1 || url.indexOf('pageid=wedding_shop') != -1 || url.indexOf('pageid=shower_shop') != -1) {
			return 2;
		}
		// check for registry
		if(url.indexOf('/registry/')           != -1 ||
		url.indexOf('/search_purchase/')       != -1 ||
		url.indexOf('/fds/')                   != -1 ||
		url.indexOf('/advice/')                != -1 ||
		url.indexOf('/charity/')               != -1 ||
		url.indexOf('/wedding-gift-registry/') != -1 ||
		(url.indexOf('/catalog/') != -1 && url.indexOf('/wed_shop') == -1)) {
			return 3;
		}

		// check for board
		var parentUrl = "";

		try{
			parentUrl = parent.document.URL; // this is for framed - only using for board
		} catch(er) {
			//	move on - try/catch is a JavaScript 1.4 and above
		}
		if(parentUrl.indexOf('boards.weddingchannel.com') != -1) {
			return 4;
		}

		// return default
		return 1;
	}

	/*
	 *	The logic for this is if the section is NOT guest and NOT in search_purchase dir, return true
	*/
	function isGuestStreamline() {
		var url = document.URL;	// get the URL of the document

		if(url.indexOf("/search_purchase/") != -1) {	// check for a string in the queryString
			return true;	//	return true means to hide the "site search"
		}

		return false;	//	if its gotten this far, is NOT in search_purshase dir
	}

	/*
	 *	The logic for this is if the section is NOT guest and NOT in search_purchase dir, return true
	*/
	function hideSiteSearch() {
		var url = document.URL;	// get the URL of the document

    	if(url.indexOf("demo=true") != -1) {	// check for a string in the queryString
			return true;	//	return true means to hide the "site search"
		}

		return false;	//	if its gotten this far, is NOT in search_purshase dir
	}

	//	If the field has been clicked, don't reset value to empty, set to true if function ever runs
	function navFNClick(theObject) {
		if(typeof(fnClickedOnce) != "undefined" && !fnClickedOnce) {
			theObject.value='';
		}
		fnClickedOnce = true;
	}

	//	If the field has been clicked, don't reset value to empty, set to true if function ever runs
	function navLNClick(theObject) {
		if(typeof(lnClickedOnce) != "undefined" && !lnClickedOnce ) {
			theObject.value='';
		}
		lnClickedOnce = true;
	}

	function getCplFirstName() {
		if(typeof(cplFirstName) == "undefined") {	//	var has been set
			cplFirstName = "First Name";
		}

		if(cplFirstName == "") {
			cplFirstName = "First Name";
		}

		return cplFirstName;
	}

	function getCplLastName() {
		if(typeof(cplLastName) == "undefined") {	//	var has been set
			cplLastName = "Last Name";
		}

		if(cplLastName == "") {
			cplLastName = "Last Name";
		}

		return cplLastName;
	}


	function onCplSearchSubmit(theForm) {
		//	Check for First Name field, if default text, set to empty
		if(theForm.rfn.value == "First Name") {
			theForm.rfn.value = "";
		}

		//	Check for Last Name field, if default text, set to empty
		if(theForm.rln.value == "Last Name") {
			theForm.rln.value = "";
		}

		//	Last name must be 2 characters or more
		var lastNameValue = new String(theForm.rln.value);
		if(lastNameValue.length < 2) {
			alert("To perform a  search, please enter at least the first two characters of the person's last name.");
			if(theForm.rfn.value.length < 1) theForm.rfn.value = "First Name";
			if(theForm.rln.value.length < 2) theForm.rln.value = "Last Name";
			return false;	//	last name field does not have enough characters.
		}

		// Return true to submit the form
		return true;
	}

	/*	This function taken from main.js - look there for comments	*/
	function getQueryStringValue(queryStringName) {
		var value = "";
		var qsName = queryStringName + "=";
		var theURL = new String(document.URL);
		var startValue = 0;
		var endValue = 0;

		var remainStr = "";

		//check to see if the queryStringName is in the url
		if (theURL.indexOf(qsName) > -1) {
			startValue = theURL.indexOf(qsName) + qsName.length;
		}

		remainStr = theURL.substring(startValue);

		if(remainStr.indexOf("&") > -1) {
			endValue = remainStr.indexOf("&");
		} else {
			endValue = remainStr.length;
		}

		if(endValue > 0) {
			return remainStr.substring(0,endValue);
		} else {
			return "";
		}
	}