
function contact_validate() {

    if (document.getElementById("form1").name.value == "") {
        alert ("Please fill in your name");
        return false;

    }
 

    if (document.getElementById('form1').email.value == "") {
        alert ("You must fill in your email address");
        return false;

    } else {
		var tstEmailStr = new String(document.getElementById('form1').email.value);
		var strPntr1 = tstEmailStr.indexOf("@");
		var strPntr2 = tstEmailStr.indexOf(".", strPntr1);
		if (strPntr1 == -1 || strPntr2 == -1) {
			alert ("The Email entry is invalid! Cannot submit this request.");
			return false;
		}
		
		
    }   

   if (document.getElementById('form1').telephone.value == "") {
        alert ("Please fill in your telephone number");
        return false;

    } 
    return true;
}



function contact(x){

   hidePanel();
   varTop= x + 'px';
   varR1=' ';
   varR2=' ';
   var mainDiv = document.getElementById("content");
   var oldpanel = document.getElementById("newsPanel");

   if(oldpanel){
	mainDiv.removeChild(oldpanel);
   }
   var panel = document.createElement("div");
	panel.id = 'newsPanel';
   	panel.style.left='400px';
   	panel.style.top=varTop;
   	panel.style.width='400px';
   	panel.style.position='absolute';
   	panel.style.zIndex=99;
   	mainDiv.appendChild(panel);



    	var newHTML = "<div><div class=close><a onclick=hidePanel();>Close X</a></div>";
        	newHTML = newHTML + "<div class=subtitle>Contact Us</div>";
	newHTML = newHTML + "<div class=summary>So, we’ve sparked your interest but now you would like more information about how MIST<DIV id='ER'>-ER-</DIV>COMFORT can keep you cool all summer long! Great!</div>";
	newHTML = newHTML + "<div class=summary>We welcome the opportunity to provide you with further information.</div>";
	newHTML = newHTML + "<form id='form1' name='form1' method='POST' action='mail.php' onSubmit='return contact_validate();'>";
	newHTML = newHTML + "<input type='hidden' name='ref' value='General'/>";
	newHTML = newHTML + "<table class='FormLayout'> <tr><td colspan=2><P style='FONT-SIZE: 12px; COLOR: #123B8D;'><strong>For sales information, please use the following contact form:</strong></P></td> </tr>";



          newHTML = newHTML + "<tr><td>Your name</td> <td><input name='name' id='name'size=42></td></tr>";
          newHTML = newHTML + "<tr><td>Your e-mail address</td> <td><input name='email' id='email' size=42></td></tr>";
          newHTML = newHTML + "<tr><td>Your telephone number</td> <td><input name='telephone' id='telephone' size=42></td></tr>";
          newHTML = newHTML + "<tr><td>Message</td><td><textarea name='message' id='message' cols='40' rows='10' wrap='soft'></textarea></td></tr>";
          newHTML = newHTML + "<tr><td colspan=2 align=right><input type='submit' value='Send'></td></tr>";

          newHTML = newHTML + "</table></form>";
      
   panel.innerHTML=newHTML;

   panel.style.visibility='visible';
}

function fund(x){
   hidePanel();
   varTop= x + 'px';
   varR1=' ';
   varR2=' ';
   var mainDiv = document.getElementById("content");
   var oldpanel = document.getElementById("newsPanel");

   if(oldpanel){
	mainDiv.removeChild(oldpanel);
   }
   var panel = document.createElement("div");
	panel.id = 'newsPanel';
   	panel.style.left='400px';
   	panel.style.top=varTop;
   	panel.style.width='400px';
   	panel.style.position='absolute';
   	panel.style.zIndex=99;
   	mainDiv.appendChild(panel);

    	var newHTML = "<div><div class=close><a onclick=hidePanel();>Close X</a></div>";
        	newHTML = newHTML + "<div class=subtitle>Fundraising Opportunities</div>";
	newHTML = newHTML + "<div class=summary>Don't miss out on one of the COOLEST ways to raise money for your group, charity, and organization.  ";
	newHTML = newHTML + "MIST<DIV id='ER'>-ER-</DIV>COMFORT will provide you with all the sales tools needed to cash in on the COOLEST thing around.  ";
	newHTML = newHTML + "NO inventory, NO guarantees, NO deadlines!</div>";
	newHTML = newHTML + "<div class=summary>We will provide your group a customer code that gets you the credit no matter when the order is received.</div>";
	newHTML = newHTML + "<div class=summary>Fundraising with MIST<DIV id='ER'>-ER-</DIV>COMFORT…how cool is that!</div>";
   
	newHTML = newHTML + "<form id='form1' name='form1' method='POST' action='mail.php' onSubmit='return contact_validate();'>";
	newHTML = newHTML + "<input type='hidden' name='ref' value='General'/>";
	newHTML = newHTML + "<table class='FormLayout'> <tr><td colspan=2><P style='FONT-SIZE: 12px; COLOR: #123B8D;'><strong>Contact us today for a product demonstration and start letting everyone know just how COOL you really are.</strong></P></td> </tr>";
          newHTML = newHTML + "<tr><td>Your name</td> <td><input name='name' id='name' value='' size=42></td></tr>";
          newHTML = newHTML + "<tr><td>Your e-mail address</td> <td><input name='email' id='email'value='' size=42></td></tr>";
          newHTML = newHTML + "<tr><td>Your telephone number</td> <td><input name='telephone' id='telephone'value='' size=42></td></tr>";
          newHTML = newHTML + "<tr><td>Message</td><td><textarea name='message' id='message' cols='40' rows='10' wrap='soft'></textarea></td></tr>";
          newHTML = newHTML + "<tr><td colspan=2 align=right><input type='submit' value='Send'></td></tr>";

          newHTML = newHTML + "</table></form>";
      
   panel.innerHTML=newHTML;

   panel.style.visibility='visible';
}

function products(x){
   hidePanel();
   varTop= x + 'px';
   varR1=' ';
   varR2=' ';
   var mainDiv = document.getElementById("content");
   var oldpanel = document.getElementById("newsPanel");

   if(oldpanel){
	mainDiv.removeChild(oldpanel);
   }
   var panel = document.createElement("div");
	panel.id = 'newsPanel';
   	panel.style.left='95px';
   	panel.style.top=varTop;
   	panel.style.width='690px';
   	panel.style.position='absolute';
   	panel.style.zIndex=99;
   	mainDiv.appendChild(panel);

    	var newHTML = "<div>";
        	newHTML = newHTML + "<img src='images/products.jpg' width='690' height='150' border='0' alt='' id='product_pic' usemap='#product_Map'>";
        	newHTML = newHTML + "<map name='product_Map'>";
        	newHTML = newHTML + "<area shape='rect' alt='Click to learn more about the MIST-ER-Portable'  coords='33,44,161,129' href='portable.php'>";
        	newHTML = newHTML + "<area shape='rect' alt='Click to learn more about the MIST-ER-Boat kit' coords='207,44,324,129' href='boat.php' >";
        	newHTML = newHTML + "<area shape='rect' alt='Click to learn more about the MIST-ER-RV kit'  coords='366,44,489,129' href='rv.php'>";
        	newHTML = newHTML + "<area shape='rect' alt='Click to learn more about the MIST-ER-Patio kit'  coords='515,44,643,129' href='patio.php'>";
        	newHTML = newHTML + "<area shape='rect' alt='Click to close'  coords='615,4,669,21' href='#' onclick='hidePanel();'>";
        	newHTML = newHTML + "</map></div>";
      
   panel.innerHTML=newHTML;
   
   panel.style.visibility='visible';
}

function hidePanel(){
   var mainDiv = document.getElementById("content");
   var panel = document.getElementById('newsPanel');
   if(panel) {
	 mainDiv.removeChild(panel);
   }
}

function PopUpView(filePath){
	var sScreenX = screen.width
	var sScreenY = screen.height
	var x = sScreenX - 500
	var y = sScreenY - 350
	var winLeft = (x/2)
	var winTop =  (y/2)
	window.open(filePath,"Window","width=500,height=350,status=no,toolbar=no,directories=no,menubar=no,location=no,scrollbars=yes,left=" + winLeft + ",top=" + winTop)
}