gn_iframe = 'https://globalnav.vzw.com/blank.html';	//needed to fix IE6 issue

function nav_gen(oldUrl, newUrl) {
	
	if (typeof(pageWidth) == 'undefined') {		//pageWidth was not defined
		alert('You must define the pageWidth variable!');
		return false;
	}
	var navSize = (pageWidth == 1024) ? '1024' : '760';
	if (window.XMLHttpRequest) {
		navReq = new XMLHttpRequest();
		if (navReq.overrideMimeType) {
			navReq.overrideMimeType('text/html');
		}
	} else if (window.ActiveXObject) {
		navReq = new ActiveXObject('Microsoft.XMLHTTP');
	}
	navReq.open('GET', '/rlp_globalnav/parser.aspx?navSize='+navSize, false);
	navReq.send(null);
	if (navReq.status == 200) {
		document.getElementById('navigation').innerHTML = navReq.responseText;
		gn_init();
		if (oldUrl != undefined) {
			updateEspNav(oldUrl, newUrl);
		}
	}
}

/*  This code handles converting the Espanol link from the default Spanish home to the device specific page */
var theInt;

function updateEspNav(oldUrl, newUrl) {
	var theHeaderNav = document.getElementById('gn_header_links');
	var curSrc = String(document.location).toLowerCase();
	var newSrc = curSrc.replace('/'+oldUrl+'/', '/../'+newUrl+'/');

	if (theHeaderNav == null || theHeaderNav == 'undefined') {
		theInt = 0;
	} else {
		setEspanolNav(theHeaderNav,newSrc);
	}
}

function setEspanolNav(theHeaderNav,newSrc) {
	var trigger = false;
	var theLI = theHeaderNav.getElementsByTagName('li');
	for (i = 0; i < theLI.length; i++) {
		var theLink = theLI[i].getElementsByTagName('a');
		for (j = 0; j < theLink.length; j++) {
			if (theLink[j].href == "http://espanol.vzwshop.com/" || theLink[j].href == "http://espanol.vzw.com/enes/b2c/index.html") {
				theLink[j].href = newSrc;
				trigger = true;
				break;
			}
		}
		if (trigger == true) {
			break;
		}
	}
}
function switchLanguage() {
	//dummy function to override motionpoint
}