document.domain='netscape.com';

// Overlay functionality
function close_overlay() {
    var supported = (document.getElementById);
    if (!supported) return;
    var divPath = document.getElementById('overlay');
    var currPos = parseInt(divPath.style.top);
	divPath.style.top = "-700px";
}

// Rotator functionality 
var rotBlock = new Array();
var len = 0;
var itemIndex = 0;
var fTimerID = null;
var myimages = new Array();
var buttonTime = 10;

if(document.all && !document.getElementById) {
    document.getElementById = function(id) {
        return document.all[id];
    }
}

function rotateInit(){
    for (x=0; x<rotateInit.arguments.length; x++) {
	    rotBlock[x] = rotateInit.arguments[x];
	}
	len = (rotBlock.length)-1;
}

function rotate(){
    clearTimeout(fTimerID);
    document.getElementById(rotBlock[itemIndex]).style.display = "none";
    document.getElementById("slotsnav_button"+(itemIndex+1)).style.backgroundColor="#ffffff";
    itemIndex++;
    if(itemIndex > len) {
        itemIndex = 0;
    }
    document.getElementById(rotBlock[itemIndex]).style.display = "block";
    document.getElementById("slotsnav_button"+(itemIndex+1)).style.backgroundColor="#AACBD4";
    fTimerID = setTimeout('rotate()', rotateTime);
    return itemIndex;
}

function pause() {
    if (fTimerID != null) {
        clearTimeout(fTimerID);
        fTimerID = null;
    }
}
   
function unpause() {
    if (fTimerID != null) {
        clearTimeout(fTimerID);
    }
    fTimerID = setTimeout('rotate()', rotateTime);
}
   
function forward() {
    if (fTimerID != null) {
        clearTimeout(fTimerID);
    }
    fTimerID = setTimeout('rotate()', buttonTime);
}


function backwards() {
    if (fTimerID != null) {
        clearTimeout(fTimerID);
    }
    document.getElementById(rotBlock[itemIndex]).style.display = "none";
    document.getElementById("slotsnav_button"+(itemIndex+1)).style.backgroundColor="#ffffff";
    itemIndex--;
    if (itemIndex <= -1) {
        itemIndex = len;
    }
    document.getElementById(rotBlock[itemIndex]).style.display = "block";
    document.getElementById("slotsnav_button"+(itemIndex+1)).style.backgroundColor="#AACBD4";
    fTimerID = setTimeout('rotate()',rotateTime);
    return itemIndex;
}

function slotJump(slotID){
    clearTimeout(fTimerID);
    document.getElementById(rotBlock[itemIndex]).style.display = "none";
    document.getElementById("slotsnav_button"+(itemIndex+1)).style.backgroundColor="#ffffff";
    itemIndex = slotID-1;
    document.getElementById(rotBlock[slotID-1]).style.display = "block";
    document.getElementById("slotsnav_button"+(slotID)).style.backgroundColor="#AACBD4";
    fTimerID = setTimeout('rotate()', rotateTime);
    pause();
}

// welcome tab and my city tab functionality
function tab(hideID, showID) {
    document.getElementById(hideID).style.display = "none";
    document.getElementById(showID).style.display = "block";
	hideMenu('email_overlay');
    hideMenu('help_overlay');
    hideMenu('myaccount_overlay');	
}

function hideMenu(hideID) {
    if (document.getElementById(hideID) != null) {
        document.getElementById(hideID).style.display = "none";
    }
}

function showMenu(showID) {
	if (showID == "email_overlay") {
	    hideMenu('help_overlay');
		hideMenu('myaccount_overlay');
        close_div_instantly('whatsNewDiv');		
	} else if (showID == "help_overlay") {
	    hideMenu('email_overlay');
		hideMenu('myaccount_overlay');
        close_div_instantly('whatsNewDiv');			
	} else if (showID == "myaccount_overlay") {
	    hideMenu('email_overlay');
		hideMenu('help_overlay');	
	    close_div_instantly('whatsNewDiv');
	}
    document.getElementById(showID).style.display = "block";	
}

function openstoryWindow(url) {
    hideMenu('email_overlay');
    hideMenu('help_overlay');	
    hideMenu('myaccount_overlay');
    document.getElementById('wnpframe').src = url;
    document.getElementById('wnpdiv').style.display = "block";    	
    document.getElementById('wnpdiv').style.visibility = "visible";
}

function hidestoryDiv() {
     var whatStoryObj = new getObj("wnpdiv");
     if (!whatStoryObj) { return false }
     whatStoryObj.style.visibility="hidden";
     whatStoryObj.style.block="none";
     return true;
}

// AUTHENTICATION FORM VALIDATION
function validate_data() {
    if(document.getElementById("login_name").value.match(/@/)) {
        if(! document.getElementById("login_name").value.toLowerCase().match(/@netscape.com$/) &&! document.getElementById("login_name").value.toLowerCase().match(/@dev.netscape.com$/) &&! document.getElementById("login_name").value.toLowerCase().match(/@qe.netscape.com$/) &&! document.getElementById("login_name").value.toLowerCase().match(/@stage.netscape.com$/) &&! document.getElementById("login_name").value.toLowerCase().match(/@qe2.netscape.com$/) &&! document.getElementById("login_name").value.toLowerCase().match(/@sq.netscape.com$/)) {
	        alertuser(document.getElementById("login_name"), "You must enter in a @netscape.com E-mail address.");
		    return false;
	    }
    }
	return true;
}
	
function alertuser(field,msg) {
	alert(msg);
	field.focus();
}

function min_zipcode(zipcode)
{
    var strValidChars = "0123456789"
    var strChar
    var blnResult = true
    if (zipcode.length != 5) blnResult = false
    for (i = 0; i < zipcode.length && blnResult == true; i++) {
        strChar = zipcode.charAt(i)
        if (strValidChars.indexOf(strChar) == -1) {
            blnResult = false
        }
    }
    n_zipcode = parseInt(zipcode,10)
    if (blnResult && n_zipcode >= 600 && n_zipcode <= 99999) {
        return true;
    } else {
        location.href = "http://channels.isp.netscape.com/weather/c_select.jsp?pers=y&where=" + zipcode;
        return false;
    }
}

function city_zipcode(zipcode)
{
    var strValidChars = "0123456789"
    var strChar
    var blnResult = true
    if (zipcode.length != 5) blnResult = false
    for (i = 0; i < zipcode.length && blnResult == true; i++) {
        strChar = zipcode.charAt(i)
        if (strValidChars.indexOf(strChar) == -1) {
            blnResult = false
        }
    }
    n_zipcode = parseInt(zipcode,10)
    if (blnResult && n_zipcode >= 600 && n_zipcode <= 99999) {
        return true;
    } else {
	    alert("Please enter a valid ZIP code.");
        return false;     
    }
}