
// Used to test resolution and create a application popup if less then 1024x768
function verifyRequirements()
{
	var appWidth = 1024;
	var appHeight = 768;
	if (screen.width <= appWidth && screen.height <= appHeight)
		handleSwfPopup(location.href, "applicationPopup", appWidth, appHeight);
}

// Called when the flash application is loaded.
function applicationReady(isReady)
{
	if (isReady == "true")
	{
		show("aux");
		show("utilitywrapper");
	}
}

// Show | Hide HTML elements by id attribute.
function show(id)
{
	//alert("Javascript : show()\ndivId="+id);
	document.getElementById(id).style.visibility = "visible";
}
function hide(id)
{
	//alert("Javascript : hide()\ndivId="+id);
	document.getElementById(id).style.visibility = "hidden";
}

// Handle's calls from the flash wrapper.
function handleFlashContact(direction, pageName)
{
	if (direction == "up")
	{
		initOpenAux();
	}
	else if (direction == "dn")
	{
		//alert("handleFlashContact\npageName: " + pageName);
		initOpenUtility(pageName);
	}
}

// Common popup window handler.
function handleSwfPopup(url, windowName, w, h)
{
	//alert("handleSwfPopup\nurl: " + url);
	window.open(url, windowName, "width="+w+", height="+h);
}

// Used for DCM popup url's
function handleSwfHref(url)
{
	handleSwfPopup(url, "flashPopup", 983, 503);
}


//contact form information

function add_form_values(thename,email,phone,address,city,state,zip){
	
	
	document.getElementById('mb-name').value = thename;
	document.getElementById('mb-bukii-bukii').value = email;
	document.getElementById('mb.f-thhuk').value = phone;
	document.getElementById('mb.f-thklt').value = address;
	document.getElementById('mb.f-ijuhh').value = city;
	document.getElementById('mb.fo-ijuhu').value = state;
	document.getElementById('mb.f-ijukl').value = zip;
	
	document.thefrm.submit();
	
	
}
var t;
function check_form(ty){
	t = ty;
	if (document.getElementById('txtfirst').value =="" || document.getElementById('txtlast').value =="" || document.getElementById('txtemail').value ==""){
		alert("First name, last name, and email address are required.");
		return;
	}else{
		if (echeck(document.getElementById('txtemail').value)!=false){
			//document.getElementById('cform').contentWindow.add_form_values(document.getElementById('txtfirst').value + ' ' + document.getElementById('txtlast').value,document.getElementById('txtemail').value,document.getElementById('txtphone').value,document.getElementById('txtaddress').value,document.getElementById('txtcity').value,document.getElementById('txtstate').value,document.getElementById('txtzip').value)
			
			//now submit to FL2 Db
			formObj.submit()
			
			setTimeout(finish,1000)
			
			
			//setTimeout(closetheform,1500);
			
			}
		}
	}
function finish(){
	document.getElementById('thecontactform').innerHTML="";
	if (t=='2'){
		document.getElementById('thecontactform').innerHTML="<div id=\"thankYou\" style=\"padding:0 0 0 40px;\"><h1>Thank you</h1><p>Thank you for your inquiry. Your submission was a success.</p></div>";
	}else{
		document.getElementById('thecontactform').innerHTML="<div id=\"thankYou\"><h1>Thank you</h1><p>Thank you for your inquiry. Your submission was a success.</p></div>";
	}
	pageTracker._trackPageview('contactFormSubmitted');
}
function closetheform(){
	initOpenAux();//close form
}

/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		    alert("Invalid email address. Please re-enter email addrress.")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid email address. Please re-enter email addrress.")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   alert("Invalid email address. Please re-enter email addrress.")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid email address. Please re-enter email addrress.")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid email address. Please re-enter email addrress.")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid email address. Please re-enter email addrress.")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid email address. Please re-enter email addrress.")
		    return false
		 }

 		 return true					
	}
	








