﻿<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
//alert("Hi");
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function setWidth(id, width) {
	obj = MM_findObj(id);
	if(document.getElementById || document.all){//all the modern browsers
		obj.style.width = width;
	}
	else if(document.layers){//this is NS4
		obj.width = width;
	}  
}

function getWidth(id) {
	obj = MM_findObj(id);
	
	var divWidth;	
    if(obj.offsetWidth) { 
        divWidth = obj.offsetWidth; 
    } else if(obj.style.pixelWidth) { 
        divWidth = obj.style.pixelWidth; 
    } 
    return divWidth;
}

function setHeight(id, height) {
	obj = MM_findObj(id);
	if(document.getElementById || document.all){//all the modern browsers
		obj.style.height = height;
	}
	else if(document.layers){//this is NS4
		obj.height = height;
	}  
}

function getHeight(id) {
	obj = MM_findObj(id);
	
	var divHeight;
    if(obj.offsetHeight) { 
        divHeight = obj.offsetHeight; 
    } else if(obj.style.pixelHeight) { 
        divHeight = obj.style.pixelHeight; 
    } 
    return divHeight;
}

function setVis(id, vis, displayNone) {
    if (id != '') {
        if (displayNone == undefined || (displayNone != true && displayNone != false)) {
            displayNone = true;
        }
	    obj = MM_findObj(id);
	    if (obj == undefined) {
	        return;
	    }
	    if(document.getElementById || document.all){//all the modern browsers
		    obj.style.visibility = vis ? "visible" : "hidden";
		    if (displayNone) {
		        obj.style.display = vis ? "block" : "none";
		    }
	    }
	    else if(document.layers){//this is NS4
		    obj.visibility = vis ? "show" : "hide";
		    if (displayNone) {
    		    obj.display = vis ? "block" : "hide";
            }
	    }  
	}
}

function getVis(id) {
	obj = MM_findObj(id);
	
	var vis = true;
	
	if(document.getElementById || document.all){//all the modern browsers
		if (obj.style.visibility == "hidden") {
		    vis = false;
		}
	}
	else if(document.layers){//this is NS4
		if (obj.visibility == "hide") {
		    vis = false;
		}
	}  
	return vis;
}

function toggleVis(id) {
	setVis(id, !getVis(id));
}

function GetQueryVariable(variable)
{
    var query = window.location.search.substring(1);
    var vars = query.split('&');
    for (var i=0;i<vars.length;i++) 
    {
        var pair = vars[i].split('=');
        if (pair[0] == variable) 
        {
            return pair[1];
        }
    }
    return "";
}

function validateContact(){
    var msg = "";

    if ($('#txtFirstName').val() == ''){msg += "-- First Name\n";}
    if ($('#txtLastName').val() == ''){msg += "-- Last Name\n";}
    if ($('#txtAddress').val() == ''){msg += "-- Address\n";}
    if ($('#txtCity').val() == ''){msg += "-- City\n";}
    if ($('#txtState').val() == ''){msg += "-- State\n";}
    if ($('#txtZip').val() == ''){msg += "-- Zip Code\n";}
    if ($('#txtPhone').val() == ''){msg += "-- Phone\n";}
    if ($('#txtEmail').val() == ''){msg += "-- Email Address\n";}
    var contact;
    if (!$('#radioPhone').is(":checked") && !$('#radioEmail').is(":checked"))
    {
        msg += "-- Contact Preference\n";
    }
    else
    {
        if ($('#radioPhone').is(":checked"))
            contact = $('#radioPhone').val();
        else
            contact = $('#radioEmail').val();            
    }
    
    //if ($('#txtContact').value == ''){msg += "-- Contact Preference\n";}
    
    if (msg != ""){
        alert("The following required field(s) are missing:\n\n" + msg + "\nPlease complete the form and resubmit.");        
    }
    else
    {
    
//        string FirstName, string LastName, string Company, string JobTitle, string Address
//                                ,string Apt, string City, string State, string Zip, string Phone, string EmailAddress
//                                ,string ContactPreference, string Product, string Solution, string Comment        
        VDN.VDNAjax.FormSave($('#txtFirstName').val()
                            ,$('#txtLastName').val()
                            ,$('#txtCompany').val()
                            ,$('#txtJobTitle').val()
                            ,$('#txtAddress').val()
                            ,$('#txtApt').val()
                            ,$('#txtCity').val()
                            ,$('#txtState').val()
                            ,$('#txtZip').val()
                            ,$('#txtPhone').val()
                            ,$('#txtEmail').val()
                            ,contact
                            ,$('#ddlProdCategories').val()
                            ,$('#ddlSolutions').val()
                            ,$('#txtComments').val(), Process_SubmitForm);
    }
}
function Process_SubmitForm(res){
    if (res.error){
        alert("An error occurred.  " + res.error.Message)
    }
    else
    {
        document.location.href="Confirmation.aspx";
    }
}

//-->
