// JavaScript Document

if(top.location != window.location)
	top.location.replace(window.location.href);

function launchwin(winurl,winname,winfeatures)
{
	//This launches a new window and then
	//focuses it if window.focus() is supported.
	newwin = window.open(winurl,winname,winfeatures);
	if(parseInt(navigator.appVersion) >= 4)
	{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',250);
	}
}
function launchFullWin(winurl,winname)
{
	//This launches a new window and then
	//focuses it if window.focus() is supported.
  	var winl = 0;//screen.width / 2;
  	var wint = 0;//screen.height / 2;
	newwin = window.open(winurl,winname,'scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,top=' + wint + ',left=' + winl + ',width=' + screen.width + ',height=' + screen.weight);
	if(parseInt(navigator.appVersion) >= 4)
	{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',250);
	}
}
function launchCenteredWin(url, name, width, height, otherfeatures)
{
  var str = "height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;

    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;

    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
  }
  newwin = window.open(url, name, str + ',' + otherfeatures);
  if(parseInt(navigator.appVersion) >= 4)
  {
	//delay a bit here because IE4 encounters errors
	//when trying to focus a recently opened window
 	setTimeout('newwin.focus();',250);
  }
}
function launchNewsWin(winurl,winname)
{
	//This launches a new window and then
	//focuses it if window.focus() is supported.
	newwin = window.open(winurl,winname,'scrollbars=yes,resizable=yes,width=800,height=600');
	if(parseInt(navigator.appVersion) >= 4)
	{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',250);
	}
}
function launchWallpaper(winurl,winname)
{
	//This launches a new window and then
	//focuses it if window.focus() is supported.
	newwin = window.open(winurl,winname,'scrollbars=no,resizable=no,width=515,height=385');
	if(parseInt(navigator.appVersion) >= 4)
	{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',250);
	}
}

function check(form){
	if(form.fname.value.search(/\S/)==-1){
		alert("Please Enter First Name.");
		form.fname.focus();
		return false;
	}
	if(form.address.value.search(/\S/)==-1){
		alert("Please Enter Street Address.");
		form.address.focus();
		return false;
	}
	if(form.city.value.search(/\S/)==-1){
		alert("Please Enter City.");
		form.city.focus();
		return false;
	}
	if(form.in_state.selectedIndex==0){
		alert("Please Select State.");
		return false;
	}
	if(form.zip.value.search(/\S/)==-1){
		alert("Please Enter Zip.");
		form.zip.focus();
		return false;
	}	
	if((/^[a-zA-Z0-9-._]+(@[a-zA-Z0-9_.-]+\.)+[a-zA-Z]{2,4}$/).exec(form.emailAddress.value)==null){
		alert("Please Enter a Proper E-mail Address.");
		form.emailAddress.focus();
		return false;
	}
}

function chkVal()
{
	if(document.frmReg.fname.value.search(/\S/)==-1)
	{
		alert("Please enter your name");
		document.frmReg.fname.focus();
		return(false);
	}
	if(document.frmReg.com_name.value.search(/\S/)==-1)
	{
		alert("Please enter your company name");
		document.frmReg.com_name.focus();
		return(false);
	}
	if(document.frmReg.address.value.search(/\S/)==-1)
	{
		alert("Please enter your address");
		document.frmReg.address.focus();
		return(false);
	}
	if(document.frmReg.address.value.length<10)
	{
		alert("Please enter full address");
		document.frmReg.address.focus();
		return(false);
	}
	if(document.frmReg.city.value.search(/\S/)==-1)
	{
		alert("Please enter your city");
		document.frmReg.city.focus();
		return(false);
	}
	if(document.frmReg.in_state.selectedIndex==0)
	{
		alert("Please select your state");
		document.frmReg.in_state.focus();
		return(false);
	}
	if(document.frmReg.zip.value.search(/\S/)==-1)
	{
		alert("Please enter zip code");
		document.frmReg.zip.focus();
		return(false);
	}
	if(document.frmReg.phone_o.value.search(/\S/)==-1)
	{
		alert("Please enter office phone number");
		document.frmReg.phone_o.focus();
		return(false);
	}
	if(isNaN(parseInt(document.frmReg.phone_o.value)))
	{
		alert("Please enter proper phone number");
		document.frmReg.phone_o.focus();
		return(false);
	}
	if(document.frmReg.m_phone.value.search(/\S/)==-1)
	{
		alert("Please enter your mobile phone number");
		document.frmReg.m_phone.focus();
		return(false);
	}
//	if(isNaN(parseInt(document.frmReg.m_phone.value)))
//	{
//		alert("Please enter proper mobile phone number");
//		document.frmReg.m_phone.focus();
//		return(false);
//	}
	if(document.frmReg.how_find.value.search(/\S/)==-1)
	{
		alert("Please enter how you found us");
		document.frmReg.how_find.focus();
		return(false);
	}
	return(true);
}


function chkregVal()
{
	if(document.frmReg.fname.value.search(/\S/)==-1)
	{
		alert("Please enter your name");
		document.frmReg.fname.focus();
		return(false);
	}
	if(document.frmReg.address.value.search(/\S/)==-1)
	{
		alert("Please enter your address");
		document.frmReg.address.focus();
		return(false);
	}
	if(document.frmReg.address.value.length<10)
	{
		alert("Please enter full address");
		document.frmReg.address.focus();
		return(false);
	}
	if(document.frmReg.city.value.search(/\S/)==-1)
	{
		alert("Please enter your city");
		document.frmReg.city.focus();
		return(false);
	}
	if(document.frmReg.in_state.selectedIndex==0)
	{
		alert("Please select your state");
		document.frmReg.in_state.focus();
		return(false);
	}
	if(document.frmReg.zip.value.search(/\S/)==-1)
	{
		alert("Please enter zip code");
		document.frmReg.zip.focus();
		return(false);
	}
	if(document.frmReg.h_phone.value.search(/\S/)==-1)
	{
		alert("Please enter your home phone number");
		document.frmReg.h_phone.focus();
		return(false);
	}
	if(isNaN(parseInt(document.frmReg.h_phone.value)))
	{
		alert("Please enter proper phone number");
		document.frmReg.h_phone.focus();
		return(false);
	}
	var test = 0;
	var x=document.getElementsByName("radiobutton");
	var y = x.length;
	for (i=0;i<x.length;i++)
	{
		//alert(x[i].checked);
		if (x[i].checked == true)
		{
			test = 1;
			break;
		}
	}
	if (test == 0)	
	{
		alert ("Please select a location and date");
		return(false);
	}


//	if(document.frmReg.radiobutton.value != null)
//  document.getElementById("answer").value=browser;	
//	{
//		alert("Please select a location and date");
//		document.frmReg.radiobutton.focus();
//		return(false);
//	}
	return(true);
}

function expandfirst(tbodyid,tstate) {
	if (document.forms[0].checkbox332.checked) {
		document.getElementById(tbodyid).style.display = tstate;
	} else {
		document.getElementById(tbodyid).style.display = "none";
	}
}

function expandsecond(tbodyid,tstate) {
	if (document.forms[0].purpose[1].checked) {
		document.getElementById(tbodyid).style.display = "";
	} else {
		document.getElementById(tbodyid).style.display = "none";
	}
}

function expandthird(tbodyid,tstate) {
	
	if (document.forms[0].location.selectedIndex == 1) {
		document.getElementById("Row2").style.display = "";
		document.getElementById("Row3").style.display = "";
		document.getElementById("Row4").style.display = "none";
		document.getElementById("Row5").style.display = "none";
	}
	else if (document.forms[0].location.selectedIndex == 2) {
		document.getElementById("Row2").style.display = "";
		document.getElementById("Row3").style.display = "none";
		document.getElementById("Row4").style.display = "";
		document.getElementById("Row5").style.display = "none";
	}
	else if (document.forms[0].location.selectedIndex == 3) {
		document.getElementById("Row2").style.display = "";
		document.getElementById("Row3").style.display = "none";
		document.getElementById("Row4").style.display = "none";
		document.getElementById("Row5").style.display = "";
	}
	else  {
		document.getElementById("Row2").style.display = "none";
		document.getElementById("Row3").style.display = "none";
		document.getElementById("Row4").style.display = "none";
		document.getElementById("Row5").style.display = "none";
	} 
		
	
}
