		function ClickLink(obj) 	
		{ 
			href = document.location.href.toLowerCase();
			if(href.indexOf('business') > -1)
				cookieVal = 'business';
			else if(href.indexOf('wireless') > -1)
				cookieVal = 'wireless';
			else
				cookieVal = 'residential';
			var text = ' ';
			try
			{
				text = obj.innerHTML.toLowerCase();
			}
			catch(e){}

			if('wireless,business,residential'.indexOf(text) > -1)
				cookieVal = text;
			deleteCookie('BusinessUnit');
			setCookie('BusinessUnit',cookieVal,60);
			return true;
		} 
		
		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 getTNQueryString(txtAreaCode,txtPrefix,txtPhoneNumber,pack,flashVars)
		{
			
			var isFlash;
			var npa;
			var nxx;
			var nbr;
			var envUrl = 'https://'+document.domain ;

			
			//alert("FLASH NUM: "+txtAreaCode+" "+txtPrefix+" "+txtPhoneNumber);


			if(flashVars != 1)
			{
				npa = document.getElementById(txtAreaCode).value ;
				nxx = document.getElementById(txtPrefix).value;
				nbr = document.getElementById(txtPhoneNumber).value;
				isFlash = 'false';
			}
			else
			{
				npa = txtAreaCode;
				nxx = txtPrefix;
				nbr = txtPhoneNumber;
				isFlash = 'true';	
			}

			 var url = envUrl + "/ForyourHome/GoFlow/MyVerizon/RegistrationBridge.aspx";

			 if(pack == "BDSL")
				url = envUrl + "/ForyourSmallBiz/Broadband/Ordering/BB_Loopqualframe.aspx";
			 else if(pack=="CFIOS" || pack=="FIOSTV")
				url = envUrl + "/FiOSForHome/Channels/FiOS/olo_loopqualframe.aspx";
			 var strqs="";
			 var result = 0; 

			 //validate phone number		
			 result =  validatePhoneNumber(npa, nxx, nbr,isFlash);
			 			 
			 if(result)
			 { 	
			        var str = url + "?txtAreaCode=" + npa + "&txtPrefix=" + nxx + "&txtPhoneNumber=" + nbr +"&crossoverind=yes"; 
				

			        	if(pack == "BDSL")
				{
						str = url + "?txtnpa=" + npa + "&txtnxx=" + nxx + "&txtline=" + nbr; 
						str += "&appName=HSI";
				}
					else if(pack=="CFIOS")
						str = url + "?txtAreaCode=" + npa + "&txtPrefix=" + nxx + "&txtPhoneNumber=" + nbr; 
					else if(pack=="FIOSTV")
						str = url + "?txtAreaCode=" + npa + "&txtPrefix=" + nxx + "&txtPhoneNumber=" + nbr + "&hdnFlow=TV&exmarket=N"; 
					else if(pack == "CDSL")
					{
						str = str + '&Client=VZDOTNET&FlowRoute=VZNET-NDSL&getstarted=1herohsilq' ;
						setCookie('Source','CHSI',null);
					}
					else if(pack == "HSI")
					{
						str = str + '&Client=VZDOTNET&FlowRoute=VZNET-NDSL&getstarted=1spoffhsilq' ;	
						setCookie('Source','CHSI',null);
					}
			        document.location.href = str;
				this.event.returnValue = false;
	 			return true;
			 }
			 else
			 {
				var error_count = 0;
				var errorMessage = 'Please Enter a Valid Phone Number';
			
				if (npa == '' || npa.length != 3)
				{
					error_count++;
				}
				if (nxx == '' || nxx.length != 3)
				{	
					error_count++;
				}
				if (nbr == '' || nbr.length != 4)
				{
					error_count++;
				}
				if (error_count > 0)
				{  
					alert (errorMessage);
					document.getElementById(txtAreaCode).className = 'redfield'; 
					document.getElementById(txtPrefix).className = 'redfield';
					document.getElementById(txtPhoneNumber).className = 'redfield';
					if(focusedElement != null && flashVars != 1)
					{
						focusedElement.focus();
					}
					else
						document.getElementById(txtAreaCode).focus();
					return false;
				}	 	 	 		
			 } 
			 
	 	 }
	 	 
	 	 var isSearch = 'false';
	 	 function CaptureEnterKeySearch1(e)
	 	 {
	 		isSearch = 'true';
	 		var keyCode = (e.which) ? e.which : e.keyCode;
	 		if(keyCode == 13)
	 		{
				return CaptureEnterKey1(e);
				//return CaptureEnterKeySearch(e);
	 		}
	 		
	 		return true;
	 	
	 	 }
	 	 
	 	var focusedElement; 
	 	
		function CaptureEnterKey1(e,txtAreaCode,txtPrefix,txtPhoneNumber,pack)
		{

			var isNN = (navigator.appName.indexOf("Netscape")!=-1);
			var keyCode = (isNN) ? e.which : e.keyCode; 
			//initialisation
			if ("activeElement" in document)
			{ 
			focusedElement = document.activeElement; //Si IE
			} 
			else  { 
			focusedElement = e ? e.explicitOriginalTarget : null;  // Si Firefox
			}
			

			if((isNNumeric(e) == 'true') && (isSearch == 'false') )
			{
				return true;
			}
			else if(keyCode == 13)
			{
				if (e.returnValue) 
				{
					e.returnValue = false;
					return false;
				} 
				else if (e.preventDefault) 
				{
					if(isSearch != 'true')
						getTNQueryString(txtAreaCode,txtPrefix,txtPhoneNumber,pack);
					else
					{
						SearchClick();
						isSearch = 'false';
					}
					e.preventDefault();
					return false;
				}
			
				e.cancel=true;
				if(isSearch != 'true')
					getTNQueryString(txtAreaCode,txtPrefix,txtPhoneNumber,pack);
				else
				{
					SearchClick();
					isSearch = 'false';
				}
				this.event.returnValue = false;	
				return false;
			}   
		  } 	
		  
		function NautoTab(input,len, e) 
		{	
			if (!isNNumeric(e))
				return false;
			
			clearTimeout(tMainPromo);
			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) && bAutotab) 
			{
				input.value = input.value.slice(0, len);
				input.form[(getIndex(input)+1) % input.form.length].focus();
			}
			bAutotab= true;
			return true;
		}
		
		bAutotab = true;
		
		function stopAutoTab()
		{
			bAutotab = 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 validatePhoneNumber(area_code, exchange, last4,isFlash)
		{
		      var numbers = new Array([area_code,3],[exchange,3],[last4,4]);
		      var valid = 1;
		             
		      //handle phone number validation
		      for (var i=0;i<numbers.length;i++)
		      {              
		          if(isNaN(numbers[i][0]) || String(numbers[i][0]).length!=numbers[i][1] || numbers[i][0]=="" || numbers[i][0]==null)
		          { 
			      if(isFlash == 'true')
	                         flashMain.alert(i);
		              valid = 0;
		              break;
		          }
		       }
		       return valid;
		}  
		
		var myimages=new Array()
		
		function preloadimages()
		{
			for (i=0;i<preloadimages.arguments.length;i++)
			{
				myimages[i]=new Image()
				myimages[i].src=preloadimages.arguments[i]
			}
		}
	
	
	     /*function WriteFlash(flashURL,flashID,flashControl,width,height,vars,params)
  	      {
              try
            	{
	        var so = new SWFObject(flashURL, flashID, width, height, "9", "#FFFFFF");
		  //  so.addParam("menu", params.menu);
		    so.addParam("scale", params.scale);
		    so.addParam("wmode", params.wmode);
		    so.addVariable("order",vars.order);
		    so.addVariable("thexml",vars.thexml);
    		
		        so.write(flashControl);
		    } catch(e){
		    //alert(e)
		    onFlashError();
		    }  		
  	      }  */
  	      
               function WriteFlash(flashURL,flashID,flashControl,width,height,vars,params)
               {
                try
                {
                                    var so = new SWFObject(flashURL, flashID, width, height, "9", "#FFFFFF");
                                    so.addParam("menu", params.menu);
                                    so.addParam("scale", params.scale);
                                    so.addParam("wmode", params.wmode);
                                    so.addVariable("order",vars.order);
                                    so.addVariable("thexml",vars.thexml);                                             
                                                so.addVariable("year",vars.year);            
                                                so.addVariable("month",vars.month);   
                                                so.addVariable("day",vars.day);               
                                                so.addVariable("hour",vars.hour);           
                                                so.addVariable("minute",vars.minute); 
                                                so.addVariable("second",vars.second); 
                                                
                                
                                        so.write(flashControl);
                                    } catch(e){
                                    //alert(e)
                                    onFlashError();
                                    }                          
                      }  

  	      
		function SearchClick()
		{
			var searchText = document.getElementById('searchField').value
			if((searchText.length == 0) || (searchText.toLowerCase() == 'type a question or keyword') ) 
			{
				alert('Please type a question or keyword');
				document.getElementById('searchField').focus();
				return ;
			}
			href = document.location.href.toLowerCase();
			if(href.indexOf('business') > -1)
			{
				document.location.href = "http://search.verizon.com/?tp=c&rv=b&q="+ searchText;
			}
			else if(href.indexOf('wireless') > -1)
			{
				document.location.href = "http://search.vzw.com/?q="+ searchText;
			}
			else
			{
				document.location.href = "http://search.verizon.com/?tp=r&rv=r&q="+ searchText;
			}
			
		}
		
		var height = 0;
		var width = 0;
		function open_popup(sURL,width,height)
	        {

                if(typeof(sURL)!='string')
                    window.open(sURL.link,sURL.title,"menubar="+sURL.menubar+",resizable="+sURL.resizeable+",width="+sURL.width+",height="+sURL.height);
                else if ((height > 0) && (width > 0))
                    window.open(sURL,"Popup","width="+ width +",height="+ height +",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
                else 
                    window.open(sURL,"Popup","width=562,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
                 
	        }
		
		function open_msg_popup(sURL)
	        {

                    window.open(sURL,"Popup","width=1050,height=650,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
                 
	        }
		
		function deleteCookie(name) 
		{
			if (getCookie(name).length > 0)
			{ 
				document.cookie = name + "=" + ';path=/;domain=.verizon.com' +
				//document.cookie = name + "=" + ';path=/' +
				";expires=Thu, 01-Jan-1970 00:00:01 GMT;";
				}
		}
		
		function getCookie(cookieName)
		{
			if (document.cookie.length>0)
			{
				cStart=document.cookie.indexOf(cookieName + "=");
				if (cStart!=-1)
					{ 
					cStart=cStart + cookieName.length+1; 
					cEnd=document.cookie.indexOf(";",cStart);
					if (cEnd==-1) cEnd=document.cookie.length;
					return unescape(document.cookie.substring(cStart,cEnd));
					} 
			}
			return "";
		}

		function setCookie(c_name,value,expiredays)
		{
			var exdate=new Date();
			var domain = document.domain;
			exdate.setDate(exdate.getDate()+expiredays);
			document.cookie=c_name+ "=" +escape(value)+ ';path=/;domain=.verizon.com'+
			//document.cookie=c_name+ "=" +escape(value)+ ';path=/'+
			((expiredays==null) ? ";" : ";expires="+exdate.toGMTString());
		}

		
		function SetHttpsURL(controlID)
		{
			url = document.getElementById(controlID).href;
			if(url.indexOf('http://') != -1)
				url = url.replace('http://','https://');
			if(setOnClick)
				ClickLink();
			document.getElementById(controlID).href = url;
		}
		
		
		

		function onFlashError()
		{
			setCookie('isFlashEnabled','false',null);
			document.location.href = document.location.href;
		}

		function createPopUp(e)
		{
			
			
			try{
			window.open (e.link,e.title,"menubar="+e.menubar+",resizable="+e.resizeable+",width="+e.width+",height="+e.height);	
			}
			catch(e)
			{
			alert(e);	
			}
			
		}
		
		function giveFocus()
		{
			if(navigator.appName == "Microsoft Internet Explorer")
			{
				document.getElementById("flashMovie").blur();
				document.getElementById("flashMovie").focus();
			}
		} 


		var count=0
		var index = 0;
		var t;
		var tDelay;
		var textScroll = '';
		var links = '';
		var scrollList = new Array();

		function timedCount()
		{
		try {
		    textScroll = scrollList[index];
		    objScroller = document.getElementById('scrollAnchor');
		    objScroller.innerHTML = textScroll;//.substring(0,count);
		    objScroller.href = links[index].href ;
		} catch(e){}
		try{	
		  	hbxName = links[index].name;
			hbxName = hbxName.substring(hbxName.indexOf('=')+1,hbxName.length);
		 }
		catch(e){hbxName = '';}
		hbxName = 'javascript:_hbLink("'+hbxName+'");';
		//if(index == 2)
		  //  hbxName += links[index].href.replace("javascript:","") + 'return false;';
		objScroller.onclick =  new Function(hbxName);

		count=count+1;
		if(count > textScroll.length+1)
		{
		  	
			waitTime(2);
			count = 0;
			index = index +1;
			if( index > scrollList.length-1)
				index = 0;
			tDelay = setTimeout("cancelDelay()",2000)
			return;
		}
		t=setTimeout("timedCount()",30);
		}

		function sNext()
		{
			stopCount();
			index++;
			if( index > scrollList.length-1)
				index = 0; 
			count = 0;
			timedCount();
		}
		function sPrevious()
		{
			stopCount();
			index--;
			if( index == -1)
				index = scrollList.length-1;
			count = 0;
			timedCount();
		}
		var date;
		function waitTime(mills)
		{
			stopCount();
			date = new Date();
			date.setMinutes(mills + date.getMinutes());
	
		}
		function cancelDelay()
		{
			var curDate = new Date();
			if(curDate <= date)
			{
				clearTimeout(tDelay);
				t=setTimeout("timedCount()",50);
			}
			else
			{
				tDelay = setTimeout("cancelDelay()",2000)
			}
		}

		function stopCount()
		{
		    clearTimeout(t);
		    clearTimeout(tDelay);
		}

		function pausePlay()
		{
  			pauseButton = document.getElementById('pauseplay');
     
 			   if(pauseButton.className.indexOf('sprite_ticker_play') != -1)
 			   {
			        stopCount();
			        timedCount();
					pauseButton.className = 'tick-pause-play sprite sprite_ticker_pause';
			        //pauseButton.src = pauseButton.src.replace('play','pause');
        
			    }
			    else
			    {
				    stopCount();
					pauseButton.className = 'tick-pause-play sprite sprite_ticker_play';
				    //pauseButton.src = pauseButton.src.replace('pause','play');
					
				}
		}

		
		//scrollList = document.getElementById('txt').value.split('#');
		function startScroller()
		{
		    links = document.getElementById('scrollerLinks').getElementsByTagName('a');
		    
		    for(var i = 0;i < links.length ;i++)
		    {
		        scrollList[scrollList.length] = links[i].innerHTML;
		    }
	
		    if(scrollList.length > 0)
		        timedCount();
				
		}


		function seturl()
		{
			var obj = document.getElementById('verizon_prods')
			_hbLink(obj.options[obj.selectedIndex].getAttribute('hbx'));
			document.location.href = obj.options[obj.selectedIndex].getAttribute('url')

		}
		
		var imgPlay = '/content/verizonglobalhome/images/hero_btnplay.gif';
		var imgPause = '/content/verizonglobalhome/images/hero_btnpause.gif';

		var promoNumber = 1;
		function findPromos()
		{
			
			try{
				for(var i = 1; i < 10 ;i++)
				{
					pObj = document.getElementById('promo'+i);
					var id=pObj.id;
					promoNumber = i;
				}
			 }
			catch(e)
			{ }
	
		}

		

		function show_feat(div_id,timer) 
		{
    			// hide all the divs
			for(var i = 1; i < promoNumber+1 ;i++)
			{
	    			document.getElementById('promo'+i).style.display = 'none';
				document.getElementById('pausePromo' + i).src= imgPause;
			}
    
    			// show the requested div
    			document.getElementById(div_id).style.display = 'block';

			if(timer == null)
			{
			   var i =  div_id.substring(div_id.length,div_id.length-1)
				iMainPromo = parseInt(i,10) -1;
				
			
			//clearTMainPromo();
			clearTimeout(tMainPromo);
			timeMainPromo();
			cName = 'pausePromo' + (iMainPromo + 1);
			//if(cName == 'pausePromo4')
			if(iMainPromo  == promoNumber )	
				cName = 'pausePromo1';
			document.getElementById(cName).src= imgPause;
			}
		
		}	

		function clearTMainPromo()
		{
			cName = 'pausePromo' + iMainPromo ;
			imgObj = document.getElementById(cName);
			if(imgObj.src.indexOf('play') != -1)
			{
				document.getElementById(cName).src= imgPause;
				//show_feat("promo" + (iMainPromo + 2)+"");
				timeMainPromo();
				document.getElementById(cName).alt='Pause';
			}
			else
			{
				document.getElementById(cName).src= imgPlay;
				clearTimeout(tMainPromo);
				document.getElementById(cName).alt='Play';
			}
		}
		var tMainPromo;
		var iMainPromo = 0;

		function timeMainPromo()
		{
			iMainPromo++;
			if(iMainPromo == (promoNumber+1))
				iMainPromo = 1;
			show_feat("promo" + iMainPromo+"","Y");
						
			tMainPromo=setTimeout("timeMainPromo()",12000);

		}

		function DeleteSignOutCookies()
		{
			cookieNames = new Array("dotcomsid","SMSESSION","foryourhome","vzreg","vzUserType","RegistrationApp","VZBP","BPSPANISH");

			for(var i =0;i < cookieNames.length;i++)
				deleteCookie(cookieNames[i]);
		}


