function changeLocation()
    {
	var obj = document.getElementById ("RVOchngLocIFrame")
//	obj.src="http://www25.verizon.com/content/learnshop/testpage.aspx"
	obj.src="https://" + document.domain + "/FORYOURHOME/GOFLOW/newconnect/changelocations.aspx?change=Y"

    }

/*******To Include Trim() functionality********/
if(typeof String.prototype.trim !== 'function') 
{ 
    String.prototype.trim = function() 
    { 
        return this.replace(/^\s+|\s+$/, '');  
    } 
}
/**********************************************/

function getRVCookie(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 setRVCookie(c_name,value)
{
	var cstr= value;
	//alert("AjaxCallSetCookieValue: " + cstr)
	AjaxCallSetCookie(cstr);
	//ashokvar cookieVal = document.getElementById('hdnRVO').value; 
	var cookieVal = AjaxCallGetCookie()
	//alert('cookieVal' + cookieVal); 
	var TotURLs = cookieVal.split('^')
	//alert('TotURLs' + TotURLs); 
	if(TotURLs.length>10)
	{
		//alert('inside');
	    var arrTemp = new Array();
	    var str = "";
	    for(i=0;i<TotURLs.length;i++)
	    {
	        if(TotURLs[i].trim().length>0)
	            arrTemp[i] = TotURLs[i];
	        if(i==9)
	            break
	    }
	    for(i=0;i<arrTemp.length;i++)
	    {
	        if(str=="")
	        {
	            str = arrTemp[0] + "^";
	        }
	        else
	        {
	            str = str + arrTemp[i] + "^";
	        }
	    }
    	try {		
			//alert('str' + str);
			AjaxCallSetCookie(str);
		} catch(e) {

        }		
	}
}

var lqreq1=false;
function AjaxCallSetCookie(cvalue)
 { 
   //alert('Here');
    var str = cvalue;
	//alert('str' +  str);
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			lqreq1 = new XMLHttpRequest();
        } catch(e) {
			lqreq1 = false;
        }
    } else if(window.ActiveXObject) {
       	try {
        	lqreq1 = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		lqreq1 = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		lqreq1 = false;
          		
        	}
		}
    }
	if(lqreq1) 
	{	   
	//alert('Hello'); 
            var  url = "/content/verizonglobalhome/setValues.aspx?getVal=" + str;   
			lqreq1.open("POST", url , false);
			lqreq1.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			lqreq1.send("");
		}
	}
 function AjaxCallGetCookie()
 { 
	var lqreq1;
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			lqreq1 = new XMLHttpRequest();
        } catch(e) {
			lqreq1 = false;
        }

    } else if(window.ActiveXObject) {
       	try {
        	lqreq1 = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		lqreq1 = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		lqreq1 = false;
          		
        	}
		}
    }
	if(lqreq1) 
	{	   
	//alert('Hello'); 
            var  url = "/content/verizonglobalhome/setValues.aspx?getVal1=1";   
			lqreq1.open("POST",url,  false);
	    lqreq1.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	    lqreq1.send("");
		if(lqreq1.readyState == 4)
                {
					//alert(lqreq1.readyState);
                    if(lqreq1.status == 200)
                    {
                        return lqreq1.responseText; 
						//alert(retval);
                    }
                }
		}
	}

function CaptureId(obj)
{ 

    var atemp=""
    var btemp=""
    var title_price = "";
    title_price = obj.split(',') //title_price[1]--> Title, title_price[2]--> Price
    var cookieContent = "";
    var newCookieContent = "";
	var pthDomain = ";path=/;domain=.verizon.com";
	var expdays = 30;	
	var expdate=new Date();
	expdate.setDate(expdate.getDate()+expdays);

    obj = obj.replace(/<!--LN-->/g,"") 
    obj = obj.replace(/<!--TS-->/g,"")
    obj = obj.replace(/<!--SP-->/g,"")
    if(obj.toLowerCase().indexOf('not')!=-1 && obj.toLowerCase().indexOf('available')!=-1 )   
        return
    //ashokvar cookieVal = document.getElementById('hdnRVO').value;AjaxCallGetCookie
    

    
    var cookieVal = AjaxCallGetCookie()
    if(cookieVal.indexOf("^")==-1 && cookieVal.indexOf("<div")>-1)
	{
		cookieVal = "";
	}
	else if(cookieVal.indexOf("^")>-1 && cookieVal.indexOf("<div")>-1)
	{
		atemp = cookieVal.split('^');
		//alert(atemp.length)
		for(var i=0;i<=atemp.length-1;i++)
        	{
			//alert(atemp[i])
			if(atemp[i].indexOf("<div")==-1)
			{
				btemp = btemp + atemp[i] + "^";
			}
		}
		cookieVal = btemp;
	}
    //alert("cookieValAjaxCallGetCookie: "+ cookieVal)
    if(cookieVal.trim().length>0)
    {
        cookieContent = cookieVal.split('^')
        for(var i=0;i<=cookieContent.length-1;i++)
        {
			//alert('cookieContent.i :' + cookieContent[i]);
            //alert(title_price[1].toLowerCase()+","+title_price[2].toLowerCase())
            if(cookieContent[i].length>0)
            {
                var CC = cookieContent[i].toLowerCase()
                CC = CC.replace("+"," ")
                CC = CC.replace("+"," ")
                var titleloc = title_price[1].toLowerCase()
                titleloc = titleloc.replace("+"," ")
                titleloc = titleloc.replace("+"," ")
                if(CC.indexOf(titleloc.replace("","")+","+title_price[2].toLowerCase())!=-1 || CC.indexOf(titleloc+",$"+title_price[2].toLowerCase())!=-1)
                {
                }
                else
                {
                    newCookieContent = newCookieContent + cookieContent[i] + "^";
					//alert('newCookieContent :' + newCookieContent);
                }
                /*if(cookieContent[i].toLowerCase().indexOf(title_price[1].toLowerCase().replace("","")+","+title_price[2].toLowerCase())!=-1 || cookieContent[i].toLowerCase().indexOf(title_price[1].toLowerCase()+",$"+title_price[2].toLowerCase())!=-1)
                {
                }
                else
                {
                    newCookieContent = newCookieContent + cookieContent[i] + "^";
					//alert('newCookieContent :' + newCookieContent);
                }*/
            }
        }
        cookieVal = newCookieContent;
		//alert('cookieVal :' + cookieVal);
    }
    var urlInfoRep = document.location + "";
	//alert('urlInfo :' + urlInfo.indexOf("#"));
	if(urlInfoRep.indexOf("#") != -1)
	{
		urlInfoRep = urlInfoRep.replace("#","@");
		var urlInfo = obj + '*' + (urlInfoRep + "").substring((urlInfoRep + "").indexOf("/",13));
	}
	else
	{
		var urlInfo = obj + '*' + (document.location + "").substring((document.location + "").indexOf("/",13));
	}
	
	//alert('urlInfo' + urlInfo);
	//var urlInfo = (document.location + "").substring((document.location + "").indexOf("/",13));
	
    //For tacking HBX we set this below Cookie, Start
    var strURL = document.location + ""; 
    var strGHP = strURL.split('/')
    if(strGHP.length==3 || strGHP.length==4)
    {
        document.cookie="CustTrackPage=" + "GHP" + pthDomain + ";expires="+expdate.toGMTString();
    }
    else if(strURL.toLowerCase().indexOf('aboutfios')!=-1)
    {
        document.cookie="CustTrackPage=" + "AboutFiOS" + pthDomain + ";expires="+expdate.toGMTString();
    }
    else if(strURL.toLowerCase().indexOf('bundles')!=-1)
    {
        document.cookie="CustTrackPage=" + "Bundles" + pthDomain + ";expires="+expdate.toGMTString();
    }
    else if(strURL.toLowerCase().indexOf('fiostv')!=-1)
    {
        document.cookie="CustTrackPage=" + "FiOSTV" + pthDomain + ";expires="+expdate.toGMTString();
    }
    else if(strURL.toLowerCase().indexOf('fiosinternet')!=-1)
    {
        document.cookie="CustTrackPage=" + "FiOSInternet" + pthDomain + ";expires="+expdate.toGMTString();
    }
    else if(strURL.toLowerCase().indexOf('highspeedinternet')!=-1)
    {
        document.cookie="CustTrackPage=" + "HSI" + pthDomain + ";expires="+expdate.toGMTString();
    }
    else if(strURL.toLowerCase().indexOf('phone')!=-1)
    {
        document.cookie="CustTrackPage=" + "Phone" + pthDomain + ";expires="+expdate.toGMTString();
    }
    else if(strURL.toLowerCase().indexOf('directv')!=-1)
    {
        document.cookie="CustTrackPage=" + "DirecTV" + pthDomain + ";expires="+expdate.toGMTString();
    }

    if(cookieVal.indexOf(urlInfo) == -1)
        setRVCookie('RecentlyVisitedOffers',urlInfo+'^' +cookieVal);
}
//CaptureId('testing purpose')
