var URL = unescape(location.href)	// get current URL in plain ASCII
var xstart = URL.lastIndexOf("/") + 1
var xend = URL.length
var curfilename = URL.substring(xstart,xend);
var dirpath = URL.substring(0,xstart)

var imagepath ="";
if(dirpath.indexOf("/states/")!=-1) {
	imagepath="../../";
}
else if(dirpath.indexOf("/cityinfo/")!=-1) {
	imagepath="../../";
}

//========================================================================================
// Form fix (Feb 10, 2005)
// closes any previously opened form tag.
//========================================================================================
document.write("</form>")
//========================================================================================
// Incialize necessary variables
//========================================================================================
    var strhidSection;
	var partnerID;
	var filter;
	var style;
	var qualifytitle;
	var bbnhome;
	var bbnbusiness;
	var bbnenterprise;
	var form;
	var shortform;
	var ipd;
	var logoHide;
	var logo;

//========================================================================================
// Set Variables
//========================================================================================


	//strhidSection = "Home"
	partnerID = "dslbroker"	
	filter = ""	
	rtext = "Home"	
	btext = "Business"	
		
	style = ""	
	qualifytitle = "Get Real Time Quotes For Broadband"	
	bbnhome = "true"	
	bbnbusiness = "true"	
	bbnenterprise = "true"	
	form = ""
	bbnNoPhone = "false"
	moved = "true"	
	test = "www.broadbandnational.com"
	optin = "true"
	optin_check = "false"	
	checktext = "Yes, I'd like to receive updates on special broadband offers or availability in my area."	
	shortform = "false"	
	extrafield = "false"	
	extrafieldtext = "Extra Field:"	
	extrafieldrequired = "false"	
	ipd = "false"	
	nocallback = "false"	
	nocallbackhome = "false"	
	nocallbackbusiness = "false"	
	call_back = "false"	
	call_back_text = "I would like to have a Broadband consultant contact me back for further assistance."	
	call_back_checked = "checked"	 // ===============================
	 // Call Back Black List
	 // ===============================
			if((partnerID == "covad") || (partnerID == "fhtm") || (partnerID == "fionda")){
				call_back_checked = "";
			}
			if((partnerID == "comcast_cj")){
				call_back_checked = "checked";
			}
				// ================================
	
	openin = "default"	
	// =================================
	
	img = "default"	
	// =================================
	
	logoHide = "false"	
	// =================================
	
		
	// === DEFAULT SERVICE ==============================
	
	DefaultServ = "home"	
	// === LOGO =======================================
	//   Changes the display of the provider logos on the results page
	//   Added on 4-18-2006
	
	logo = "1000"	
	debug = "false"	
	// === Salesteam Additional Information Flag ========================
	//   Adds more information to the Results page so that salesteam agents obtain additional information regarding the qual
	//   Added on 6/20/2006
	
	salesteam = "N"	
	// === Customized Text for Qual Form ================================
	// Added July 14, 2006
	
	ServicePhoneText = "Enter Service Phone:"	
	ContactNumberText = "Contact Number:"	
	EnterEmailText = "Enter Your Email:"	
	ContactNameText = "Contact Name:"	
// === Load Powered by IBIS or BBN =======================================================
//  Updated: July  17, 2006
	
	PoweredBy = "http://www.broadbandnational.com/images/bbn88x31powered.gif"		
//========================================================================================
// qualification form functions
//========================================================================================

////// Targus.asp?ContactName=test&ServicePhone=1234567890&Email=test@test.com&ContactPhone=1234567890&Type=home&referring_partner=dslcity 
///// General Note 
///// 1. The controls in input.asp  and HomePage.asp are with same name hence 
/////    a single function in validation.js  "checkHomePageInputValues()" is used

// Function Name  : CallTargus  
// Description    : This function constructs a url for redirection with relevent form values after checking the validations
// Author          : S.M.P.Gokulnath
// Created Date    :  Sep -09- 2004
// Last modified  : June 30, 2005 by David Rodriguez

// Required Variables:
//      	partnerID    - Afiliate Identification
//      	filter       - code to filter service providers in results page

// This function determines how to return the results page after a qualification.
//    Self and Defualt  - returns results on the same page
//    Parent            - returns results on a parent page (such as the top level of a frame or iframe page)
//    New               - returns results in a pop or new winodw.
// Created by David Rodriguez
// Last Modified: June 30, 2005
function RedirectPage(strlocation) {
	//prompt('',strlocation);
	switch (openin) {
	case 'self': location.href = strlocation; break;
	case 'parent': parent.location.href=strlocation; break;
	case 'new': window.open(strlocation); break;
	default: location.href = strlocation;
	} 
}

function GetAddress(strlocation) {
	strRedirURL = "http://www.broadbandnational.com/business/targus.asp?location=" + strlocation + "&ServicePhone=" + document.IndexForm.DSLPhoneAreaCode.value + document.IndexForm.DSLPhoneFirst.value +document.IndexForm.DSLPhoneLast.value;
	RedirectPage(strRedirURL);
}

//This function will check if particular object is defined or available or not, if available
//return true and if not available return false
function isDefined(uObject)
{
	return typeof(uObject) == "undefined" ? false:true;	
}

// This function allows the value of the extrafield input box to append to the partnerID var 
function updatePartnerID()
{
	if (isDefined(document.IndexForm.extrafield) == true)	{
		if (document.IndexForm.extrafield.value != "") {
			if (partnerID.indexOf("-") != -1)	{
				partnerID = partnerID + ":" + document.IndexForm.extrafield.value;
			} else {
			partnerID = partnerID + "-" + document.IndexForm.extrafield.value;
			}
		}
	}
}

function CallTargus()
{
	// appends extrafiled value (if it exists) to the partnerID variable
	updatePartnerID();
	
	var str_call_back;
	str_call_back="N";
	
	if (isDefined(document.IndexForm.call_back) == true)
	{
		if (document.IndexForm.call_back.checked == true)
		{
			str_call_back = "Y";
		}
		else
		{
			str_call_back = "N";
		}
	}
	else
	{
		str_call_back = "Y";
	}
	if (document.IndexForm.rbhome.checked==false &&  document.IndexForm.rbbusiness.checked==false)
	{
		alert("Please Select  'Qualify Service for'  ");
		document.IndexForm.rbhome.focus();
		return;
	}
	var strhidSection;
		if (document.IndexForm.rbhome.checked==true)
		{
			strhidSection = "home"
		}
		else
		{
			strhidSection = "business"
		}
//  checkHomePageInputValues validation function is called 	from validation.js  file //////////  
	  if(checkHomePageInputValues(strhidSection))
	 {
 		var sFullName="";
		var sFirstName="";
		var sLastName="";
		var ss="";
		sFullName= document.IndexForm.name.value
		if(sFullName.length>0)
		{
			sFullName=sFullName.replace(/^\s*(.*)/, "$1");
			sFullName=sFullName.replace(/(.*?)\s*$/, "$1");
			arr1=sFullName.split(" ");
			count=1;
			sFirstName=arr1[0];	 
			while(count < arr1.length)
			{
				ss=ss + " " + arr1[count];
				count = count+1;
			}
			 sLastName=ss;
		}


	 	strRedirURL="targus.asp"
	 	strRedirURL=strRedirURL + "&yourname=" + document.IndexForm.name.value
		strRedirURL=strRedirURL + "&fname=" +sFirstName
 		strRedirURL=strRedirURL + "&lname=" + sLastName
		strRedirURL=strRedirURL + "&ServicePhone=" + document.IndexForm.DSLPhoneAreaCode.value + document.IndexForm.DSLPhoneFirst.value +document.IndexForm.DSLPhoneLast.value

		strRedirURL=strRedirURL + "&Email=" + document.IndexForm.shopper_email.value
		strRedirURL=strRedirURL + "&ContactPhone=" + document.IndexForm.DSLPhoneAreaCode2.value + document.IndexForm.DSLPhoneFirst2.value +document.IndexForm.DSLPhoneLast2.value
		
		if (document.IndexForm.rbhome.checked==true)
		{
			strRedirURL=strRedirURL + "&Type=" + "Home"
				if (nocallback == "true"){
            		if (nocallbackhome == "true"){
                        strRedirURL = strRedirURL+"&call_back=N";}
           			 else {
						strRedirURL = strRedirURL+"&call_back=Y";}	}

		
		}
		if (document.IndexForm.rbbusiness.checked==true)
		{
			strRedirURL=strRedirURL + "&Type=" + "Business"
			
			if (nocallback == "true"){
				if (nocallbackbusiness == "true"){
					strRedirURL = strRedirURL+"&call_back=N";}
	            else {
					strRedirURL = strRedirURL+"&call_back=Y";}	}

		}
		strRedirURL=strRedirURL + "&referring_partner=" +partnerID
		strRedirURL=strRedirURL + "&id=" +partnerID
		strRedirURL=strRedirURL +"&targusflag=yes"
		strRedirURL=strRedirURL +"&autophoneflag=no"
		strRedirURL=strRedirURL +"&FilterOnly=" + filter
		
		if (nocallback == "false"){
			strRedirURL=strRedirURL +"&call_back=" + str_call_back;
		}
		    strRedirURL=strRedirURL +"&logo=" + logo
		    strRedirURL=strRedirURL +"&salesteam=" + salesteam
		

				
// function called to show popup window 
	  // TimedPopup("winpopup.asp",400,300,10);
 RedirectPage("http://" + test + "/winpopup.asp?Redirfile="+strRedirURL);		 
	  }
 }
 
 function NoServicePhone()
{
	var str_call_back;
	str_call_back="N";
	
	if (isDefined(document.IndexForm.call_back) == true)
	{
		if (document.IndexForm.call_back.checked == true)
		{
			str_call_back = "Y";
		}
		else
		{
			str_call_back = "N";
		}
	}
	
	if (document.IndexForm.rbhome.checked==false &&  document.IndexForm.rbbusiness.checked==false)
	{
		alert("Please Select  'Qualify Service for'  ");
		document.IndexForm.rbhome.focus();
		return;
	}
	if (document.IndexForm.rbhome.checked==true)
	{
		strRedirURL="http://" + test + "/index.asp?section=home&layout=long&file=homeindex&hideflag=yes"		
		strRedirURL=strRedirURL + "&Type=Home"
	}
	if(document.IndexForm.rbbusiness.checked==true)
	{
		strRedirURL="http://" + test + "/index.asp?section=business&layout=long&file=businessindex&hideflag=yes"
		strRedirURL=strRedirURL + "&Type=Business"
	}
		var sFullName="";
		var sFirstName="";
		var sLastName="";
		var ss="";
		sFullName= document.IndexForm.name.value
		if(sFullName.length>0)
		{
			sFullName=sFullName.replace(/^\s*(.*)/, "$1");
			sFullName=sFullName.replace(/(.*?)\s*$/, "$1");
			arr1=sFullName.split(" ");
			count=1;
			sFirstName=arr1[0];	 
			while(count < arr1.length)
			{
				ss=ss + " " + arr1[count];
				count = count+1;
			}
			 sLastName=ss;
		}


	 		strRedirURL=strRedirURL + "&yourname=" + document.IndexForm.name.value
			strRedirURL=strRedirURL + "&ServicePhone=" + document.IndexForm.DSLPhoneAreaCode.value + document.IndexForm.DSLPhoneFirst.value +document.IndexForm.DSLPhoneLast.value

			strRedirURL=strRedirURL + "&Email=" + document.IndexForm.shopper_email.value
			strRedirURL=strRedirURL + "&ContactPhone=" + document.IndexForm.DSLPhoneAreaCode2.value + document.IndexForm.DSLPhoneFirst2.value +document.IndexForm.DSLPhoneLast2.value

			strRedirURL=strRedirURL + "&RecentMove=yes" 
			strRedirURL=strRedirURL + "&fname=" +sFirstName
	 		strRedirURL=strRedirURL + "&lname=" + sLastName
			strRedirURL=strRedirURL + "&referring_partner=" +partnerID
			strRedirURL=strRedirURL +"&targusflag=no"
			strRedirURL=strRedirURL +"&autophoneflag=no"
		    strRedirURL=strRedirURL +"&FilterOnly=" + filter
			strRedirURL=strRedirURL +"&call_back=" + str_call_back
		    strRedirURL=strRedirURL +"&logo=" + logo
		    strRedirURL=strRedirURL +"&salesteam=" + salesteam

				RedirectPage(strRedirURL);
		
}

// Function Name  : checkradioHome  
// Description    : This function makes radio button home appear as checked  and makes radio button business unchecked
//Author          : S.M.P.Gokulnath
//Created Date    :  Sep -09- 2004
function checkradioHome()
{
document.IndexForm.rbhome.checked=true
document.IndexForm.rbbusiness.checked=false

}

// Function Name  : checkradioBusiness
// Description    : This function makes radio button business appear as checked  and makes radio button home unchecked
//Author          : S.M.P.Gokulnath
//Created Date    :  Sep -09- 2004
function checkradioBusiness()
{
document.IndexForm.rbhome.checked=false
document.IndexForm.rbbusiness.checked=true
}

function multiinput()
{
    document.IndexForm.rbhome.checked=false
    document.IndexForm.rbbusiness.checked=false
    document.IndexForm.rbmulti.checked=true
    RedirectPage("http://" + test + "/multi_body.asp" + "?referring_partner=" +partnerID + "&id=" +partnerID +"&FilterOnly=" + filter);
}


//========================================================================================
// Validation Script
//========================================================================================

////**********************************************************************************************************
////* Author		 :	S.M.P.Gokulnath
////* Start Date	 :	September ,9, 2004
////* Last Modified  :	 
////* Project Name	 :	BBN
////* File Name	     :	validation.js
////* LOC			 :	
////* Version No.	 :	1.0.0	
////* Developed By   :	S.M.P.Gokulnath
////* purpose / Functionality       : This File contains general common functions 
////    1. TimedPopup 		- To show a popup window for specified number of seconds
////    2. IsNumeric(sText) - Checks whether passed value is Numeric - returns true if all are numeric and false if any character is found in 					 
////						  passed parameter

var TimeOut = 1;    // Initial time to Close window after __ number of seconds?
var TimeRemain = 0;  // Remaining time to Close window after __ number of seconds?
var RefreshRate = 0; // Check to close window every __ number of seconds?
var ChildWin = null;
// function  TimedPopup takes 4 parameter
/// 1. url = physical files to be displayed in the popup window /  constructed html string content can also be passed that is to be displayed 
/// 2. w   = width of popup window
/// 3. h   = height of popup window 
/// 4.intsec = number of secs the window needs to be displayed 
//// Note : Though the window is displayed excatly for number of secs specified , the processing time for the page which shows results is
////        dynamic hence in body on unload of the calling page the opened popup window is made to close 
//Description     : displays popup window for specified number of secs
//Author          : S.M.P.Gokulnath
//Created Date    :  Sep -09- 2004   

function TimedPopup(url,w,h,intsec)
{ 
TimeOut = intsec
//var winl = (screen.width)/4;
//var wint = (screen.height)/4;
var winl = 200;
var wint = 200;
var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+winl+',';
      settings +='left='+wint+',';
      settings +='scrollbars=No,resizable=No,toolbar=no, location=no, directories=no';

 windowprops = settings; // May be adjusted according to your needs
 if (ChildWin)
     return false;
 ChildWin = window.open(url, "ChildWin", windowprops);
  if(parseInt(navigator.appVersion) >= 4){ChildWin.window.focus();}
 ResetTimer();
 if (TimeOut && RefreshRate)
    setTimeout("CheckClose();",RefreshRate * 1);
}
function ResetTimer()
{
 TimeRemain = TimeOut;
}
function CheckClose()
{
 TimeRemain -= (RefreshRate);
 if (TimeRemain > 0)
    {
    if (ChildWin && ChildWin.closed)
       {
 
	ChildWin = null;
       }
    else
    if (ChildWin)
       { 
	setTimeout("CheckClose();",RefreshRate * 1);
       }
    }
 else
 if (ChildWin)
    {
 
     if (ChildWin.closed)
	 ChildWin = null;
     else
	{
         ChildWin.close();
	 ChildWin = null;
        }
    }
}

// function  IsNumeric takes 1 parameter
/// 1. sText = value that is to be checked whether it contains all numeriuc characters
//Description     : returns true if valid numeric values are entered and false if wrong values are entered
//Author          : S.M.P.Gokulnath
//Created Date    :  Sep -09- 2004   
 function IsNumeric(sText)
{
   var ValidChars = "0123456789.-";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;   
   }
   
   // function  IsAlphabets takes 1 parameter
/// 1. sText = value that is to be checked whether it contains only Characters
//Description     : returns true if valid Characters are entered and false if wrong values are entered
//Author          : S.M.P.Gokulnath
//Created Date    :  Jan-11-2005 
 function IsAlphabets(sText)
{
   var ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
   var IsAlpha=true;
   var Char;
   sText=sText.replace(/^\s*(.*)/, "$1");
   sText=sText.replace(/(.*?)\s*$/, "$1");
	if (sText.length==0 )
	{
	IsAlpha = false;
	}
	else
	{
  	 for (i = 0; i < sText.length && IsAlpha == true; i++) 
      { 
    	  Char = sText.charAt(i); 
	      if (ValidChars.indexOf(Char) == -1) 
    	     {
        	 IsAlpha = false;
	         }
      }
	}
   return IsAlpha;   
  }
  
 // Function Name  : checkNumbersonly
// Description    : This function checks whether numbers alone is entered into service and contact phone numbers
//Author          : S.M.P.Gokulnath
//Created Date    :  Jan-11-2004
function checkNumbersonly(thob)

{
	if (IsNumeric(thob.value)==false)
	{
	alert('Please enter numeric value');
	thob.value="";
	thob.focus();
	}
}
 // allow ONLY alphanumeric keys, no symbols or punctuation
// this can be altered for any "checkOK" string you desire
function isValidName(str)
{	
   var ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_ ";
   var Isok=true;
   var Char;
	str=str.replace(/^\s*(.*)/, "$1");
	str=str.replace(/(.*?)\s*$/, "$1");
	if (str.length==0 )
	{
	Isok = false;
	}
	else
	{
	   for (i = 0; i < str.length && Isok == true; i++) 
    	  { 
	      Char = str.charAt(i); 
    	  if (ValidChars.indexOf(Char) == -1) 
        	 {
	         Isok = false;
    	     }
	      }
	}
   return Isok;   
   }

// allow ONLY alphanumeric keys, no symbols or punctuation
// this can be altered for any "checkOK" string you desire
function isValidEmailChar(str)
{	
   var ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@_.- ";
   var Isok=true;
   var Char;
	str=str.replace(/^\s*(.*)/, "$1");
	str=str.replace(/(.*?)\s*$/, "$1");
	if (str.length==0 )
	{
	Isok = false;
	}
	else
	{
	   for (i = 0; i < str.length && Isok == true; i++) 
    	  { 
	      Char = str.charAt(i); 
    	  if (ValidChars.indexOf(Char) == -1) 
        	 {
	         Isok = false;
    	     }
	      }
	}
   return Isok;   
   }

// allow ONLY alphanumeric keys, no symbols or punctuation
// this can be altered for any "checkOK" string you desire
function isValidServiceAddress(str)
{	
   var ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_., ";
   var Isok=true;
   var Char;
	str=str.replace(/^\s*(.*)/, "$1");
	str=str.replace(/(.*?)\s*$/, "$1");
	if (str.length==0 )
	{
	Isok = false;
	}
	else
	{
	   for (i = 0; i < str.length && Isok == true; i++) 
    	  { 
	      Char = str.charAt(i); 
    	  if (ValidChars.indexOf(Char) == -1) 
        	 {
	         Isok = false;
    	     }
	      }
	}
   return Isok;   
   }
// function  isValidEmail takes 1 parameter
/// 1. str = value that is to be checked for email address
//Description     : returns true if valid email values is enteres and false if wrong values are entered
function isValidEmail(emailAddress)
{
   /* Check for empty address or invalid characters */
   if (hasInvalidChar(emailAddress))//emailAddress == "" ||
   {
      return false;
   }
   /* Check for invalid characters */
   if (isValidEmailChar(emailAddress)==false)//emailAddress == "" ||
   {
      return false;
   }

   /* check for presence of the @ character */
   var atPos = emailAddress.indexOf("@", 1)
   if (atPos == -1)
   {
      return false;
   }

   /* Check that there are no more @ characters */
   if (emailAddress.indexOf("@", atPos + 1) > -1)
   {
      return false;
   }

   /* Check for the presence of a dot somewhere after @ */
   var dotPos = emailAddress.indexOf(".", atPos + 1);
   if (dotPos == -1)
   {
      return false;
   }

   /* Check for presence of two or more characters after last dot */
   var lastDotPos = emailAddress.lastIndexOf(".");
   if (lastDotPos + 3 >  emailAddress.length)
   {
      return false;
   }

   return true;
}

// function  isValidEmailAddress takes 1 parameter
/// 1. str = value that is to be checked for email address
//Description     : returns true if valid email values is enteres and false if wrong values are entered
function isValidEmailAddress(emailAddress)
{
   /* Check for empty address or invalid characters */
   if (hasInvalidChar(emailAddress))//emailAddress == "" ||
   {
      return false;
   }
   /* Check for invalid characters */
   if (isValidEmailChar(emailAddress)==false)//emailAddress == "" ||
   {
      return false;
   }

   /* check for presence of the @ character */
   var atPos = emailAddress.indexOf("@", 1)
   if (atPos == -1)
   {
      return false;
   }

   /* Check that there are no more @ characters */
   if (emailAddress.indexOf("@", atPos + 1) > -1)
   {
      return false;
   }

   /* Check for the presence of a dot somewhere after @ */
   var dotPos = emailAddress.indexOf(".", atPos + 1);
   if (dotPos == -1)
   {
      return false;
   }

   /* Check for presence of two or more characters after last dot */
   var lastDotPos = emailAddress.lastIndexOf(".");
   if (lastDotPos + 3 >  emailAddress.length)
   {
      return false;
   }

   return true;
}

/*
   Return true if the given email address has an invalid character
   in it, else return false.
*/
function hasInvalidChar(emailAddress)
{
   var invalidChars = "/;:,"; // this list is not complete
   for (var k = 0; k < invalidChars.length; k++)
   {
      var ch = invalidChars.charAt(k);
      if (emailAddress.indexOf(ch) > -1)
      {
         return true;
      }
   }
   return false;
}

	



// function  checkHomePageInputValues  
///  Note : This Function is called from two pages
///           1. homepage.asp
///           2. input.asp
///      since the control name and validation are same
/// this is done to avoid code repetation and for ease of maintanence      
// Description    : This function checks whether the form values entered are proper 
//					and gives appropriate error message if any value is found invalid or left blank
//                  The function returns true if all values are found correct and false if any value is found invalid or left blank
//Author          : S.M.P.Gokulnath
//Created Date    :  Sep -09- 2004   
function checkHomePageInputValues(strSec)
{
	/////// ///   Extra Field   ////////////////////////
	
	if (extrafieldrequired != "false") {
		if ((isDefined(document.IndexForm.extrafield) == true) && ((document.IndexForm.extrafield.value==""))) {
			alert('Information missing. Please enter all required information.');
			document.IndexForm.extrafield.focus();
			return false;
		}
	}
 
	/////// ///   Name   ////////////////////////
	if((strSec.toLowerCase()=="home"))
	{
		if(document.IndexForm.name.value!='')
		{
				if(isValidName(document.IndexForm.name.value)==false)
				{
					alert('Please do not enter special characters with your name');
					document.IndexForm.name.focus();
					return false;
				}
		}
			
	}
	else
	{
		if(document.IndexForm.name.value=='')
		{
			alert('Please enter your Full Name ');
			document.IndexForm.name.focus();
			return false;
		}
				  
		if(isValidName(document.IndexForm.name.value)==false)
		{
			alert('Please do not enter special characters with your name');
			document.IndexForm.name.focus();
			return false;
		}	
	} 

	/// ///   Service Phone    ////////////////////////
	if (document.IndexForm.DSLPhoneAreaCode.value=='')  
	{
		alert('Please enter your Service telephone number');
		document.IndexForm.DSLPhoneAreaCode.focus();
		return false;
	}
	var num1,newTerm1
	if (parseInt(document.IndexForm.DSLPhoneAreaCode.value) != document.IndexForm.DSLPhoneAreaCode.value) 
	{
            num1 = document.IndexForm.DSLPhoneAreaCode.value;
            while (num1.charAt(0) == "0") 
	    {
	    	newTerm1 = num1.substring(1, num1.length);
		    num1 = newTerm1;
	    }
	    if (parseInt(num1) != num1)
	    {
		alert('Please enter a Service telephone number, numbers only');
		document.IndexForm.DSLPhoneAreaCode.focus();
		return false;
            }
	}

	if (document.IndexForm.DSLPhoneAreaCode.value.length < 3 || document.IndexForm.DSLPhoneAreaCode.value.length > 3 )  
	{
		alert('Please enter your Service telephone Area Code  3 digits number Eg(123) ');
		document.IndexForm.DSLPhoneAreaCode.focus();
		return false;
	}
	
	if  (document.IndexForm.DSLPhoneFirst.value=='')  
	{
		alert('Please enter your Service telephone number');
		document.IndexForm.DSLPhoneFirst.focus();
		return false;
	}
	var num2,newTerm2
	if (parseInt(document.IndexForm.DSLPhoneFirst.value) != document.IndexForm.DSLPhoneFirst.value)
	{
            num2 = document.IndexForm.DSLPhoneFirst.value;
            while (num2.charAt(0) == "0") 
	    {
	    	newTerm2 = num2.substring(1, num2.length);
		num2 = newTerm2;
	    }
	    if (parseInt(num2) != num2) 
	    {
		alert('Please enter a Service telephone number, numbers only');
		document.IndexForm.DSLPhoneFirst.focus();
		return false;
	    }
	}

	if (document.IndexForm.DSLPhoneFirst.value.length < 3 || document.IndexForm.DSLPhoneFirst.value.length > 3 )
	{
		alert('Please enter your Service telephone first 3 digits number Eg(123) ');
		document.IndexForm.DSLPhoneFirst.focus();
		return false;
	}
	
	if (document.IndexForm.DSLPhoneLast.value=='') 
	{
		alert('Please enter your Service telephone number');
		document.IndexForm.DSLPhoneLast.focus();
		return false;
	}
 
 	var num3,newTerm3
	if (parseInt(document.IndexForm.DSLPhoneLast.value) != document.IndexForm.DSLPhoneLast.value) 
	{
            num3 = document.IndexForm.DSLPhoneLast.value;
            while (num3.charAt(0) == "0") 
	    {
	    	newTerm3 = num3.substring(1, num3.length);
 	    	num3 = newTerm3;
	    }
	    if (parseInt(num3) != num3) 
	    {
		alert('Please enter a Service telephone number, numbers only');
		document.IndexForm.DSLPhoneLast.focus();
		return false;
	    }									
	}
			
	if (document.IndexForm.DSLPhoneLast.value.length < 4 || document.IndexForm.DSLPhoneLast.value.length > 4 )
	{
		alert('Please enter your Service telephone last 4 digits number Eg(1234) ');
		document.IndexForm.DSLPhoneLast.focus();
		return false;
	}
 
	/// ///   Mail Check Code ////////////////////////
	if (document.IndexForm.shopper_email.value=='' ||  (! isValidEmailAddress(document.IndexForm.shopper_email.value) ) ) {
		alert('Please enter a valid e-mail address so you will receive confirmation of your registration.  E-Mail addresses must be in a valid e-mail format (e.g. yourname@domain.com)');
		document.IndexForm.shopper_email.focus();
		return false;
	}
	 
	if((strSec.toLowerCase()=="home"))
	{
	}
	else
	{
		/// ///   Contact Phone  ////////////////////////
		if(document.IndexForm.DSLPhoneAreaCode2.value=='') 
		{
			alert('Please enter your Contact telephone number');
			document.IndexForm.DSLPhoneAreaCode2.focus();
			return false;
		}
		
		var num1,newTerm1
		if (parseInt(document.IndexForm.DSLPhoneAreaCode2.value) != document.IndexForm.DSLPhoneAreaCode2.value) 
		{
            num1 = document.IndexForm.DSLPhoneAreaCode2.value;
            while (num1.charAt(0) == "0") 
		    {
		    	newTerm1 = num1.substring(1, num1.length);
			    num1 = newTerm1;
	    	}
		    if (parseInt(num1) != num1)
		    {
				alert('Please enter a Contact telephone number, numbers only');
				document.IndexForm.DSLPhoneAreaCode2.focus();
				return false;
	       }
		}

		if(document.IndexForm.DSLPhoneAreaCode2.value.length < 3 || document.IndexForm.DSLPhoneAreaCode2.value.length > 3 ) 
		{
		alert('Please enter your Contact telephone Area Code  3 digits number Eg(123) ');
			document.IndexForm.DSLPhoneAreaCode2.focus();
			return false;
		}


		if (document.IndexForm.DSLPhoneFirst2.value=='') 
		{
			alert('Please enter your Contact telephone number');
			document.IndexForm.DSLPhoneFirst2.focus();
			return false;
		}

		var num2,newTerm2
		if (parseInt(document.IndexForm.DSLPhoneFirst2.value) != document.IndexForm.DSLPhoneFirst2.value)
		{
            num2 = document.IndexForm.DSLPhoneFirst2.value;
            while (num2.charAt(0) == "0") 
		    {
		    	newTerm2 = num2.substring(1, num2.length);
				num2 = newTerm2;
		    }
		    if (parseInt(num2) != num2) 
		    {
			alert('Please enter a Contact  telephone number, numbers only');
			document.IndexForm.DSLPhoneFirst2.focus();
			return false;
		    }
		}

		if (document.IndexForm.DSLPhoneFirst2.value.length < 3 || document.IndexForm.DSLPhoneFirst2.value.length > 3 ) 
		{
		alert('Please enter your Contact telephone First 3 digits number Eg(123) ');
			document.IndexForm.DSLPhoneFirst2.focus();
			return false;
		}
		
		if (document.IndexForm.DSLPhoneLast2.value=='')  
		{
			alert('Please enter your Contact telephone number');
			document.IndexForm.DSLPhoneLast2.focus();
			return false;
		}

		var num3,newTerm3
		if (parseInt(document.IndexForm.DSLPhoneLast2.value) != document.IndexForm.DSLPhoneLast2.value) 
		{
	        num3 = document.IndexForm.DSLPhoneLast2.value;
	        while (num3.charAt(0) == "0") 
		    {
		    	newTerm3 = num3.substring(1, num3.length);
	 	    	num3 = newTerm3;
		    }
		    if (parseInt(num3) != num3) 
		    {
			alert('Please enter a Contact telephone number, numbers only');
			document.IndexForm.DSLPhoneLast2.focus();
			return false;
		    }									
		}
		if (document.IndexForm.DSLPhoneLast2.value.length < 4 || document.IndexForm.DSLPhoneLast2.value.length > 4 )  
		{
		alert('Please enter your Contact telephone Last 4 digits number Eg(1234) ');
			document.IndexForm.DSLPhoneLast2.focus();
			return false;
		}
		
		
	}
	return true;
}
// This is part of code for auto tab in phone number fields
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode; 
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
	try {
		input.form[(getIndex(input)+1) % input.form.length].focus();
	}
	catch(er){
		
	}
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}

//========================================================================================
// Configure Style
//========================================================================================

document.write("<style type='text/css'>")
document.write("<!--")
document.write(".des_02 { font-family: Arial; font-size: 12px; font-weight: bold; line-height: 13px; color: #007CC2; }");
document.write(".des_03 { font-family: Arial; font-size: 12px; font-weight: normal; line-height: 13px; color: #000000; }")
document.write("input.type1 { border: 0px solid; background-image: url('" + imagepath + "images/input1.gif'); font-family: arial; color: #094d9c; font-size: 12px; width: 48; height: 18px; }")
document.write("input.type2 { border: 0px solid; background-image: url('" + imagepath + "images/input2.gif'); font-family: arial; color: #094d9c; font-size: 12px; width: 59; height: 18px; }")
document.write("input.type3 { border: 0px solid; background-image: url('" + imagepath + "images/input3.gif'); font-family: arial; color: #094d9c; font-size: 12px; width: 163; height: 18px; }")
document.write("input.type4 { border: 0px solid; background-image: url('" + imagepath + "images/input4.gif'); font-family: arial; color: #094d9c; font-size: 12px; width: 131; height: 18px; }")
document.write("-->")
document.write("</style>")

//========================================================================================
// Hide Show Function
//========================================================================================

document.write("\
<script type='text/javascript'>\
function doHide()\
	{\
		document.getElementById('business_phone_label1').style.display = 'none';\
		document.getElementById('business_phone_label2').style.display = 'none';\
		document.getElementById('contact_name').style.display = 'none';\
		document.getElementById('business_phone_label3').style.display = '';\
		document.getElementById('contact_name1').style.display = '';\
		document.getElementById('txtName').style.display='none';\
		document.getElementById('txtName1').style.display='';\
	}\
function doShow()\
	{\
		document.getElementById('business_phone_label1').style.display = '';\
		document.getElementById('business_phone_label2').style.display = '';\
		document.getElementById('contact_name').style.display = '';\
		document.getElementById('business_phone_label3').style.display = 'none';\
		document.getElementById('contact_name1').style.display = 'none';\
		document.getElementById('txtName').style.display='';\
		document.getElementById('txtName1').style.display='none';\
	}\
</script>")

//========================================================================================
// Display form
//========================================================================================

flaghome = false;
flagbusiness = false;

document.write("<form name='IndexForm'>")

document.write("<input type='hidden' name='hidSection' value=''>")
if (bbnbusiness == "false") {
   document.write("<input type='hidden' name='name' size='20' maxlength='75' class='input_field'>")
   document.write("<input type='hidden' name='DSLPhoneAreaCode2' size='3' maxlength='3' onKeyUp='return autoTab(this, 3, event);' class='input_field'>")
   document.write("<input type='hidden' name='DSLPhoneFirst2' size='3' maxlength='3' onKeyUp='return autoTab(this, 3, event);' class='input_field'>")
   document.write("<input type='hidden' name='DSLPhoneLast2' size='4' maxlength='4' onKeyUp='return autoTab(this, 4, event);' class='input_field'>")
}
document.write("<table width='600' border='0' cellpadding='0' cellspacing='0'>")
document.write("  <tr>")
document.write("    <td>")
document.write('		<TABLE WIDTH="600" cellpadding="0" cellspacing="0" border="0">');
document.write('		<TR>');
document.write('			<TD WIDTH="18"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="18" HEIGHT="1" BORDER=0></TD>');
document.write('			<TD>');
document.write('				<TABLE WIDTH="195" HEIGHT="100%" cellpadding="0" cellspacing="0" border="0" background="' + imagepath + 'images/step1bg.jpg">');
document.write('				<TR>');
document.write('					<TD HEIGHT="60" valign="bottom" style="padding:0 0 0 16"><span class="des_02">Qualify Service for</span></TD>');
document.write('				</TR>');
document.write('				<TR>');
document.write('					<TD HEIGHT="80" valign="top" style="padding:10 0 0 28"><span class="des_03"><input type="radio" align="absmiddle" name="rbhome" onClick="javascript:checkradioHome();doHide();">Home<br><input type="radio" align="absmiddle" name="rbbusiness" onClick="javascript:checkradioBusiness();doShow();">Business</span></TD>');
document.write('				</TR>');
document.write('				</TABLE>');
document.write('			</TD>');
document.write('			<TD WIDTH="9"><IMG SRC="' + imagepath + 'images/divid1.jpg" WIDTH="9" HEIGHT="142" BORDER=0></TD>');
document.write('			<TD>');
document.write('				<TABLE WIDTH="195" HEIGHT="100%" cellpadding="0" cellspacing="0" border="0" background="' + imagepath + 'images/step2bg.jpg">');
document.write('				<TR id="contact_phone_label">');
document.write('					<TD HEIGHT="60" valign="bottom" style="padding:0 0 0 16"><span class="des_02">Enter Service Phone</span></TD>');
document.write('				</TR>');
document.write('				<TR>');
document.write('					<TD HEIGHT="18">');
document.write('						<TABLE WIDTH="100%" HEIGHT="100%" cellpadding="0" cellspacing="0" border="0">');
document.write('						<TR>');
document.write('							<TD WIDTH="16"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="16" HEIGHT="1" BORDER=0></TD>');
document.write('							<TD WIDTH="48"><input type="text" name="DSLPhoneAreaCode" class="type1" maxlength=\'3\' onKeyUp=\'return autoTab(this, 3, event);\'></TD>');
document.write('							<TD WIDTH="4"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="4" HEIGHT="1" BORDER=0></TD>');
document.write('							<TD WIDTH="48"><input type="text" name="DSLPhoneFirst" class="type1" maxlength=\'3\' onKeyUp=\'return autoTab(this, 3, event);\'></TD>');
document.write('							<TD WIDTH="4"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="4" HEIGHT="1" BORDER=0></TD>');
document.write('							<TD WIDTH="59"><input type="text" name="DSLPhoneLast" class="type2" maxlength=\'4\' onKeyUp=\'return autoTab(this, 4, event);\'></TD>');
document.write('							<TD WIDTH="16"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="16" HEIGHT="1" BORDER=0></TD>');
document.write('						</TR>');
document.write('						</TABLE>');
document.write('					</TD>');
document.write('				</TR>');
document.write('				<tr id="business_phone_label1">');
document.write('					<TD HEIGHT="19" valign="bottom" style="padding:0 0 0 16"><div align="left"><span class="des_02">Contact Number</span></div></TD>');
document.write('				</TR>');
document.write('				<tr id="business_phone_label2">');
document.write('					<TD HEIGHT="22">');
document.write('						<TABLE HEIGHT="100%" cellpadding="0" cellspacing="0" border="0">');
document.write('						<TR>');
document.write('							<TD WIDTH="16"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="16" HEIGHT="1" BORDER=0></TD>');
document.write('							<TD WIDTH="48"><input type="text" name="DSLPhoneAreaCode2" class="type1" maxlength=\'4\' onKeyUp=\'return autoTab(this, 3, event);\'></TD>');
document.write('							<TD WIDTH="4"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="4" HEIGHT="1" BORDER=0></TD>');
document.write('							<TD WIDTH="48"><input type="text" name="DSLPhoneFirst2" class="type1" maxlength=\'4\' onKeyUp=\'return autoTab(this, 3, event);\'></TD>');
document.write('							<TD WIDTH="4"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="4" HEIGHT="1" BORDER=0></TD>');
document.write('							<TD WIDTH="59"><input type="text" name="DSLPhoneLast2" class="type2" maxlength=\'4\' onKeyUp=\'return autoTab(this, 4, event);\'></TD>');
document.write('							<TD WIDTH="16"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="16" HEIGHT="1" BORDER=0></TD>');
document.write('						</TR>');
document.write('						</TABLE>');
document.write('					</TD>');
document.write('				</TR>');
document.write('				<tr id="business_phone_label3" style="display:none;">');
document.write('					<TD>');
document.write('						<TABLE HEIGHT="100%" cellpadding="0" cellspacing="0" border="0">');
document.write('						<TR>');
document.write('							<TD HEIGHT="41"></TD>');
document.write('						</TR>');
document.write('						</TABLE>');
document.write('					</TD>');
document.write('				</TR>');
document.write('				<TR>');
document.write('					<TD>&nbsp;</TD>');
document.write('				</TR>');
document.write('				</TABLE>');
document.write('			</TD>');
document.write('			<TD WIDTH="9"><IMG SRC="' + imagepath + 'images/divid2.jpg" WIDTH="9" HEIGHT="142" BORDER=0></TD>');
document.write('			<TD>');
document.write('				<TABLE WIDTH="195" HEIGHT="100%" cellpadding="0" cellspacing="0" border="0" background="' + imagepath + 'images/step3bg.jpg">');
document.write('				<TR>');
document.write('					<TD HEIGHT="60" valign="bottom" style="padding:0 0 0 16"><span class="des_02">Enter Your Email</span></TD>');
document.write('				</TR>');
document.write('				<TR>');
document.write('					<TD HEIGHT="18">');
document.write('						<TABLE WIDTH="100%" HEIGHT="100%" cellpadding="0" cellspacing="0" border="0">');
document.write('				<TR>');
document.write('					<TD WIDTH="16"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="16" HEIGHT="1" BORDER=0></TD>');
document.write('					<TD><input type="text" name="shopper_email" class="type3"></TD>');
document.write('					<TD WIDTH="16"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="16" HEIGHT="1" BORDER=0></TD>');
document.write('				</TR>');
document.write('				</TABLE>');
document.write('			</TD>');
document.write('		</TR>');
document.write('		<TR id="contact_name">');
document.write('			<TD HEIGHT="16" valign="bottom" style="padding:0 0 0 16"><span class="des_02">Contact Name</span></TD>');
document.write('		</TR>');
document.write('		<TR>');
document.write('			<TD HEIGHT="18">');
document.write('				<TABLE WIDTH="100%" HEIGHT="100%" cellpadding="0" cellspacing="0" border="0">');
document.write('				<TR height="21" id="txtName">');
document.write('					<TD WIDTH="16"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="16" HEIGHT="1" BORDER=0></TD>');
document.write('					<TD WIDTH="131"><input type="text" name="name" class="type4"></TD>');
document.write('					<TD WIDTH="4"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="4" HEIGHT="1" BORDER=0></TD>');
document.write('					<TD WIDTH="28"><A HREF="#" onClick=\'javascript:CallTargus();return false;\'><IMG SRC="' + imagepath + 'images/go.gif" WIDTH="28" HEIGHT="18" BORDER=0 ALT=""></A></TD>');
document.write('					<TD WIDTH="16"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="16" HEIGHT="1" BORDER=0></TD>');
document.write('				</TR>');
document.write('				<TR id="txtName1" height="20" style="display:none;">');
document.write('					<TD WIDTH="151" style="padding-top:5px"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="151" HEIGHT="1" BORDER=0></TD>');
document.write('					<TD WIDTH="28" style="padding-top:5px"><A HREF="#" onClick=\'javascript:CallTargus();return false;\'><IMG SRC="' + imagepath + 'images/go.gif" WIDTH="28" HEIGHT="18" BORDER=0 ALT=""></A></TD>');
document.write('					<TD WIDTH="16" style="padding-top:5px"><IMG SRC="' + imagepath + 'images/trans.gif" WIDTH="16" HEIGHT="1" BORDER=0></TD>');
document.write('				</TR>');
document.write('				</TABLE>');
document.write('			</TD>');
document.write('		</TR>');
document.write('		<TR id="contact_name1" style="display:none;">');
document.write('			<TD HEIGHT="16" valign="bottom" style="padding:0 0 0 16">&nbsp;</TD>');
document.write('		</TR>');
document.write('		<TR>');
document.write('			<TD>&nbsp;</TD>');
document.write('		</TR>');
document.write('		</TABLE>');
document.write("	</td>")
document.write("  </tr>")
document.write("</table>")
document.write("	</td>")
document.write("  </tr>")
document.write("</table>")

document.write("</form>")