function popUpRates(page,evt){
	xCor=(document.layers)?(screen.width/2):(screen.width/2);
	//ypos=(document.layers)? evt.y:window.event.clientY;
	ypos=50;
	//ypos= 165;
	topPos=ypos;
	leftPos=xCor - 300;
	var properties = "width=500,height=350, resizable=yes, scrollbars=yes,left=" + leftPos + ",top=" + topPos;
	
	win2 = window.open(page,'pop2',properties);
	opened = true;
	win2.focus();
	}
	
	if (document.layers){
	window.captureEvents(Event.MOUSEDOWN);
	window.onmousedown = manageWindows;
	}

function popUpdsl(page,evt){
	xCor=(document.layers)?(screen.width/2):(screen.width/2);
	//ypos=(document.layers)? evt.y:window.event.clientY;
	ypos=50;
	//ypos= 165;
	topPos=ypos;
	leftPos=xCor - 300;
	var properties = "width=496,height=350, resizable=yes, scrollbars=yes,left=" + leftPos + ",top=" + topPos;
	
	win2 = window.open(page,'pop2',properties);
	opened = true;
	win2.focus();
	}
	
	if (document.layers){
	window.captureEvents(Event.MOUSEDOWN);
	window.onmousedown = manageWindows;
	}

//Pop up window to display DSL Demo
function launchDemo(){
	if (screen.height < 768){
		dsldemo = window.open('/TheNeighborhood/res_local_service/highspeeddemo/index.html','dsldemowindow','width=588,height=520,scrollbars=yes');
	} else {
		dsldemo = window.open('/TheNeighborhood/res_local_service/highspeeddemo/index.html','dsldemowindow','width=570,height=665');
	}
	dsldemo.focus();
}

//Pop up window to display CallManager Demo
function MM_openBrWindow(theURL,winName,features) { //v2.0
  newwin = window.open(theURL,winName,features);
  newwin.focus()
}

//Pop up new window 
//var newwin;
function popUpNewFullWin(theURL,winName,features) { 
  newwin = window.open(theURL,winName,features);
  newwin.focus()
}

function randomAdConsumer() {
  
 var adTitleArray = new Array();
	//adTitleArray[0] = 'High Speed Internet for $19.99/month';
	adTitleArray[0] = 'Save $1 <br>Every Month!';
	adTitleArray[1] = 'FREE Month <br>For LIFE&#46;&#46;&#46;';
	adTitleArray[2] = 'Neighborhood CallManager!';
	//adTitleArray[3] = 'One Month FREE!';
	
 var tellMoreLocArray = new Array();
 	//tellMoreLocArray[0] = '/ResHighSpeed.htm';
 	//tellMoreLocArray[0] = '/amex/index.jsp?EACCESS=AMXCREA&PPACCESS=AMXCRPP';
 	//tellMoreLocArray[1] = '/visa/index.jsp?EACCESS=VISCREA&PPACCESS=VISCRPP';
 	//tellMoreLocArray[0] = "javascript:popUpNewFullWin('/amex/index.jsp?EACCESS=AMXCREA&PPACCESS=AMXCRPP','Promo','toolbar=yes,resizable=yes,scrollbars=yes,location=yes,status=yes,menubar=yes')";
 	tellMoreLocArray[0] = '/customer_service/EasyPay_Solutions.html';
	tellMoreLocArray[1] = '/TheNeighborhood/res_local_service/jsps/default.jsp';
	tellMoreLocArray[2] = '/TheNeighborhood/res_local_service/jsps/callmanager.jsp';
	//tellMoreLocArray[3] = '/VOIP/index.htm';

 var tellMoreLocArray2 = new Array();
 	//second button for dsl ad
	//tellMoreLocArray2[0] = 'javascript:launchDemo()';
	//second button for CallManager ad
	tellMoreLocArray2[2] = "javascript:MM_openBrWindow('/TheNeighborhood/res_local_service/callmngrdemo/main.html','main','width=770,height=500,resizable=0,scrollbars=0')";
	
 var adTextArray = new Array();
 	//adTextArray[0] = 'Get online up to <b>50 times faster</b> than dial-up.  Enjoy the web without the wait.';
 	adTextArray[0] = 'Pay Your Bill Automatically and Save $1 every month';
	adTextArray[1] = 'Get one month FREE when you join the Neighborhood, plus get a month FREE every year as long as you remain on the Neighborhood plan you select today.';
	adTextArray[2] = 'View and manage your home phone calls from your computer!';
	//adTextArray[3] = 'Sign up for Neighborhood Broadband Calling and get one month FREE.';


var adLinkTextArray = new Array();
	//adLinkTextArray[0] = 'Learn More';
	adLinkTextArray[0] = 'Tell Me More';
	adLinkTextArray[1] = 'Learn More';
	adLinkTextArray[2] = 'Learn More';
	//adLinkTextArray[3] = 'Learn More';


    if((adTitleArray.length == adTextArray.length) &&
 		(adTitleArray.length == tellMoreLocArray.length)) {
		
	
 	var adToShow = Math.abs(Math.round(adTitleArray.length * Math.random()));
		if (adToShow > 2) { adToShow--}
		//if ad is DSL, we need to add a second button
			//if (adToShow == 0) {
			//		returnAd = 
			   
			  // '<table border="0" cellspacing="0" cellpadding="0"><tr><td colspan="2" valign="top" class="promoBackground"><div style="padding-top:5px; padding-left:5px; padding-right:3px; padding-bottom:5px"><span class="promoTextBigWhite"><center>' + adTitleArray[adToShow] + '</center></span></div></td></tr><tr><td colspan="2"><img src="/VOIP/images/spacer.gif" border="0" width="1" height="1"></td></tr><tr><td colspan="2" valign="top" class="promoText"><div style="padding-left:5px; padding-right:3px; padding-bottom:5px">' + adTextArray[adToShow] + '</div></td></tr><tr><td colspan="2" valign="bottom"><img src="/VOIP/images/spacer.gif" border="0" width="1" height="1"></td></tr><tr><td width="14" valign="middle"><div style="padding-left:5px;"><img src="/VOIP/images/greyCircle.gif" border="0" width="9" height="9" alt="" align="middle"></div></td><td valign="top"><a href="' + tellMoreLocArray2[adToShow] + '" class="promoLink">View demo</a><br><img src="/VOIP/images/spacer.gif" border="0" width="125" height="5"></td></tr><tr><td width="14" valign="middle"><div style="padding-left:5px;"><img src="/VOIP/images/greyCircle.gif" border="0" width="9" height="9"alt="" align="middle"></div></td><td valign="top"><a href="' + tellMoreLocArray[adToShow] + '" class="promoLink">' + adLinkTextArray[adToShow] + '</a><br><img src="/VOIP/images/spacer.gif" border="0" width="125" height="1"></td></tr><tr><td colspan="2"><img src="/VOIP/images/spacer.gif" border="0" width="1" height="1"></td></tr></table>';


		//if ad is CallManager, we need to add a second button
			//}else 
			
			if (adToShow == 2) {
					returnAd = 
			   
			   '<table border="0" cellspacing="0" cellpadding="0"><tr><td colspan="2" valign="top" class="promoBackground"><div style="padding-top:5px; padding-left:5px; padding-right:3px; padding-bottom:5px"><span class="promoTextBigWhite"><center>' + adTitleArray[adToShow] + '</center></span></div></td></tr><tr><td colspan="2"><img src="/VOIP/images/spacer.gif" border="0" width="1" height="1"></td></tr><tr><td colspan="2" valign="top" class="promoText"><div style="padding-left:5px; padding-right:3px; padding-bottom:5px">' + adTextArray[adToShow] + '</div></td></tr><tr><td colspan="2" valign="bottom"><img src="/VOIP/images/spacer.gif" border="0" width="1" height="1"></td></tr><tr><td width="14" valign="middle"><div style="padding-left:5px;"><img src="/VOIP/images/greyCircle.gif" border="0" width="9" height="9" alt="" align="middle"></div></td><td valign="top"><a onclick="javascript:keynoteEnable=0;" href="' + tellMoreLocArray2[adToShow] + '" class="promoLink">View demo</a><br><img src="/VOIP/images/spacer.gif" border="0" width="125" height="5"></td></tr><tr><td width="14" valign="middle"><div style="padding-left:5px;"><img src="/VOIP/images/greyCircle.gif" border="0" width="9" height="9"alt="" align="middle"></div></td><td valign="top"><a onclick="javascript:keynoteEnable=0;" href="' + tellMoreLocArray[adToShow] + '" class="promoLink">' + adLinkTextArray[adToShow] + '</a><br><img src="/VOIP/images/spacer.gif" border="0" width="125" height="1"></td></tr><tr><td colspan="2"><img src="/VOIP/images/spacer.gif" border="0" width="1" height="1"></td></tr></table>';

				
				 } else {
	//original
	returnAd = '<table border="0" cellspacing="0" cellpadding="0"><tr><td colspan="2" valign="top" class="promoBackground"><div style="padding-top:5px; padding-left:5px; padding-right:3px; padding-bottom:5px"><span class="promoTextBigWhite"><center>' + adTitleArray[adToShow] + '</center></span></div></td></tr><tr><td colspan="2"><img src="/VOIP/images/spacer.gif" border="0" width="1" height="2"></td></tr><tr><td colspan="2" valign="top" class="promoText"><div style="padding-left:5px; padding-right:3px; padding-bottom:5px">' + adTextArray[adToShow] + '</div></td></tr><tr><td colspan="2"><img src="/VOIP/images/spacer.gif" border="0" width="1" height="1"></td></tr><tr><td width="14" valign="middle"><div style="padding-left:5px;"><img src="/VOIP/images/greyCircle.gif" border="0" width="9" height="9" alt="" align="middle"></div></td><td valign="top"><a onclick="javascript:keynoteEnable=0;" href="' + tellMoreLocArray[adToShow] + '"  class="promoLink">' + adLinkTextArray[adToShow] + '</a><br><img src="/VOIP/images/spacer.gif" border="0" width="125" height="1"></td></tr><tr><td colspan="2"><img src="/VOIP/images/spacer.gif" border="0" width="1" height="1"></td></tr></table>';
		}
	}
	
 else {
	returnAd = '<table border="0" cellspacing="0" cellpadding="0"><tr><td colspan="2" valign="top" class="promoBackground"><div style="padding-top:5px; padding-left:5px; padding-right:3px; padding-bottom:5px"><span class="promoTextBigWhite"><center>Special Offer</center></span></div></td></tr><tr><td colspan="2" valign="top" class="promoText"><div style="padding-left:5px; padding-right:3px; padding-bottom:5px">Sign up for any MCI Long Distance plan, and receive a special online offer!</div></td></tr><tr><td colspan="2"><img src="/VOIP/images/spacer.gif" border="0" width="1" height="1"></td></tr><tr><td width="14" valign="middle"><div style="padding-left:5px;"><img src="/VOIP/images/greyCircle.gif" border="0" width="9" height="9" alt="" align="middle"></div></td><td valign="top"><a onclick="javascript:keynoteEnable=0;" href="/mcicom_redirect2/res_long_distance/" class="promoLink">Learn more</a><br><img src="/VOIP/images/spacer.gif" border="0" width="125" height="1"></td></tr><tr><td colspan="2"><img src="/VOIP/images/spacer.gif" border="0" width="1" height="1"></td></tr></table>';
	}
	
return returnAd;
}

