	
	var hasRequestedVersion;
	function xreplace(checkMe,toberep,repwith){ 
		var temp = checkMe; 
		var i = temp.indexOf(toberep); 
		while(i > -1){ 
			temp = temp.replace(toberep, repwith); 
			i = temp.indexOf(toberep); 
		} 
		return temp; 
	}
								
	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 get(source)
	{
		return source;
	}

	function LoadXML()
	{
		if(xp1_var != '')
		{
			if(CreateXMLDOM(xp1_var) == false) {
				CreateXMLDOM(defaultXML);
			}				
		}	
		else {
			CreateXMLDOM(defaultXML);		
		}
	}

	function CreateXMLDOM(xml){
		if (window.ActiveXObject)
		{
			doc=new ActiveXObject("MSXML2.DOMDocument");
			doc.async="false";
			doc.loadXML(xml);	
			var atNodes = doc.selectNodes("/home/heroshot");		
			if ((atNodes[0] == null) ) return false;	
		}
		else
		{
			oParser = new DOMParser();	
			var xmlcontent='';		
			var strXml=ConvertBR(xml);	
			
			strXml = strXml.replace(/>heroshot/g,'><heroshot');
			var splt = strXml.split("<heroshot");
			strXml='';
			if(splt.length >2)
			{		
				for(var j=1;j<splt.length;j++)
				{
					var str= splt[j];
					strXml = strXml + "<heroshot " +  str ;
				}	
				strXml= "<home>" + strXml ;
			}
			else
			{	
				strXml = xml;
			}
			
			xmlcontent =  strXml;	
			doc = oParser.parseFromString(xmlcontent, "text/xml");		
			if (doc.documentElement.nodeName != "parsererror")
			{
				var rootNode=doc.documentElement;
				var atNodes = rootNode.getElementsByTagName("heroshot")[0];	
				heroShot=rootNode.getElementsByTagName("heroshot")[0].getAttribute("backgroundimage");
				if (( heroShot == null) || (heroShot == 'undefined')) return false;
			}
			else {				
				return false;			
			}
		}	
		return true;
	}


		
	function getMainPage(thumbnail)
	{
		tnIndx =thumbnail;	  
		if (window.ActiveXObject)
		{  
			var atNodes = doc.selectNodes("/home/heroshot");
			
			if (atNodes[tnIndx] != null) 
			{
			    heroShot=atNodes[tnIndx].getAttribute("backgroundimage");
	 		    thumbnailName=atNodes[tnIndx].getAttribute("thumbnail");
	 		}
	 		if (atNodes[0] != null) 
	 		{
			    //thumbnailName=thumbnailName.toLowerCase();
			    thumbnail1Name=atNodes[0].getAttribute("thumbnail");
			    thumbnail1Name=thumbnail1Name.toLowerCase();
			}
			if(bloadedDefault != true)
			{
			    if (atNodes[1] != null) 
			    {			
				thumbnail2Name=atNodes[1].getAttribute("thumbnail");
				thumbnail2Name=thumbnail2Name.toLowerCase();
				/*  get 2nd heroshot product type */
				var promoNode2=atNodes[1].selectSingleNode("promo")
				LQproduct2=promoNode2.getAttribute("product");
				LQproduct2=LQproduct2.toLowerCase();
				}
			}
			var promoNode = "";
			var taglineNode = "";
			if (atNodes[tnIndx] != null)
			{
			    heroLink=atNodes[tnIndx].getAttribute("link");
			    promoNode=atNodes[tnIndx].selectSingleNode("promo");
			    LQposition=promoNode.getAttribute("position");
			    if(LQposition=="BTM Middle")
			    {
				    LQposition="btmmdl";
			    }			
			    LQproduct=promoNode.getAttribute("product");
			    LQproduct=LQproduct.toLowerCase();
			    LQlink=promoNode.selectSingleNode("link").text;
			    BtmPromoHead=promoNode.selectSingleNode("head").text;
			    BtmPromoDesc=promoNode.selectSingleNode("desc").text;
			    taglineNode=atNodes[tnIndx].selectSingleNode("tagline");
			    taglinehead=taglineNode.selectSingleNode("head").text;

			    if(!hasRequestedVersion && (thumbnailName =="D11"  || thumbnailName =="d11" ))
				    taglinedesc= "";
			    else
				    taglinedesc=taglineNode.selectSingleNode("desc").text;

			    taglink=taglineNode.selectSingleNode("link").text;	
			}
		}
		else 
		{   				
			var rootNode=doc.documentElement;
			var atNodes = "";
			if (atNodes[tnIndx] != null)
			{
			atNodes = rootNode.getElementsByTagName("heroshot")[tnIndx];	
			heroShot=rootNode.getElementsByTagName("heroshot")[tnIndx].getAttribute("backgroundimage");
			thumbnailName=rootNode.getElementsByTagName("heroshot")[tnIndx].getAttribute("thumbnail");	
			thumbnailName=thumbnailName.toLowerCase();	
			}
			
			if (atNodes[0] != null)
			thumbnail1Name=rootNode.getElementsByTagName("heroshot")[0].getAttribute("thumbnail");
			
			if(bloadedDefault != true)
			{
			    if (atNodes[1] != null)
			    {
				thumbnail2Name=rootNode.getElementsByTagName("heroshot")[1].getAttribute("thumbnail");//1
				thumbnail2Name=thumbnail2Name.toLowerCase();				
				}
			}
			var promoNode = "";
			var taglineNode = "";
			if (atNodes[tnIndx] != null)
			{
			    heroLink=rootNode.getElementsByTagName("heroshot")[tnIndx].getAttribute("link");
			    promoNode =rootNode.getElementsByTagName("heroshot")[tnIndx].getElementsByTagName("promo");
			    LQposition=rootNode.getElementsByTagName("heroshot")[tnIndx].getElementsByTagName("promo")[0].getAttribute("position");
			    if(LQposition=="BTM Middle")
			    {
				    LQposition="btmmdl";
			    }		  
			    LQproduct=rootNode.getElementsByTagName("heroshot")[tnIndx].getElementsByTagName("promo")[0].getAttribute("product");
			    LQproduct=LQproduct.toLowerCase();
			    taglineNode=rootNode.getElementsByTagName("heroshot")[tnIndx].getElementsByTagName("tagline");
			    taglinehead=rootNode.getElementsByTagName("heroshot")[tnIndx].getElementsByTagName("tagline")[0].getElementsByTagName("head")[0].childNodes[0].nodeValue;

			    if(!hasRequestedVersion && (thumbnailName =="D11"  || thumbnailName =="d11" ))
				    taglinedesc= "";
			    else
				    taglinedesc=rootNode.getElementsByTagName("heroshot")[tnIndx].getElementsByTagName("tagline")[0].getElementsByTagName("desc")[0].childNodes[0].nodeValue;

			    taglink=rootNode.getElementsByTagName("heroshot")[tnIndx].getElementsByTagName("tagline")[0].getElementsByTagName("link")[0].childNodes[0].nodeValue;
			}
			/*  get 2nd heroshot product type */
			if (atNodes[1] != null)
			{
			    LQproduct2=rootNode.getElementsByTagName("heroshot")[1].getElementsByTagName("promo")[0].getAttribute("product");
			    LQproduct2=LQproduct2.toLowerCase();
			}
		}
	}

	function ConvertBR(input) 
	{
		var output = "";
		for (var i = 0; i < input.length; i++) {
		if ((input.charCodeAt(i) == 0) || (input.charCodeAt(i) == 13) || (input.charCodeAt(i + 1) == 10)) {
		i++;
		output += "";
		} else {
		output += input.charAt(i);
		}
	}
	return output;
	}

	function loadData1()
	{	
		if(document.getElementById("HdnHeroShot")!=null)
		{
			document.getElementById("HdnHeroShot").value=heroShot;
		}
		
		if(document.getElementById("HdnTagLine")!=null)
		{
			//document.getElementById("HdnTagLine").value=taglinehead;
			
		}

		if(document.getElementById("HdnTagLink")!=null)
		{
			document.getElementById("HdnTagLink").value=taglink+document.getElementById("HdnTagLink").value;
		}
		
		if(document.getElementById("HdnFiOSLQLink")!=null)
		{
		 	document.getElementById("HdnFiOSLQLink").value=document.getElementById("HdnFiOSLQLink").value;
			
		}
		if(document.getElementById("HdnDSLLQLink")!=null)
		{
			document.getElementById("HdnDSLLQLink").value=document.getElementById("HdnDSLLQLink").value;
			
		}
		if(document.getElementById("HdnFiOSAddrLQLink")!=null)
		{
			document.getElementById("HdnFiOSAddrLQLink").value=document.getElementById("HdnFiOSAddrLQLink").value;
			
		}
		if(document.getElementById("HdnDSLAddrLQLink")!=null)
		{
			document.getElementById("HdnDSLAddrLQLink").value=document.getElementById("HdnDSLAddrLQLink").value;
			
		}
	
	}
			
	function loadData2()
	{
		var edit=document.getElementById("HdnEdit").value;
				
		if(edit=="false" && document.getElementById("taglinehead")!=null)
		{
			document.getElementById("taglinehead").innerHTML = taglinehead;
		}
		
		if(edit=="false" && document.getElementById("taglinedesc")!=null)
		{
			document.getElementById("taglinedesc").innerHTML = taglinedesc;
		}	
		
		if(edit=="false" && document.getElementById("exploremore2")!=null && LQproduct=="dsl")
		{
			document.getElementById("exploremore2").style.visibility = "visible";
			document.getElementById("exploremore1").style.visibility = "hidden";
		}			
		else if(edit=="false" && document.getElementById("exploremore1")!=null)
		{
			document.getElementById("exploremore1").style.visibility = "visible";
			document.getElementById("exploremore2").style.visibility = "hidden";
		}
		if(edit=="false" && document.getElementById("HdnTagLink")!=null)
		{
		
			if(LQproduct=="dsl")
					document.getElementById("HdnTagLink").value= document.getElementById("HdnDSLLQLink").value; //heroLink+"http://www98.verizon.com/ForHomeDSL/channels/dsl/default.asp";
			if(LQproduct=="fios")
					document.getElementById("HdnTagLink").value=heroLink+"http://www98.verizon.com/content/consumerfios";
			if(LQproduct=="bundle")
					document.getElementById("HdnTagLink").value=heroLink+"https://www98.verizon.com/ForYourHome/sas/sas_Freedom.aspx";
        
			if(taglink != null)
			{
			    document.getElementById("HdnTagLink").value = taglink ;
			    var splt = taglink.split('.verizon.com');
			    if(splt[1] != null && splt[1].length >0)
			    {
				    var xplus1Link =  splt[0].substring(0,splt[0].length-5);							
				    document.getElementById("HdnTagLink").value = xplus1Link + window.location.hostname + splt[1];//replace host name based on environ - taglink
			    }
			}
		}
		
		/*--- new LQ box position, either left aligned or centered ---*/
		document.getElementById("loopqual1").style.display="";
		/*if(LQposition=="left"){
			document.getElementById("loopqual1").style.marginLeft = "0px";
		}else if(LQposition=="center"){
			document.getElementById("loopqual1").style.marginLeft = "158px";
		}else{
			document.getElementById("loopqual1").style.visibility = "hidden";
		}*/

		if(LQproduct == "free" || LQproduct=="bundle")
			document.getElementById("loopqual1").style.display="none";
		
		if(thumbnailName =="D10" || thumbnailName =="d10")
		{
			document.getElementById("loopqual1").style.marginTop="45px";	
		}
		
		if(thumbnailName =="D1" || thumbnailName =="d1")
		{
			document.getElementById("loopqual1").style.display="none";
			document.getElementById("loopqual_d1").style.display="";	
		}

		if(thumbnailName =="D3" || thumbnailName =="d3")
		{
			document.getElementById("loopqual1").style.marginTop="40px";	
			document.getElementById("loopqual1").style.marginLeft="290px";	
		}

		if(thumbnailName =="D4" || thumbnailName =="d4")
		{
			document.getElementById("loopqual1").style.marginTop="-55px";	
		}

		if(thumbnailName =="D2" || thumbnailName =="d2")
		{
			document.getElementById("loopqual1").style.marginTop="25px";			
		}
		if(thumbnailName =="D2B" || thumbnailName =="d2b")
		{
			document.getElementById("loopqual1").style.marginTop="7px";			
		}
		if(thumbnailName =="D6" || thumbnailName =="d6")
		{
			document.getElementById("loopqual1").style.marginTop="10px";			
		}
		if(thumbnailName =="D7" || thumbnailName =="d7")
		{
			document.getElementById("loopqual1").style.marginTop="-65px";	
			document.getElementById("loopqual1").style.marginBottom ="0";
		}
		if(thumbnailName =="D7B" || thumbnailName =="d7b")
		{
			document.getElementById("loopqual1").style.marginTop="-58px";	
			document.getElementById("loopqual1").style.marginBottom ="0";
		}
		
		if(thumbnailName =="D9" || thumbnailName =="d9")
		{
			document.getElementById("loopqual1").style.marginTop="30px";	
		}

		if(thumbnailName =="D8" || thumbnailName =="d8")
		{
			document.getElementById("loopqual1").style.marginTop="10px";	
		}

				
		if(LQproduct =="dsl" && (thumbnailName =="D5" || thumbnailName =="d5"))
		{
			document.getElementById("loopqual1").style.display="none";
			document.getElementById('res_per').align="center";
			document.getElementById("loopqual_d5").style.display="";
		}

		if(!hasRequestedVersion && LQproduct =="dsl" && (thumbnailName =="D11" || thumbnailName =="d11"))
		{
			document.getElementById("loopqual1").style.display="none";
			document.getElementById('res_per').align="center";
			document.getElementById("loopqual_d11").style.display="";
		}
		
		
		
		if(hasRequestedVersion && LQproduct =="dsl" && (thumbnailName =="D11" || thumbnailName =="d11"))
		{
			document.getElementById("loopqual1").style.display="none";
			document.getElementById("loopqual_d11").style.display="none";
		}
		
		if(LQproduct =="bb4")
		{
			document.getElementById("loopqual1").style.display="none";
			document.getElementById("loopqual_bb4").style.display="";
		}
		
		if (LQproduct=="ftv" && (thumbnailName =="FTV1" || thumbnailName =="ftv1")){
			document.getElementById("loopqual1").style.display="none";
			document.getElementById("loopqual_ftv1").style.display="";
		}
		
		if (LQproduct=="ftv" && (thumbnailName =="FTV2" || thumbnailName =="ftv2")){
			document.getElementById("loopqual1").style.display="none";
			document.getElementById("loopqual_ftv2").style.display="";
		}
				
		document.getElementById("staticcontent").style.display="block";

	}
	
	function loadLeftchips() {
		var edit=document.getElementById("HdnEdit").value;
		var sSpantag_open = "<span style='cursor: hand;'>";
		var sSpantag_close = "</span>";
		
		if(edit=="false" && document.getElementById("leftchip1")!=null && document.getElementById("leftchip2")!=null)
		{
			if(LQproduct=="bundle") {
				document.getElementById("leftchip1").innerHTML = sSpantag_open + document.getElementById("hdnlc_bundle").innerHTML + sSpantag_close;
			}
			else if(LQproduct=="dsl") {
				document.getElementById("leftchip1").innerHTML = sSpantag_open + document.getElementById("hdnlc_dsl").innerHTML + sSpantag_close;
			}
			else if(LQproduct=="fios") {
				document.getElementById("leftchip1").innerHTML = sSpantag_open + document.getElementById("hdnlc_fios").innerHTML + sSpantag_close;
			}
			else if(LQproduct=="ftv") {
				document.getElementById("leftchip1").innerHTML = sSpantag_open + document.getElementById("hdnlc_ftv").innerHTML + sSpantag_close;
			}
			else if(LQproduct=="free") {
				document.getElementById("leftchip1").innerHTML = sSpantag_open + document.getElementById("hdnlc_free").innerHTML + sSpantag_close;
			}
			
			loadLeftchip2();
		}
		
		//load leftchip3
		if(edit=="false" && document.getElementById("leftchip3")!=null)
			document.getElementById("leftchip3").innerHTML = sSpantag_open + document.getElementById("hdnlc_movers").innerHTML + sSpantag_close;
	}
	
	function loadLeftchip2() {
		var edit=document.getElementById("HdnEdit").value;
		var sSpantag_open = "<span style='cursor: hand;'>";
		var sSpantag_close = "</span>";
		
		if(edit=="false" && document.getElementById("leftchip2")!=null)
		{
			if(LQproduct2=="bundle") {
				document.getElementById("leftchip2").innerHTML = sSpantag_open + document.getElementById("hdnlc_bundle").innerHTML + sSpantag_close;
			}
			else if(LQproduct2=="dsl") {
				document.getElementById("leftchip2").innerHTML = sSpantag_open + document.getElementById("hdnlc_dsl").innerHTML + sSpantag_close;
			}
			else if(LQproduct2=="fios") {
				document.getElementById("leftchip2").innerHTML = sSpantag_open + document.getElementById("hdnlc_fios").innerHTML + sSpantag_close;
			}
			else if(LQproduct2=="ftv") {
				document.getElementById("leftchip2").innerHTML = sSpantag_open + document.getElementById("hdnlc_ftv").innerHTML + sSpantag_close;
			}
			else if(LQproduct2=="free") {
				document.getElementById("leftchip2").innerHTML = sSpantag_open + document.getElementById("hdnlc_free").innerHTML + sSpantag_close;
			}
			
		}
	}
	
	function loadimages() {
		var edit=document.getElementById("HdnEdit").value;
		
		if(edit=="false" && document.getElementById("thumbnail1")!=null)
		{
			if(tnIndx==0)
			{
				document.getElementById("thumbnail1").src = "../Images/"+thumbnail1Name+"_thumbOn.jpg";
				if(bloadedDefault==false)
				{ 
				document.getElementById("thumbnail2").src = "../Images/"+thumbnail2Name+"_thumbOff.jpg";
				document.getElementById("thumbnail3").src = "../Images/"+thumbnail3Name+"_thumbOff.jpg";
				}
				
			}
			if(tnIndx==1)
			{
				document.getElementById("thumbnail1").src = "../Images/"+thumbnail1Name+"_thumbOff.jpg";
				if(bloadedDefault==false)
				{
				document.getElementById("thumbnail2").src = "../Images/"+thumbnail2Name+"_thumbOn.jpg";
				document.getElementById("thumbnail3").src = "../Images/"+thumbnail3Name+"_thumbOff.jpg";
				}
			}
			if(tnIndx==2)
			{
				document.getElementById("thumbnail1").src = "../Images/"+thumbnail1Name+"_thumbOff.jpg";
				if(bloadedDefault==false)
				{
				document.getElementById("thumbnail2").src = "../Images/"+thumbnail2Name+"_thumbOff.jpg";
				document.getElementById("thumbnail3").src = "../Images/"+thumbnail3Name+"_thumbOn.jpg";
				}
			}
			
		}
		
		if(edit=="false" && document.getElementById("maintbl")!=null)
		{
			var browserString = navigator.userAgent;
			var browserName = browserString.substring(browserString.indexOf('Safari'),browserString.indexOf('Safari')+6);
			
			if (browserName == 'Safari') {
				document.getElementById("maintbl").setAttribute("background", "/Residential/Images/"+thumbnailName+"_on.jpg");
			}
			else {
				document.getElementById("maintbl").style.background = "#fff url(/Residential/Images/" + thumbnailName+"_on.jpg) no-repeat left top;";
			}
					
		}
		
	}
			
	function URLDecode(psEncodeString) 
	{
		return unescape(psEncodeString); 
	}

	function Redirect1()
	{
		var link=document.getElementById("HdnHeroShotLink").value;
		document.location.href=URLDecode(link);
	}
	function RedirectTagLink()
	{					
		/* WSS tracking code */		
		if(LQproduct=="dsl")
			_hbLink('Per_DSLLearn');
		else if ((LQproduct=="fiostv") || (thumbnailName.toLowerCase()=="ftv1"))
			_hbLink('Per_FiOSTVLearn');
		else if(LQproduct=="fios")
			_hbLink('Per_FiOSNetLearn');
		else if(LQproduct=="free")
			_hbLink('Per_FreeLearn');
		else
			_hbLink('Per_BundleLearn');
		
		var splt = 	taglink.split('.verizon.com');
		if(splt[1] != null && splt[1].length >0)
		{
			var xplus1Link =  splt[0].substring(0,splt[0].length-5);							
			taglink = xplus1Link + window.location.hostname + splt[1];//replace host name based on environ - taglink
		}	
		var link=document.getElementById("HdnTagLink").value;	  
		document.location.href=URLDecode(taglink);
	}

	
