// ---------------------------  Jump to Href  --------------------------- // 

function go(value){
	window.location.href=value;
}


// ---------------------------  Jump to Href --------------------------- // 




// ---------------------------  Announcements  --------------------------- // 

function announcementDate(genDateone){
	if  (genDateone != '')  {
		 document.write(genDateone);
 	}
	else {
		 document.write('Ongoing');
	} 
}

// ---------------------------  End Announcements --------------------------- // 

// ---------------------------  Change Images  --------------------------- // 

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;



// ---------------------------  End Change Images --------------------------- // 
// ---------------------------  Start Split Current URL --------------------------- // 

function splitWCMURL(currURL) {
	var wcmContext = new Array();
	wcmContext = currURL.split('WCM_GLOBAL_CONTEXT=');
	//retrun the WCM Content Page
	return wcmContext[1];
}
// ---------------------------  END Split Current URL --------------------------- // 


// ---------------------------  Show Hide Div --------------------------- // 
currentDiv = "0";

function showDiv(layerName) {
	hideDiv(currentDiv);
	setElementProperty(layerName, 'visibility', 'visible');
	currentDiv=layerName;
}



function hideDiv(layerName){	
	if (currentDiv != "") {
		setElementProperty(currentDiv, 'visibility', 'hidden');
		currentDiv="";
		}
}




function setElementProperty(elm, property, value){
	var thisElm = null;
	if(typeof(elm) == "object"){
		thisElm = elm;
	} else {
		thisElm = document.getElementById(elm);
	}
	if((thisElm != null) && (thisElm.style != null)){
		thisElm = thisElm.style;
		thisElm[property] = value;
	}
}

function compare(the_div)
{
	if(the_div == "all")
	{
		showAll()
	} else if (the_div == "none") {
		hideDivs()
		document.getElementById("00").style.display 	= ""
	} else {
		hideDivs()
		document.getElementById(the_div).style.display 	= ""
	}
}

// ---------------------------  Show Hide Div --------------------------- // 


// ---------------------------  Compare Phones Functionality --------------------------- // 



function checkboxChecker(form)
{

// set var checkboxChoices to zero

	var checkboxChoices = 0;
	var queryString= "";
	var siteAreaNum= 0;
	form.siteArea1.value="";
	form.siteArea2.value="";	
	form.siteArea3.value="";
	form.siteArea4.value="";
	
	// Loop from zero to the one minus the number of checkbox button selections
	for (counter = 0; counter < form.checkbox.length; counter++)
	{
		if (form.checkbox[counter].checked)
		{
			checkboxChoices = checkboxChoices + 1;
			
			//grab the site area of the content item

			var sitePath = form.checkbox[counter].value;
			var strLength = sitePath.length;			
			sitePath = sitePath.substr(0,strLength-1);			
			var lastString = sitePath.lastIndexOf("/");
			sitePath = (sitePath.substr(0,lastString));
			sitePath = sitePath.replace('+',' ');
			

			if (checkboxChoices == 1 ) 
			{
				form.siteArea1.value=sitePath;
				
			} else if (checkboxChoices == 2 ) 
			{
				form.siteArea2.value=sitePath;

			
			} else if (checkboxChoices == 3 ) 
			{
				form.siteArea3.value=sitePath;
	
			} else if (checkboxChoices == 4 ) 
			{
				form.siteArea4.value=sitePath;
			
			} 
		

		}
	}

	if (checkboxChoices == 0 )
	{	
		//if less then or equal to 4 cellphones have been selected redirect to the appliable page
		//location.href= form.redirect.value;
		msg="Please select up to only four selections.\n"
		alert(msg);
		return false;


	}
	
	if (checkboxChoices > 4 )
	{
		// If there were more than three selections made display an alert box
		msg="You're limited to only four selections.\n"
		msg=msg + "You have made " + checkboxChoices + " selections.\n"
		msg=msg + "Please remove " + (checkboxChoices-4) + " selection(s)."
		alert(msg);
		return false;
	}


	if (checkboxChoices <= 4 && checkboxChoices >= 1)
	{	
		//if less then or equal to 4 cellphones have been selected redirect to the appliable page
		//location.href= form.redirect.value;
		form.submit();
		return true;


	}


}




function changeFilter (form,objSelect)
{	
	//thecookie = getCookie('wcmMrktIDCookie');
	pmacookie = getCookie('wcmPmaIDCookie');
   	pmccookie = getCookie('wcmPmcIDCookie');

	if (objSelect.selectedIndex<=0) 
		return false;

	var objOpt = objSelect.options[objSelect.selectedIndex];	

	var filterCriteria;
	//var filterCriteriaLower;
	var wcmShowPhonesBy = new Array();
	//var wcmShowPhonesByLower = new Array();
	wcmShowPhonesBy = objOpt.value.split('ShowPhonesBy/');
	//wcmShowPhonesByLower = objOpt.value.split('showphonesby/');

	//retrun the WCM Content Page
	filterCriteria =  wcmShowPhonesBy[1];
	//filterCriteriaLower =  wcmShowPhonesByLower[1];
	//if(filterCriteria.equals("undefined")){
		//filterCriteria = filterCriteriaLower;
	//}

	//form.action = objOpt.value + "&mrktID=" +  thecookie
	if(filterCriteria == "View+All"){
		form.action = objOpt.value + "&pmapmc=Shared/" +  pmacookie;
	}
	else{
		form.action = objOpt.value + "&pmapmc=Shared/" +  pmacookie + ",Shared/" + filterCriteria ;
	}

	form.submit();
} 


function jumpTo(objSelect){
}

// ---------------------------  Compare Phones Functionality --------------------------- // 

// ---------------------------   Zipcode Functions --------------------------- // 

function submitZip(form)
{			
	// new customer
	if (form.zip.value=="" || form.zip.value.length < 5)
	{ 
		alert("Please enter a valid zipcode" );
		return false;
	}
	else
	{
		//it is a new customer and they have entered their zipcode 
		setCookie('wcmZipCodeCookie',form.zip.value,1);
		
		//append the zipcode and the redirect URL to the form
		queryString = appendZipRedirectURL(form.zip.value) 

		//this should be changed to the MAPS custom portlet zip
		//location.href=form.action.value + queryString;
		form.action =form.action +  queryString;
		return true;
	}
	
}





function appendZipRedirectURL(zipcode)
{

	var currURL = document.location.href;
	
	var redirectURL= new Array();
	
	redirectURL = currURL.split('redirectURL');
	
	var queryString = "?zipcode=" + zipcode + "&redirectURL" + redirectURL[1];
	
	return queryString; 

}


//this function is used when the user would like to change their zipcode 
function changeZip(form)
{
	if (form.zip.value=="")
	{ 
		alert("Please enter your zipcode" );
	}
	else
	{
		
		eraseCookie('wcmZipCodeCookie');
		eraseCookie('wcmMrktIDCookie');

		eraseCookie('wcmPmaIDCookie');
		eraseCookie('wcmPmcIDCookie');

		setCookie('wcmZipCodeCookie',form.zip.value,1);		
	
		//append the zipcode and the redirect URL to the form
		queryString = appendZipRedirectURL(form.zip.value);

		location.href=form.cust[0].value + queryString;
	}

}

// Function used to allow just number in a field when onKeyPress event is triggered
function justNumbers(e)
{
var keynum
var keychar
var numcheck

if(window.event) // IE
{
keynum = e.keyCode
}
else if(e.which) // Netscape/Firefox/Opera
{
keynum = e.which
}

if (keynum==8 || keynum==46 || keynum==13 || keynum==37 ||  keynum==39 || (keynum >47 && keynum < 58))
	{
		return true;
	}
else
	{
		return false;
	}

}






//this function should be called when the user needs to redirect to the zip code page

function changeZipRedirect(zipCodeRedirect)
{

	// If no Zipcode or MarketId has been set, then
	// Redirect the end user to the zipcode page and append the current WCM Page to the
	// URL

	var currURL = document.location.href;
   	var divestCookie = getCookie('wcmDivestIDCookie');

	var wcmContext = new Array();
	wcmContext = currURL.split('WCM_GLOBAL_CONTEXT');
	var redirectStr=wcmContext[1];
	if (redirectStr.match(divestCookie) != null )
	{	
		redirectStr=redirectStr.replace('connect/'+divestCookie,'connect/')
	}
	
	//Does the current URL have a market ID appended 
	if (redirectStr.match("pmapmc=") == null )
	{	
		// if not redirect to the zipcode page 
		document.location.href=zipCodeRedirect + "&redirectURL" + redirectStr;
		
	} else {
	
		// strip the maketID out of the URL 
		//var redirectURL = wcmContext[1].split('&pmapmc'); 
//		var redirectURL = redirectStr.split('?pmapmc'); 
		var redirectURL = redirectStr.split('&pmapmc'); 

		document.location.href=zipCodeRedirect +  "&redirectURL" + redirectURL[0]; 

	} 
		
}




//this Function should be called within the ComparePlans, ComparePhones, Plans and Phones Pages
 function checkZip(zipCodeRedirect)
{
       if (enabledCookies()) 
        {
   	 	
   		thecookie = getCookie('wcmMrktIDCookie');
  		zipCookie = getCookie('wcmZipCodeCookie') 

	   pmacookie = getCookie('wcmPmaIDCookie');
   	   pmccookie = getCookie('wcmPmcIDCookie');

		   if (thecookie==null || thecookie=='' || zipCookie==null || zipCookie==''  || pmacookie==null || pmacookie=='' || pmccookie==null || pmccookie=='' )
		   {
			changeZipRedirect(zipCodeRedirect);

		   }
	}
}




//this function should be called on all DPhones Page in Personal, Business and Spanish 
function checkZipAndQueryStringPhones(zipCodeRedirect,noCookieURLRedirect, cookieURLRedirect)
{

    if (enabledCookies()) {
	   thecookie = getCookie('wcmMrktIDCookie');
	   zipCookie = getCookie('wcmZipCodeCookie'); 

	   pmacookie = getCookie('wcmPmaIDCookie');
   	   pmccookie = getCookie('wcmPmcIDCookie');

		var pmapmcString= "";
	   if ( pmacookie!=null ||  pmacookie!=''){
//		 pmapmcString = "?pmapmc=Shared/" + pmacookie;
		 pmapmcString = "&pmapmc=Shared/" + pmacookie;	   }

	   //if (thecookie==null || thecookie=='' || zipCookie==null || zipCookie=='' || thecookie=='none' || pmacookie==null || pmacookie=='' || pmccookie==null || pmccookie=='' )
	   if (zipCookie==null || zipCookie=='' || pmacookie=='none' || pmccookie=='none' || pmacookie==null || pmacookie=='' || pmccookie==null || pmccookie=='' )
	   {
		changeZipRedirect(zipCodeRedirect);
	   }
	   else
	   {
		   //append MarketID and send off to the Phones and Accessories Page
		    document.location.href = cookieURLRedirect + pmapmcString;
	   }
 	} 
 	else //* Cookies Disabled //
 	{
		      document.location.href = noCookieURLRedirect; 
 	}
}



function checkMarketNone()
{
	   thecookie = getCookie('wcmMrktIDCookie');

	   pmacookie = getCookie('wcmPmaIDCookie');
   	   pmccookie = getCookie('wcmPmcIDCookie');

	   if ( thecookie=='none')
	   {
		//document.write("<p style=color:red>The zipcode entered has returned no phones. Please enter another zipcode </p>");
	   }

	   if ( pmacookie=='none'|| pmccookie=='none')
	   {
		document.write("<p style=color:red>The zipcode entered has returned no results. Please enter another zipcode. </p>");
	   }
}




//this function should be called on all ShowPhonesBy Pages
function checkZipAndQueryString(zipCodeRedirect,noCookieURLRedirect)
{
    if (enabledCookies()) {
	   thecookie = getCookie('wcmMrktIDCookie');
	   zipCookie = getCookie('wcmZipCodeCookie') 

	   pmacookie = getCookie('wcmPmaIDCookie');
   	   pmccookie = getCookie('wcmPmcIDCookie');

		var pmapmcString= "";
	   if ( pmacookie!=null ||  pmacookie!='' ){
//		 pmapmcString = "?pmapmc=Shared/" + pmacookie;
		 pmapmcString = "&pmapmc=Shared/" + pmacookie;
	   }

	   //if (thecookie==null || thecookie=='' || zipCookie==null || zipCookie=='' || thecookie=='none' || pmacookie==null || pmacookie=='' || pmccookie==null || pmccookie=='' )
	   if (zipCookie==null || zipCookie=='' || pmacookie=='none' || pmccookie=='none' || pmacookie==null || pmacookie=='' || pmccookie==null || pmccookie=='' )
	   {
		changeZipRedirect(zipCodeRedirect);
	   }
	   else
	   {
		   //check if the zipcode is attached to the URL
		   var currURL= document.location.href;

		   //check if the zip has not been appended to the URL, append the zipcode to the URL and refresh the current page with the zipcode on it.
		   if (currURL.match("pmapmc=") == null )
		   {
			//document.location.href = currURL + "&mrktID=" + thecookie;
			document.location.href = currURL + pmapmcString;
		   }
		   else if (currURL.match(".gif") != null )
		   {
		      //if it finds a .gif remove it from the URL
		      currURL = currURL.replace(".gif", "")
		      document.location.href = currURL; 
		  }

	   }
 	} 
 	else //* Cookies Disabled //
 	{
		      document.location.href = noCookieURLRedirect; 
 	}
}


function phoneCheckZip(zipCodeRedirect,form)
{

   thecookie = getCookie('wcmMrktIDCookie');
   zipCookie = getCookie('wcmZipCodeCookie') 

   if (thecookie==null || thecookie=='' || zipCookie==null || zipCookie=='' )
   {

	changeZipRedirect(zipCodeRedirect);
   }
   else
   {	  
	   form.map.value=thecookie;
	   form.submit();
   }
}




function appendZip (redirectURL)
{

      if (enabledCookies()) 
        {   thecookie = getCookie('wcmZipCodeCookie');
	    document.location.href = redirectURL + "&zip=" + thecookie;
	}
	else {
	document.location.href = redirectURL  }
}

function appendMrktId (redirectURL)
{
      if (enabledCookies()) 
        {  
   		//thecookie = getCookie('wcmMrktIDCookie');
   		//document.location.href = redirectURL + "&mrktID=" + thecookie;
		pmacookie = getCookie('wcmPmaIDCookie');
   	    pmccookie = getCookie('wcmPmcIDCookie');
   		document.location.href = redirectURL + "&pmapmc=Shared/" + pmacookie + ",Shared/" + pmccookie ;

   	}
   	else {
   		document.location.href = redirectURL  
	}

}


function setCookie(c_name,value,expiredays)
{
	var exdate=new Date()
	exdate.setDate(exdate.getDate()+expiredays)
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString()) + "; path=/"
}

function eraseCookie(name) {
	setCookie(name,"",-1);
}


function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    }
  }
return ""
}

function enabledCookies() {
	setCookie('test','none','1');
	if ( getCookie( 'test' ) )
	{
		eraseCookie('test', '/', '');
		return true;
	}
	else
	{
		return false;
	}
}


function sendZip(objSelect){
	if (objSelect.selectedIndex<=0) return false;
		var objOpt = objSelect.options[objSelect.selectedIndex];
		thecookie = getCookie('wcmMrktIDCookie');
		window.location.href=objOpt.value   + "?mrktID=" + thecookie;;
		}


function openMapURL(url,enterZipURL){   
    if (enabledCookies()) {
			var wcmMapCookie = getCookie("wcmPmaIDCookie");
			var openUrl = url +  wcmMapCookie.substring(0,4);   
			popupWin=window.open(openUrl,"","width=550,height=635, scrollbars")
	} else {
	popupWin=window.open(enterZipURL,"NewWin","width=550,height=635, scrollbars")
	} 
	

}
		
function submitZipCoverageMap(form)
{			

	if (form.zip.value=="" || form.zip.value.length < 5)
	{ 
		alert("Please enter a valid zipcode" );
	}
	else
	{
	
		//redirect the url of the custom portlet 
		
		var currURL = form.redirectURL.value;
		var redirectURL= new Array();
		redirectURL = currURL.split('WCM_GLOBAL_CONTEXT');
		location.href=form.customPortlet.value + "?zipcode=" + form.zip.value + "&redirectURL" + redirectURL[1]+"&form=CoverageMap";
	}
}


		
function openMapSpanishURL(url,presentationTemplate){   
			var wcmMapCookie = getCookie("wcmPmaIDCookie");   
			var openUrl = url +  wcmMapCookie.substring(0,4) + presentationTemplate;   
			popupWin=window.open(openUrl,"","width=550,height=635, scrollbars=" + scroll)
		}
		
		
		


// ---------------------------  Zipcode Functions --------------------------- // 

// ---------------------------  Start  Life Line Link Up --------------------------- // 

function changeIt(lang){
if(lang=="EN"){
document.getElementById("default").style.visibility 	= "hidden"
document.getElementById("EN").style.visibility 	= "visible"
document.getElementById("SP").style.visibility 	= "hidden"
}
if(lang=="SP"){
document.getElementById("default").style.visibility 	= "hidden"
document.getElementById("SP").style.visibility 	= "visible"
document.getElementById("EN").style.visibility 	= "hidden"
}
if(lang=="default"){
document.getElementById("EN").style.visibility 	= "hidden"
document.getElementById("default").style.visibility 	= "visible"
document.getElementById("SP").style.visibility 	= "hidden"
}
}

// ---------------------------  End Life Line Link Up --------------------------- // 


//Browser Detection

var bType;
function BDetect () {
	if (document.layers) {
	bType = "ns4";
	}
	else if (document.getElementById) {
	bType = "dom"
	}
	else if (document.all && !document.getElementById) {
	bType = "ie4";
	}
	else {
	bType = "other";
	}
}
BDetect();

//Mac ?
isMac = 0;
if (navigator.appVersion.indexOf("Mac") > -1)	{
	isMac	= 1;
	//alert("isMac");
}


function printIFrame(frameName) {
	document.frames[frameName].focus();
	document.frames[frameName].print();
}

function showTip(layerName) {
}

function hideTip(layerName){	
}



function captureMousePos(e) {
}

// Ad Randomizer
function adRotate(thisAd)	{
	thisCount = thisAd.length;
	rndNumber = Math.floor(Math.random()*thisCount)
	alert(thisAd[rndNumber]);
}

// Business Image Array
var adBusiness = new Array();
	adBusiness[0] = "img 0"
	adBusiness[1] = "img 1 "
	adBusiness[2] = "img 2"
	adBusiness[3] = "img 3"
	adBusiness[4] = "img 4"
	adBusiness[5] = "img 5"
	adBusiness[6] = "img 6"
	adBusiness[7] = "img 7"
	
// Popup Window
function popWin(url,wd,ht,scroll){

	
	//for step by stepe
	//if((url.indexOf("/stepbystep/")!=-1) && (url.indexOf("http://www.alltel.com")==-1))
	//{
	//	url="http://content.alltel.com"+url			

	//}
	
	//for terms and conditions 
	if((document.location.href.indexOf("/wps/portal/")!=-1) && (url.indexOf("/wps/wcm/myconnect/")!=-1))
	{
		url=url.replace("/wps/wcm/myconnect/","/wps/wcm/connect/")
	}

	useScroll = 0;
	if (scroll == 1)	{
		useScroll = 1;
	}
	height = ht;
	width = wd;
	thisURL = url;
	popupWin=window.open(thisURL,"_new","width=" + width + ",height=" + height + ", scrollbars=" + useScroll)
}

function popWinSmall(url,scroll){

	popupWin=window.open(url,"_new","width=450,height=265, scrollbars=" + scroll)
}

function popWinLarge(url,scroll){

	popupWin=window.open(url,"_new","width=550,height=615, scrollbars=" + scroll)
}

function popWinPhone(url,scroll){

	popupWin=window.open(url,"_new","width=320,height=405, scrollbars=" + scroll)
}

function launchSBS(phoneID)
{
	var newSBS = false;

	if (phoneID.indexOf('00')==0)
	{
		phoneID = phoneID.substring(2,phoneID.length);
		newSBS = true;
	}

	if (phoneID.lastIndexOf(':')>0)
	{
		phoneID = phoneID.substring(phoneID.lastIndexOf(':')+1,phoneID.length);
	}
	
	if (newSBS == true)
	{
		var thisURL = 'http://www2.alltelstepbystep.com/index.jsp?id=' + phoneID;
		popWin(thisURL,824,730);
	}
	else
	{
		var thisURL = 'http://www.alltel.com/stepbystep/index.jsp?id=' + phoneID;
		popWin(thisURL,736,515);
	}
	
}


// THIS FUNCTION BELOW IS ONLY FOR THE CUSTOMER REPRESENTATIVES


function launchCSRSBS(phoneID)
{
	var newSBS = false;

	if (phoneID.indexOf('00')==0)
	{
		phoneID = phoneID.substring(2,phoneID.length);
		newSBS = true;
	}

	if (phoneID.lastIndexOf(':')>0)
	{
		phoneID = phoneID.substring(phoneID.lastIndexOf(':')+1,phoneID.length);
	}
	
	if (newSBS == true)
	{
		var thisURL = 'http://www2.alltelstepbystep.com/index_private.jsp?id=' + phoneID;
		popWin(thisURL,824,730);
	}
	else
	{
		var thisURL = 'http://www.alltel.com/stepbystep/index.jsp?id=' + phoneID;
		popWin(thisURL,736,515);
	}
	
}


// THIS FUNCTION BELOW IS ONLY FOR THE CUSTOMER REPRESENTATIVES


function launchB2BSBS(phoneID)
{
	var newSBS = false;

	if (phoneID.indexOf('00')==0)
	{
		phoneID = phoneID.substring(2,phoneID.length);
		newSBS = true;
	}

	if (phoneID.lastIndexOf(':')>0)
	{
		phoneID = phoneID.substring(phoneID.lastIndexOf(':')+1,phoneID.length);
	}
	
	if (newSBS == true)
	{
		var thisURL = 'http://www2.alltelstepbystep.com/index_programming.jsp?id=' + phoneID;
		popWin(thisURL,824,730);
	}
	else
	{
		var thisURL = 'http://www.alltel.com/stepbystep/index.jsp?id=' + phoneID;
		popWin(thisURL,736,515);
	}
	
}


function launchSRA(DocID)	{
	
	thisURL = "" + DocID +"";
	//alert(thisURL)
	popupWin=window.open(thisURL,"_new","width=" + width + ",height=" + height + ", scrollbars=" + useScroll)

}

function changeLocation(url){
	window.location=url
}


function swapChars(processString, removeStr, replaceStr) {
	var outputString = processString
	while (outputString.indexOf(removeStr) > -1) 
	{
		pos				= outputString.indexOf(removeStr)
		outputString 	= outputString.substring(0, pos) 
		outputString 	= outputString + replaceStr 
		outputString 	=outputString +  processString.substring((pos + removeStr.length), processString.length);
	}
	return outputString
}

function changeLayer(thisLayer)	{
	setElementProperty(currentLayer, 'visibility', 'hidden')
	setElementProperty(thisLayer, 'visibility', 'visible')
	currentLayer = thisLayer
}

function nothing()
{
	return
}

function submitData()
{
	var zipcode = document.dataForm.zipCode.value;
	ModalPopup_showPopup(self, '/personal/wireless/plans/ValidateZipCode.jsp?zipCode=' + zipcode, 530, 620, '');
}

var ModalPopup_popupWindow;
var ModalPopup_creatingPopup = false;
var ModalPopup_sourceWindow;

function ModalPopup_showPopup( sourceWindow, url, popupWidth, popupHeight, windowAttributes ) 
{

	var currURL = window.location.href ;
	
	if((url.indexOf("/wps/wcm/myconnect/")!=-1) && (currURL.indexOf("/wps/portal/")!=-1))
	{	
		url=url.replace('myconnect','connect')
	}


	if(ModalPopup_popupWindow != null && !ModalPopup_popupWindow.closed)
	{
		ModalPopup_closePopup();
	}
	ModalPopup_creatingPopup = true;
	if( windowAttributes.length > 0 )
	{
        	windowAttributes = ',' + windowAttributes;
        }
	ModalPopup_popupWindow = window.open(url,'popup', 'resizable=yes,scrollbars=yes,dependent=yes,' +
		'screenX='+(screen.availWidth-popupWidth)/2+',screenY='+(screen.availHeight-popupHeight-30)/2 +
		',left='+(screen.availWidth-popupWidth)/2+',top='+(screen.availHeight-popupHeight-30)/2+
		',width=' +popupWidth + ',height=' + popupHeight + windowAttributes);

    	ModalPopup_sourceWindow = sourceWindow;
	ModalPopup_creatingPopup = false;
}
function ModalPopup_getSourceWindow() 
{
    	return ModalPopup_sourceWindow;
}
function ModalPopup_focusPopup() 
{
    	if(!ModalPopup_creatingPopup && ModalPopup_popupWindow != null && !ModalPopup_popupWindow.closed ) {
		if( typeof(ModalPopup_popupWindow.onError) != 'unknown' ) 
		{
			ModalPopup_popupWindow.focus();
		}
	}
}
function ModalPopup_closePopup() 
{
    	if(!ModalPopup_creatingPopup && ModalPopup_popupWindow != null && !ModalPopup_popupWindow.closed && ModalPopup_popupWindow.close )
	{
		ModalPopup_popupWindow.close();
	}
    	if(!ModalPopup_creatingPopup)
    	{
		ModalPopup_popupWindow = null;
	}
}

function changeParent(url)	{
	window.opener.location = url;
	self.close()
}

if (navigator.appName == "Netscape") {			
	layerRef="document.getElementById(";
	styleSwitch=").style";
	} else {
		layerRef="document.all";
		styleSwitch=".style";
}

currentDiv = "";


currentImg = "avail";

currentLockImg = "avail";
function lockImg(imgName)	{
	currentLockImg = imgName;
}

function unLockImg(imgName)	{
	if(currentLockImg != "")	{
		if (navigator.appName == "Netscape") {	
			DefaultImage = eval(imgName + "_default.src");		
			document[imgName].src =DefaultImage;
			}
		else{
			if(document.readyState == "complete"){	
				DefaultImage = eval(imgName + "_default.src");		
				document[imgName].src =DefaultImage;
			}			
		}
	}
}
		
//Image on
function image_on(imgName) {
	if (navigator.appName == "Netscape") {			
		ActiveImage = eval(imgName + "_active.src");
		document[imgName].src = ActiveImage;		
		}
	else{
		if(document.readyState == "complete"){	
			ActiveImage = eval(imgName + "_active.src");
			document[imgName].src = ActiveImage;		
			}
		}	
	currentImg = imgName;
	}
	
	//Image off
	function image_off(imgName) {	
	if (imgName != currentLockImg)	{
		if (navigator.appName == "Netscape") {	
			DefaultImage = eval(imgName + "_default.src");		
			document[imgName].src =DefaultImage;
			}
		else{
			if(document.readyState == "complete"){	
				DefaultImage = eval(imgName + "_default.src");		
				document[imgName].src =DefaultImage;
				}			
		}
	}	
	}


// ---------------------------  Validate Voice Mail --------------------------- // 


function validateNPANXX()
{
	var npa = document.forms.npanxx.NPA.value;
	var nxx = document.forms.npanxx.NXX.value;
	var vmtype = "here";

	for (var i=0; i < document.forms.npanxx.VMTYPE.length; i++)
	   {
		if (document.forms.npanxx.VMTYPE[i].checked  )
		{
			vmtype = document.forms.npanxx.VMTYPE[i].value;
		}
	  }	
	
   	invalidnpanxx = "You have not fully entered your phone number.  Please enter your area code and first three digits of your phone number.";
    validChars = "0123456789";

   if( npa.length != 3 || nxx.length != 3 )
   {
     alert( invalidnpanxx );
     return false;
   }

   for( i=0; i < 3; ++i )
   {
     if( validChars.indexOf(npa.charAt(i)) < 0 || validChars.indexOf(nxx.charAt(i)) < 0)
     {
       alert( invalidnpanxx );
       return false;
     }
   }
   
  // 	document.forms.npanxx.action.value=document.forms.npanxx.action.value + "?NPA=" + npa + "&NXX=" + nxx + "&TYPE=" vmtype;

 //  setCookie("wcmVMITypeCookie",vmtype,1);
	
   //setCookie("wcmAreaCodeCookie",npa,1);
  // setCookie("wcmPrefixCodeCookie",nxx,1);

 return true;
}

// ---------------------------  Validate Voice Mail --------------------------- // 

// ---------------------------  News Release Dates written for old News Releases in Temasite --------------------------- // 

function writeDate(date,contTitle)
{
	var myArray = ['jan','feb','march','mar','april','apr','may','june','jun','july','jul','aug','sep','sept','oct','nov','dec'];
	var printArray = ['Jan','Feb','Mar','Mar','Apr','Apr','May','Jun','Jun','Jul','Jul','Aug','Sept','Sept','Oct','Nov','Dec'];

	var genDateOne = date;

	var month=0;
	var match=0;


	if (genDateOne == "")
	{
		while ((month<= myArray.length) && (match==0))
		{

			var placement =contTitle.search(myArray[month])
			if (placement > -1)
			{
				
				var dayDate = contTitle.indexOf(myArray[month]) + myArray[month].length;
				document.write(printArray[month] + ' ' );
				document.write(contTitle.substr(dayDate,2) + " ");
				match=1;
			}
			month=month+1;

		}

	}
	else //write out general date one 
	{
		document.write(genDateOne);
	}
	 
	
}
// ---------------------------  News Release Dates  --------------------------- // 

function getImageURL(imgurl){
return imgurl.substr(10,imgurl.indexOf("border=")-12)
}	


// ---------------------------- SHOW HIDE DIV ---------------------------------- //

    function showguide(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }


function popLocator(url,wd,ht,scroll){
	var divCookie=getCookie('wcmDivestCookie');
	useScroll = 0;
	if (scroll == 1)	{
		useScroll = 1;
	}
	height = ht;
	width = wd;
	if(divCookie=='DV1'||divCookie=='ATT')
		thisURL = url+'&Divested=1';
	else
		thisURL = url+'&Divested=0';
	popupWin=window.open(thisURL,"_new","width=" + width + ",height=" + height + ", scrollbars=1")
}