
		
		function setCookie(name, value,  path, domain)
		{
			var curCookie = name + "=" + escape(value) +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") ;
			document.cookie = curCookie;
		}
		
	
		function isNumeric()
		{
			if (navigator.appName.indexOf("Netscape")<0)
			{
				get=event.keyCode;
				if((get>47&&get<58)||(get==8)||(get==9)) 
				{
					return true;
				}
				else
				{
					event.returnValue=false;
				}
			}
		}			
	
		function getTNQueryString(strPromoCode, strCampaignCode, strSourceId)
			{
				//_hbLink('GO');
				
				var npa = document.form1.txtAreaCode1.value ;
				var nxx = document.form1.txtPrefix1.value;
				var nbr = document.form1.txtPhoneNumber1.value;
				var url = document.form1.url.value;
				var strqs="";
				
				//setCookie('OneCMSNPA',npa,'/','.verizon.com');
				//setCookie('OneCMSNXX',nxx,'/','.verizon.com');
				//setCookie('OneCMSNBR',nbr,'/','.verizon.com');
				
				var result = 0; 
					
  			//validate phone number		
				result =  validatePhoneNumber(npa, nxx, nbr);
					
	 			if(result)
	 			{
	 			 
	 				if((strPromoCode !='') && (strPromoCode !=null))
	 				{
	 					strqs= "&Promotion_Code=" + strPromoCode;
	 				}
	 				if((strSourceId !='') && (strSourceId !=null))
	 				{
	 					strqs= strqs + "&sourceID=" + strSourceId;
	 				}				 	  
	 				if((strCampaignCode !='') && (strCampaignCode !=null))
	 				{
	 					strqs= strqs + "&CampaignCode=" + strCampaignCode;
	 				}
	
	 				var str = url  + "?txtAreaCode=" + npa + "&txtPrefix=" + nxx + "&txtPhoneNumber=" + nbr + strqs; 	
					_hbLink('linkout_check'); 
					document.location.href = str;
	 				return true;
	 				}
	 				else
	 				{
	 					alert("Please enter a 10 digit number");
	 					return false;
	 				} 	 
				
				}
					
			// this function will validate a phone number
			function validatePhoneNumber(area_code, exchange, last4)
			{
			
				var area_code_string=area_code+"";
				var exchange_string=exchange+"";
				var last4_string=last4+"";
				var valid=1;
			
			if(area_code=="" || exchange=="" || last4=="")
			{
					valid=0;
			}
			else if(isNaN(area_code) || isNaN(exchange) || isNaN(last4))
			{
					valid=0;
			}
			else if(area_code_string.length!=3 || exchange_string.length!=3 || last4_string.length!=4)
			{
					valid=0;
			}
			
			return valid;
			}
			
	//
		function AutoTab( hItem, maxLength)
		{				
			isNumeric();
			if (navigator.appVersion.indexOf('Mac') != -1)
			{
				return;
			}
			else
			{
				var vKeyCode,oItem;
				//Set values as per the field name 
				switch (hItem.name){	
					case "txtAreaCode1" :				
						oItem = document.getElementById("txtAreaCode1"); //document.form1.txtPrefix ; 
						break ; 				
					case "txtPrefix1" :			
						oItem = document.getElementById("txtPrefix1"); //document.form1.txtPhoneNumber ; 
						break ;	
					case "txtPhoneNumber1" :				
						oItem = document.getElementById("txtPhoneNumber1");  //document.form1.tnPrefix ; 
						break ; 				
											
					}
			
				vKeyCode = window.event.keyCode
				if(vKeyCode==9 && window.event.shiftKey){ return; }
				switch(window.event.keyCode)
				{
					case 37 : return;
					case 39 : return;
					case 16 : return;
					case 46 : return;
				}
				if (window.event.keyCode != 9 )
				{
					if( typeof(oItem) == "object" )
					{
							
						if(bAutotab && (String(oItem.value).length ==0) && (String(hItem.value).length == maxLength) && (window.event.keyCode != 8))
						{
							oItem.focus();
						}
					}
				}
			}
			bAutotab = true;
		}
			
		bAutotab = true;
		
		
		function stopAutoTab()
		{
			bAutotab = false;
		}		
					
									
			
		function isNNumeric(e)
			{
				var isNN = (navigator.appName.indexOf("Netscape")!=-1);
				var keyCode = (isNN) ? e.which : e.keyCode; 
				if (isNN)
				{
					if (keyCode == 0)
						return true;
				}
				if((keyCode>47&&keyCode<58)||(keyCode==8)||(keyCode==9)) 
				{
					return true;
				}
				else
				{	
					if (e.returnValue) 
					{
						e.returnValue = false;
						return false;
					} 
					else if (e.preventDefault) 
					{
						e.preventDefault();
						return false;
					}
					this.event.returnValue = false;
					return false;            
				}	
			}			
			
		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;
		}
		
		function NautoTab(input,len, e) 
			{	
				if (!isNNumeric(e))
					return false;
					
				var isNN = (navigator.appName.indexOf("Netscape")!=-1);
				var keyCode = (isNN) ? e.which : e.keyCode; 
				var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
				len = (isNN) ? len-1 : len;

				if(input.value.length >= len && !containsElement(filter,keyCode)) 
				{
					input.value = input.value.slice(0, len);
					input.form[(getIndex(input)+1) % input.form.length].focus();
				}
				return true;
			}
			//  End -->
		
		function display_disclaimer()
		{
			document.getElementById('div_disclaimer_link').style.display = "none";
			document.getElementById('div_disclaimer_content').style.display = "block";
		}
		
		function open_popup(sURL)
		{
			window.open(sURL,"Popup","width=775,height=463,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
		}		
		
		function CaptureEnterKey(e)
		{
    	var isNN = (navigator.appName.indexOf("Netscape")!=-1);
			var keyCode = (isNN) ? e.which : event.keyCode; 
		
			if(keyCode == 13)
				getTNQueryString();          
		} 
