﻿// JScript File
function $obj(strObj)
{
//    alert(strObj);
  if (document.getElementById && document.getElementById(strObj)) 
        return document.getElementById(strObj);
  else 
    if (document.all && document.all(strObj)) 
        return document.all(strObj);
    else   
        return null;
}

var popup = null;
function openWin(page,PWidth,PHeight,flags) 
{ 
 	if (popup)
	{
		if (!popup.closed)
		{
			popup.close();
		}
	}
	popup = null; 

	var PTop = (screen.height/2)-(PHeight/2);
 	var PLeft = (screen.width/2)-(PWidth/2);
 	
	if (flags != null)
	{
		if (flags.substring(0,1) != ",")
		{
			flags = "," + flags;
		}
	}
	
	popup = window.open(page, "ATT", "TOP=" + PTop + ",LEFT=" + PLeft + ",HEIGHT=" + PHeight + ",WIDTH=" + PWidth + flags);
	popup.focus();
 }
 
 // pad numeric values
function padWithZeros(value,decimalPlaces) {
	valueStr = (Math.round((value + 0.0005) * 100) /100).toString();
	var decimalPos = valueStr.indexOf(".");
	if (decimalPos == -1) {
		decimalPartLen = 0;
		valueStr += (decimalPlaces > 0 ? "." : "");
	} else {
		decimalPartLen = valueStr.length - decimalPos - 1;
	}
	var padTotal = decimalPlaces - decimalPartLen;
	if (padTotal > 0) {
		for (k=0;k<padTotal;k++) {
			valueStr += "0";
		}
	}
	return valueStr;
}
function clearCredits()
{
    if (!$obj('productType0').checked)
    {
        $obj('product00').checked = false;
        $obj('product01').checked = false;
        $obj('product02').checked = false;
        $obj('product03').checked = false;
    }
    if (!$obj('productType3').checked)
    {
        $obj('product30').checked = false;
        $obj('product31').checked = false;
    }
    calcCredits()
}


function calcCredits()
{
    var totalCredits= 0
    var productCredit = [30,50,30,30,25,25,25];
    var productCount = 0;
    
    forceProducts();
    
    checkBundleProducts();
    
    if ($obj('product00').checked || $obj('product01').checked || $obj('product02').checked || $obj('product03').checked)
    {
        $obj('productType0').checked = true;
    }
    else
        if ($obj('productType0').checked)
            $obj('product00').checked = true;
   
    if ($obj('product30').checked || $obj('product31').checked)
    {
        $obj('productType3').checked = true;
    }
    else
        if ($obj('productType3').checked)
            $obj('product30').checked = true;
    for (var i=0; i < 7; i++)
        if ($obj('productType' + i).checked)
        {
            totalCredits += productCredit[i];
            productCount++;
            $obj('productTypeCredit' + i).className = 'bdlproductcreditselect';
        }
        else
            $obj('productTypeCredit' + i).className = 'bdlproductcredit';
   if (productCount < 2)
   {
        totalCredits = 0;
        for (var i=0; i < 7; i++)
            $obj('productTypeCredit' + i).className = 'bdlproductcredit';
   }
   $obj('bdlcreditamount').innerHTML = '$' + padWithZeros(totalCredits,0);
}
function getCCFBPricing()
{

}
function checkCCFBPrice()
{

}

function checkBundleProducts()
{

}

function forceProducts()
 {
 
 }

function setPopInfo(strItem,winSize)
{
    var title = "";
    var body = "";
    $obj('popwindow').width = winSize;
	switch (strItem)
	{
	    case 'local':
		    title = "Local Service";
            body = '<p><strong>Unlimited Local: </strong>Complete Choice&reg; for Business, including features like Call Waiting, Caller ID, Call Forwarding and 3-Way Calling</p>';
            break;
	    case 'wireless':
		    title = "Wireless Services";
            body = '<ul class=popul>';
            body += '<li>Rollover&reg; Minutes</li>';
            body += '<li>Largest Mobile-to-Mobile calling community</li>';
            body += '<li>No long distance or roaming charges</li>';
            body += '<li>Largest global coverage in the U.S</li>';
            body += '</ul>';
            break;
	    case '1000minutes':
		    title = "Business 1000 Minutes Package Plan";
            body = '<ul class=popul>';
            body += '<li>1000 domestic long distance minutes</li>';
            body += '<li>Overage Per Minute Rate = 6&cent;</li>';
            body += '<li>Toll Free Usage counts toward package minutes, if selected</li>';
            body += '<li>Calling Cards Available</li>';
            body += '</ul>';
            break;
	    case '2000minutes':
		    title = "Business 2000 Minutes Package Plan";
            body = '<ul class=popul>';
            body += '<li>2000 domestic long distance minutes</li>';
            body += '<li>Overage Per Minute Rate = 5.5&cent;</li>';
            body += '<li>Toll Free Usage counts toward package minutes, if selected</li>';
            body += '<li>Calling Cards Available</li>';
            body += '</ul>';
            break;
 	    case 'unlimited':
		    title = "Business Unlimited Plan";
            body = '<ul class=popul>';
            body += '<li>Call anytime, anywhere in the U.S.</li>';
            body += '<li>Available to our Complete Choice&reg; for Business customers</li>';
            body += '<li>Toll Free (if selected) = 6&cent;/minute</li>';
            body += '<li>Calling Cards Available</li>';
            body += '</ul>';
            break;
   	    case 'flex':
		    title = "Business Unlimited Flex Plan";
            body = '<ul class=popul>';
            body += '<li>Call anytime, anywhere in the U.S.</li>';
            body += '<li>Available to our Complete Choice&reg; for Business customers</li>';
            body += '<li>Toll Free (if selected) = 6&cent;/minute</li>';
            body += '<li>Calling Cards Available</li>';
            body += '</ul>';
            break;
   	    case 'dsl':
		    title = "FastAccess&reg; Business DSL";
            body = '<ul class=popul>';
            body += '<li>Fastest downstream speeds up to 6.0 Mbps downstream X 512 Kbps upstream*</li>';
            body += '<li>Includes an unlimited back-up dial Internet account</li>';
            body += '<li>11 mailboxes per account</li>';
            body += '<li>10 MB personal Web space</li>';
            body += '<li>Same-day repair &amp; 5-day Professional Installation Guarantee </li>';
            body += '<li>AT&amp;T Internet Security Software with Anti-Virus, Anti-Spyware & Firewall Protection </li>';
            body += '<li>Additional Features: AT&amp;T MailGuard, AT&amp;T Welcome Service, AT&amp;T Pop-Up Catcher </li>';
            body += '</ul>';
            body += '<p style="font-size:7pt;">*Actual speeds are "up to" and are based on DSL synch rate, which may vary, and are not guaranteed. Many factors affect speed. Service and speed not available in all areas.</p>';
            break;
    	case 'tollfree':
		    title = "Business Easy Toll Free&reg;";
            body = '<p>Make it easy for your customers to reach you!</p>';
            body += '<ul class=popul>';
            body += '<li>Expand your reach and grow your business with a toll free number </li>';
            body += '<li>Make it easy for customers and traveling employees to contact your business</li>';
            body += '<li>Already have a toll free number? You can bring your number with you!</li>';
            body += '<li>Monthly Fee: $10.00 per number</li>';
            body += '</ul>';
            body += '<p style="font-size:7pt;">*The toll free per minute rate varies by Long Distance calling plan selected.</p>';
            break;
   	    case 'worldwide':
		    title = "Business Worldwide Plan";
            body = '<ul class=popul>';
            body += '<li>Great rates for direct dialed calls to all international locations</li>';
            body += '<li>Per minute Rate varies by <a href="javascript: void openWin(\'http://bellsouth.com/longdistance/at_your_business/intlcp_ratetable.html\',800,400,\'scrollbars=yes, resizable=yes\');" class="unspan">country</a> called</li>';
            body += '</ul>';
            break;
   	    case 'internationsave':
		    title = "Business International Savings Plan";
            body = '<ul class=popul>';
            body += '<li>Low, low international rates to multiple foreign destinations</li>';
            body += '<li>No monthly recurring charge—just a reasonable monthly commitment</li>';
            body += '<li>Offers toll free service from Canada</li>';
            body += '</ul>';
            break;
   	    case 'webhost':
		    title = "AT&amp;T Web Hosting";
            body = '<ul class=popul>';
            body += '<li>Get your own web site! Select from a range of plans with the tools to help you grow your business online.</li>';
            body += '<li><strong>SPECIAL OFFER:</strong> FastAccess&reg; Business DSL customers receive 15% off monthly hosting charges.</li>';
            body += '</ul>';
            break;
   	    case 'techsupport':
		    title = "Tech Support 360";
            body = '<ul class=popul>';
            body += '<li>24/7 PC help from certified, U.S. based technicians to help fix computer, software, and device problems. Anytime, Anywhere</li>';
            body += '<li><strong>SPECIAL OFFER:</strong> FastAccess&reg; Business DSL customers receive a $25 Visa&reg; Gift Card when ordering Tech Support 360.</li>';
            body += '</ul>';
            break;
   	    case 'voicemessage':
		    title = "AT&T Voice Messaging Service";
            body = '<p>Benefit from All-in-one Voice Messaging</p>';
            body += '<ul class=popul>';
            body += '<li>Captures voice messages 24 hours a day</li>';
            body += '<li>Send and receive messages outside of the office</li>';
            body += '<li>One flat rate for complete messaging services</li>';
            body += '</ul>';
            break;
   	    case 'rewards':
		    title = "Rewards";
            body = '<p>Issued in the form of a bill credit or VISA&reg; Rewards</p>';
    }    
	$obj('popTitle').innerHTML = "<strong>" + title + "</strong>";
	if (body != "")
	    $obj('popText').innerHTML = body;
}

 //foating div scripts

function getStyleObject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	return document.layers[objectId];
    } else {
	return false;
    }
}

function changeObjectVisibility(objectId, newVisibility) {
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	return false;
    }
}

function moveObject(objectId, newXCoordinate, newYCoordinate) {
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
//    alert(newXCoordinate +  " " + newYCoordinate);	
	styleObject.left = newXCoordinate + 'px';
	styleObject.top = newYCoordinate + 'px';
	
	return true;
    } else {
	return false;
    }
}


function mouseX(evt) {
	if (evt.pageX) return evt.pageX;
	else if (evt.clientX)
	   return evt.clientX + (document.documentElement.scrollLeft ?
	   document.documentElement.scrollLeft :
	   document.body.scrollLeft);
	else return null;
}

function mouseY(evt) {
	if (evt.pageY) return evt.pageY;
	else if (evt.clientY)
	   return evt.clientY + (document.documentElement.scrollTop ?
	   document.documentElement.scrollTop :
	   document.body.scrollTop);
	else return null;
}

function showPopup (targetObjectId, strInfo, winSize, xNew, yNew, eventObj) {
    var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) 
  {
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } 
  else 
    if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) 
    {
    //DOM compliant
        scrOfY = document.body.scrollTop;
        scrOfX = document.body.scrollLeft;
    } 
    else 
        if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) 
        {
        //IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
        scrOfX = document.documentElement.scrollLeft;
        }

    
    
    if(eventObj) {
	hideCurrentPopup();
	eventObj.cancelBubble = true;

	var newXCoordinate = eventObj.clientX + scrOfX + xNew; //(eventObj.pageX)?eventObj.pageX + xNew:eventObj.x + xNew + ((document.body.scrollLeft)?document.body.scrollLeft:0);
	var newYCoordinate = eventObj.clientY + scrOfY + yNew; //(eventObj.pageY)?eventObj.pageY + yNew:eventObj.y + yNew + ((document.body.scrollTop)?document.body.scrollTop:0);
	moveObject(targetObjectId, newXCoordinate, newYCoordinate);
	if( changeObjectVisibility(targetObjectId, 'visible') ) {
	    window.currentlyVisiblePopup = targetObjectId;
		setPopInfo(strInfo,winSize);
	    return true;
	} else {
	    return false;
	}
    } else {
	return false;
    }
}

function hideCurrentPopup() {
    if(window.currentlyVisiblePopup) {
	document.getElementById('popTitle').innerHTML = '';
	document.getElementById('popText').innerHTML = '';

	changeObjectVisibility(window.currentlyVisiblePopup, 'hidden');
	window.currentlyVisiblePopup = false;
    }
} 

window.onload = initializeHacks;
document.onclick = hideCurrentPopup;

function initializeHacks() {
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	window.onresize = explorerMacResizeFix;
    }
    resizeBlankDiv();
    createFakeEventObj();
}

function createFakeEventObj() {
    if (!window.event) {
	window.event = false;
    }
}

function resizeBlankDiv() {
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	getStyleObject('blankDiv').width = document.body.clientWidth - 20;
	getStyleObject('blankDiv').height = document.body.clientHeight - 20;
    }
}

function explorerMacResizeFix () {
    location.reload(false);
}