



var marketingids = new Array('MarketingPosition1', 'MarketingPosition2', 'MarketingPosition3', 'MarketingPosition4', 'MarketingPosition5', 'MarketingPosition6', 'MarketingPosition7', 'MarketingPosition8', 'MarketingPosition8', 'MarketingPosition9', 'MarketingPosition10', 'MarketingPosition11', 'MarketingPosition12');



var linkids = new Array('Link1', 'Link2', 'Link3', 'Link4', 'Link5', 'Link6', 'Link7', 'Link8','Link9','Link10','Link11','link12');



function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if (opacStart > opacEnd) {
        for (i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')", (timer * speed));
            timer++;
        }
    } else if (opacStart < opacEnd) {
        for (i = opacStart; i <= opacEnd; i++) {
            setTimeout("changeOpac(" + i + ",'" + id + "')", (timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
    //if an element is invisible, make it visible, else make it ivisible
    if (document.getElementById(id).style.opacity == 0) {
        opacity(id, 0, 100, millisec);
    } else {
        opacity(id, 100, 0, millisec);
    }
}

function blendimage(divid, imageid, imagefile, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //set the current image as background
    document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";

    //make image transparent
    changeOpac(0, imageid);

    //make new image
    document.getElementById(imageid).src = imagefile;

    //fade in image
    for (i = 0; i <= 100; i++) {
        setTimeout("changeOpac(" + i + ",'" + imageid + "')", (timer * speed));
        timer++;
    }
}

function currentOpac(id, opacEnd, millisec) {
    //standard opacity is 100
    var currentOpac = 100;

    //if the element has an opacity set, get it
    if (document.getElementById(id).style.opacity < 100) {
        currentOpac = document.getElementById(id).style.opacity * 100;
    }

    //call for the function that changes the opacity
    opacity(id, currentOpac, opacEnd, millisec)
}

var TimeToFade = 3000.0;
var FadeActive = true;

function stopFade() {
    FadeActive = false;
}

function startFade() {
    FadeActive = true;
    
}


function setlinkColor(id)
{
   setlinkcolorWhite();
  
   setlinkcolorBlue(id, '#112e58')
}


function setlinkcolorBlue(id, newcolor)
{
    if (document.getElementById) { /* DOM3 = IE5, NS6 */
		document.getElementById(id).style.color = newcolor;
		
	}
	else {
		if (document.layers) { /* Netscape 4*/
			document.id.color = newcolor;
			
		}
		else { /* IE 4*/
			document.all.id.style.color = newcolor;
		}
	}

}

function setlinkcolorWhite(){
	/* loop through the array and hide each element by id */
	for (var i=0;i<linkids.length;i++){
	    if(document.getElementById(linkids[i]) != null){
	   	        if (document.getElementById) { /* DOM3 = IE5, NS6 */
		            document.getElementById(linkids[i]).style.color = '#fff';
            		
	            }
	            else {
		            if (document.layers) { /* Netscape 4*/
			            document.linkids[i].color = '#fff';
            			
		            }
		            else { /* IE 4*/
			            document.all.linkids[i].style.color = '#fff';
		            }
	            }
	   	        /*linkids[i].style.color = '#fff';*/
		    }
            
	}		  
}

function displayMenuActive(){
    var currentNav;
    currentNav = readCookie('CurrentNav');
    if (currentNav != null){
        switchid(currentNav);
    }
}
function displayIntroActive(){
    var currentBT;
    currentBT = readCookie('blueTableContent');
    if (currentBT != null){
        switchintroid(currentBT);
    }
}

function switchid(id){	
	hideallids(id);
	/*hideallimgs(id);*/
	showdiv(id);
	/*showhideimage(id);*/
}

function switchSalesPosition(id) {
    hideallSalesids(salesids);
    /*hideallimgs(id);*/
    showdiv(id);
    /*showhideimage(id);*/
}
function switchMarketingPosition(id) {
    hideallMarketingids(marketingids);
    /*hideallimgs(id);*/
    showdiv(id);
    /*showhideimage(id);*/
}

function switchCustomerServicePosition(id) {
    hideallMarketingids(customerserviceids);
    /*hideallimgs(id);*/
    showdiv(id);
    /*showhideimage(id);*/
}

function switchHeroPosition(id) {
    hideallSalesids(heroids);
    /*hideallimgs(id);*/
    showdiv(id);
    /*showhideimage(id);*/
}

function switchTier2Hero(id){	
	hideallT2ids(id, t2ids);
	/*hideallimgs(id);*/
	showdiv(id);
	/*showhideimage(id);*/
}

function switchintroid(id){	
	showhideintro(id);
	showhideintroimage(id);
}

function showhide(id){
    if (document.getElementById) { /* DOM3 = IE5, NS6 */
	    if(document.getElementById(id) != null){
	        if(document.getElementById(id).style.display == 'none'){
	            showdiv(id);
	            createCookie("CurrentNav",id,10);    
	        }else{
                hidediv(id);
                eraseCookie("CurrentNav");    
	        }
		}
	}
	else {
		if(document.id != null){
	        if(document.id.display == 'none'){
	            showdiv(id);
	        }else{
	            hidediv(id);
	        }
	    }
    }
}


function showhideintro(id){
    if (document.getElementById) { /* DOM3 = IE5, NS6 */
	    if(document.getElementById(id) != null){
	        if(document.getElementById(id).style.display == 'none'){
	            showdiv(id);
	            createCookie("blueTableContent",id,10);    
	        }else{
                hidediv(id);
                eraseCookie("blueTableContent");    
                
	        }
		}
	}
	else {
		if(document.id != null){
	        if(document.id.display == 'none'){
	            showdiv(id);
	        }else{
	            hidediv(id);
	        }
	    }
    }
}

function hideallids(id){
	/* loop through the array and hide each element by id */
	for (var i=0;i<ids.length;i++){
	    if(ids[i] != id)
	    {
	        if(document.getElementById(ids[i]) != null){
	   	        hidediv(ids[i]);
		    }
		}
	}		  
}
function hideallSalesids(ids) {
    /* loop through the array and hide each element by id */
    for (var i = 0; i < ids.length; i++) {
        if (document.getElementById(ids[i]) != null) {
            hidediv(ids[i]);
        }
    }
}

function hideallMarketingids(ids) {
    /* loop through the array and hide each element by id */
    for (var i = 0; i < ids.length; i++) {
        if (document.getElementById(ids[i]) != null) {
            hidediv(ids[i]);
        }
    }
}
function hideallT2ids(id, ids) {
	/* loop through the array and hide each element by id */
	for (var i=0;i<ids.length;i++){
	    if(ids[i] != id)
	    {
	        if(document.getElementById(ids[i]) != null){
	   	        hidediv(ids[i]);
		    }
		}
	}		  
}
function hideallimgs(id){
	/*loop through the array and hide each element by id */
	for (var i=0;i<ids.length;i++){
	    if(ids[i] != id)
	    {
	        if(document.getElementById(ids[i]) != null){
    		    showhideimage(ids[i]);
		    }
		}
	}		  
}

function hidediv(id) {
	/*safe function to hide an element with a specified id*/
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { /* Netscape 4 */
			document.id.display = 'none';
		}
		else { /* IE 4 */
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	/* safe function to show an element with a specified id */
		  
	if (document.getElementById) { /* DOM3 = IE5, NS6 */
		document.getElementById(id).style.display = 'block';
		/*document.getElementById(id).style.zIndex=100;*/
		
		
	}
	else {
		if (document.layers) { /* Netscape 4*/
			document.id.display = 'block';
			/*document.id.zIndex=100;*/
		}
		else { /* IE 4*/
			document.all.id.style.display = 'block';
        	/*document.all.id.stule.zIndex=100;*/
		}
	}
}


function showhideimage(id){
    
    if (document.getElementById) { /* DOM3 = IE5, NS6*/
        if(document.getElementById(id) != null){
	  
            if(document.getElementById(id).style.display == 'none')
            {
		        document.getElementById(id+'Img').src = '/images/plus.gif';
		    }else
		    {
		        document.getElementById(id+'Img').src = '/images/minus.gif';
		    }
	    }
	}
	else {
		if (document.layers) { /* Netscape 4*/
	    	if(document.id != null){
	  
		        if(document.id.display == 'none')
		        {
			        document[id+'Img'].src = '/images/plus.gif';
			    }else
			    {
			        document[id+'Img'].src = '/images/minus.gif';
			    }
			}
		}
		else { /* IE 4 */
		    if(document.all.id != null){
		        if(document.all.id.style.display == 'none')
		        {
			        document.all[id+'Img'].src = '/images/plus.gif';
			    }
			    else
			    {
			        document.all[id+'Img'].src = '/images/minus.gif';
			    }
			}
		}
	}
}

function showhideintroimage(id){
    
    if (document.getElementById) { /* DOM3 = IE5, NS6*/
        if(document.getElementById(id) != null){
	  
            if(document.getElementById(id).style.display == 'none')
            {
		        document.getElementById(id+'Img').src = '/images/intro_BTN_expand_19x19.gif';
		    }else
		    {
		        document.getElementById(id+'Img').src = '/images/intro_BTN_collapse_19x19.gif';
		    }
	    }
	}
	else {
		if (document.layers) { /* Netscape 4*/
	    	if(document.id != null){
	  
		        if(document.id.display == 'none')
		        {
			        document[id+'Img'].src = '/images/intro_BTN_expand_19x19.gif';
			    }else
			    {
			        document[id+'Img'].src = '/images/intro_BTN_collapse_19x19.gif';
			    }
			}
		}
		else { /* IE 4 */
		    if(document.all.id != null){
		        if(document.all.id.style.display == 'none')
		        {
			        document.all[id+'Img'].src = '/images/intro_BTN_expand_19x19.gif.gif';
			    }
			    else
			    {
			        document.all[id+'Img'].src = '/images/intro_BTN_collapse_19x19.gif.gif';
			    }
			}
		}
	}
}
function createCookie(name,value,days) {
    if (days) 
    {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else
	{ 
	    expires = "";
	}
	document.cookie = name+"="+value+expires+"; path=/";
	
}

function readCookie(name) {
    var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function resetDotNetScrollPosition()
{
    var scrollX = document.getElementById('__SCROLLPOSITIONX');
    var scrollY = document.getElementById('__SCROLLPOSITIONY');

    if(scrollX != null && scrollY != null)
    {
        scrollX.value = 0;
        scrollY.value = 0;
    }
}    
