// this function controls the pulldown menu action

function formHandler(form){
var URL = document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
}


function opendiv(str){
	if (document.getElementById(str).style.display=="block"){
		document.getElementById(str).style.display="none"
	}else{
		document.getElementById(str).style.display="block"
	}
}
function open_pricing(str){
		var leftVal = (screen.availWidth-300)/2;
		var topVal = (screen.availHeight-300)/2;
		var thedest=window.open(str,null,"height=300,width=300,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,left=" +leftVal+",top="+topVal);
	}
//this function show/hides layers
function swap(id,displayvar){
	    
	    for (i=0;i<10;i++){
	    if (id==i){
			document.getElementById("idHidden" + id).style. display ="block"
		}
		
		else{
			document.getElementById("idHidden" + i).style. display ="none"
		}
	    }
	    
	
	}
	
// for popping up the sale items window

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=995,height=700');");
}

// for popping up the online catalog window
function popUp_Catalog(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=700,height=700');");
}

// Swap Function
function swap(id,displayvar){

		if (displayvar == true){
			document.getElementById(id).style. display ="block"
		}else{
			document.getElementById(id).style. display ="none"
		}	
	
}
function submitForm(formName){
		document.getElementById(formName).submit()
}
function toggleNav(){
		var theUL = document.getElementById('softwareUL')
		if(theUL.style.display == "none"){
				theUL.style.display = "block"
		}else{
				theUL.style.display = "none"
		}
		
}
function showlegal(){
	//var editWin
	//editWin = window.open("legal.htm","height=600,width=400");
	//editWin.focus();
	var UploadWindow =window.open("legal.htm","NewWindow",
   "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,width=400,height=600");
   UploadWindow.location = "legal.htm"; 
}
function view_more(num){
		
		
		var	Path = document.getElementById('concbod_'+num+'_a');
		var thestyle = Path.style.display;

		if(thestyle=="none"){
			document.getElementById('concbod_'+num+'_a').style.display="block";
			document.getElementById('concbod_'+num+'_b').style.display="none";
			document.getElementById('viewmore_link_'+num).innerHTML="View More";
			
		}else{
			document.getElementById('concbod_'+num+'_a').style.display="none";
			document.getElementById('concbod_'+num+'_b').style.display="block";
			document.getElementById('viewmore_link_'+num).innerHTML="Collapse";
	
		}
	
}


function price_form_submit(){

	if (document.getElementById('Name').value =="" || document.getElementById('Email').value =="" || document.getElementById('Phone').value =="" || document.getElementById('Company').value ==""){
		alert("Name, Email, Phone, and Company are required.");
		return;
	}else{
		if (echeck(document.getElementById('Email').value)!=false){
			document.getElementById('registrationform').submit();
			}
		}
	}
	
function class_form_submit(){

	if (document.getElementById('FirstName').value =="" || document.getElementById('LastName').value =="" || document.getElementById('Address').value =="" || document.getElementById('City').value =="" || document.getElementById('State').value =="" || document.getElementById('Zip').value =="" || document.getElementById('Email').value =="" || document.getElementById('Phone').value ==""){
		alert("First name, last name, address, city, state, zip, email address and phone number are required.");
		return;
	}else{
		if (echeck(document.getElementById('Email').value)!=false){
			document.getElementById('registrationform').submit();
			}
		}
	}




/**
 * 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					
	}

