function ShowPOP() 
{
	jQuery.noConflict();
	
	$Enabled = "1"; //Values other than 1 will disable the popup  ........
		
	var strURL  = jQuery(location).attr('href');
	
	if(strURL.substr(strURL.length-1) == '/')
	{	
		strURL = strURL.substr(0, strURL.length-1);
	}
	
	var iIndex  = strURL.lastIndexOf("/");
	var strFile = strURL.substr(iIndex+1);

	//Replace with original file name
	var strActionPage = "guide-to-education";
	//var strActionPage = "index.html";
	
	if(strFile == strActionPage && !ReadCookie("p_persist") && $Enabled == "1")
	{
		
		//Fade in the Popup and add close button
		jQuery('#popup_name').fadeIn();
	
		
		var popMargTop = (jQuery('#popup_name').height() + 80) / 2;
		var popMargLeft = (jQuery('#popup_name').width() + 80) / 2;
	
		//Apply Margin to Popup
		jQuery('#popup_name').css({
			'margin-top' : -popMargTop,
			'margin-left' : -popMargLeft
		});
	
		//Fade in Background
		
		jQuery('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
		jQuery('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer - .css({'filter' : 'alpha(opacity=80)'}) is used to fix the IE Bug on fading transparencies 
			
		if(document.getElementsByTagName("iframe")[0])
		document.getElementsByTagName("iframe")[0].style.display = "none";
   	
	}
}

function DoValidation()
{
	var strName         = trim(document.getElementById('txtName').value);
	var strTitle        = trim(document.getElementById('txtTitle').value);
	var strInstitution  = trim(document.getElementById('txtInstitution').value);
	var strPhone        = trim(document.getElementById('txtPhone').value);
	var strEmail        = trim(document.getElementById('txtEmail').value);
	var strCity         = trim(document.getElementById('txtCity').value);
	var strState        = trim(document.getElementById('txtState').value);
	
	if(strName == "" || strTitle == "" || strInstitution == "" || strPhone == "" || strEmail == "" || strCity == "" || strState == "")
	{
		document.getElementById("lblMessage").innerHTML = "We are sorry, but in order to gain access to this page you must enter your information correctly";
		return false;	
	}
	else
	{
		if(!ValidateEmail(strEmail))
		{
			document.getElementById("lblMessage").innerHTML = "We are sorry, but in order to gain access to this page you must enter your information correctly";
			return false;
		}
	}
	
	WriteCookie('p_persist','1','30');
	return true;	
}

function ValidateEmail(strEmail) 
	{
        var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        str = trim(strEmail);
		
		if (str.match(emailRegEx)) 
		{
			return true;
		}
        else
		{
		    return false;
        }
    }
	
	function trim(str) 
	{
		var whitespace = ' \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000';
		for (var i = 0; i < str.length; i++) 
		{
			if (whitespace.indexOf(str.charAt(i)) === -1) 
			{
				str = str.substring(i);
				break;
			}
		}
		for (i = str.length - 1; i >= 0; i--) 
		{
			if (whitespace.indexOf(str.charAt(i)) === -1) 
			{
				str = str.substring(0, i + 1);
				break;
			}
		}
		return whitespace.indexOf(str.charAt(0)) === -1 ? str : '';
	}
	
	
	
	function WriteCookie(Name,Value,ExpDays)
	{ 
		var ExpDate = new Date();  
		ExpDate.setTime(ExpDate.getTime()+ (ExpDays*24*60*60*1000));
		document.cookie = Name + '=' + Value + '; expires=' + ExpDate.toUTCString() + '; path=/';
	}
					
	function ReadCookie(Name)
	{
		if (document.cookie.length > 0)
		{
			c_start=document.cookie.indexOf(Name + "=");
			if (c_start != -1)
			{
				c_start=c_start + Name.length + 1;
				c_end=document.cookie.indexOf(";",c_start);
				if (c_end==-1) c_end = document.cookie.length;
				if(unescape(document.cookie.substring(c_start,c_end)) == "1")
				{
					return true;
				}
				else
				{
					return false;	
				}
			}
		}
	}
		
