var AjaxStorage;
var wasSet=false;
var MultiVals = new Array('','','','','','','');
var MultiSet = new Array(false,false,false,false,false,false,false);

function putMultiValue(theName,aValue) { 
if((theName<0)||(theName>6))
  return;

MultiVals[theName] =aValue;
MultiSet[theName] =true;
}

function getMultiValue(theName) { 
if((theName<0)||(theName>6))
  return '';
var rtnVal=MultiVals[theName];
MultiVals[theName]='';
MultiSet[theName]=false;
rtnVal = escape(rtnVal);
while(rtnVal.indexOf("+")>-1)
 rtnVal = rtnVal.replace('+', '%2B');
while(rtnVal.indexOf("*")>-1)
 rtnVal = rtnVal.replace('*', '%2A');
while(rtnVal.indexOf("/")>-1)
 rtnVal = rtnVal.replace('/', '%2F');
while(rtnVal.indexOf("@")>-1)
 rtnVal = rtnVal.replace('@', '%40');
return rtnVal;
}

function checkSet(theName) { 
if((theName<0)||(theName>6))
  return false;
return MultiSet[theName];
}

function getValue() { 
var rtnVal=AjaxStorage;
AjaxStorage='';
wasSet=false;
return rtnVal;
}

function putValue(aValue) { 
AjaxStorage=aValue;
wasSet=true;
}

var AJAXRequestObjects = new Array(); // array of Ajax Objects
var AJAXRequested = new Array(0); // array of ajax request inUse flags
AJAXRequested[0] = 1; // When page loads, no requests have been made yet, so 1st one is available

function getData(dataSource1, parms, divID1) 
{ 
var ReqNum = AJAXRequested.length; 	
var kpfrsh= new Date();
dataSource1 = dataSource1 +"?frsh='" + kpfrsh.getMilliseconds() + "'" + parms;
//dataSource1 = dataSource1 + parms;
// loop through and fin an available object
for (var i=0; i<AJAXRequested.length; i++) 
   {
   // available objects are indicated by a '1' 
   if (AJAXRequested[i] == 1) 
     {
     ReqNum = i;
     break;
     }
   }
// Set to 0 to mark as in use
AJAXRequested[ReqNum] = 0;
// SET UP THE REQUEST
if (window.XMLHttpRequest) 
  {
  AJAXRequestObjects[ReqNum] = new XMLHttpRequest();
  } 
else if (window.ActiveXObject) 
       {
       AJAXRequestObjects[ReqNum] = new ActiveXObject("Microsoft.XMLHTTP");
       }

if(AJAXRequestObjects[ReqNum]) 
  {
  var obj = document.getElementById(divID1); 
  
  AJAXRequestObjects[ReqNum].open('GET', dataSource1); 
  AJAXRequestObjects[ReqNum].onreadystatechange = function() 
          { 
            if (AJAXRequestObjects[ReqNum].readyState == 4 && 
                AJAXRequestObjects[ReqNum].status == 200) 
                { 
                obj.innerHTML = AJAXRequestObjects[ReqNum].responseText; 
 		AJAXRequested[ReqNum] = 1;
 		AJAXRequestObjects[ReqNum] = null;
                } 
          } 

   AJAXRequestObjects[ReqNum].send(null); 
   }
}



//here you place the ids of every element you want.
var ids=new Array('clock','weather');

function switchid(id){	
	hideallids();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(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';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}


function windowOpener(windowHeight, windowWidth, windowName, windowUri)
{
    var centerWidth = (window.screen.width - windowWidth) / 2;
    var centerHeight = (window.screen.height - windowHeight) / 2;

    newWindow = window.open(windowUri, windowName, 'resizable=0,width=' + windowWidth + 
        ',height=' + windowHeight + 
        ',left=' + centerWidth + 
        ',top=' + centerHeight);

    newWindow.focus();
    return newWindow.name;
}



function grayOut(vis, options) {  
	// Pass true to gray out screen, false to ungray  
	// options are optional.  This is a JSON object with the following (optional) properties  
	// opacity:0-100         
	// Lower number = less grayout higher = more of a blackout   
	// zindex: #             
	// HTML elements with a higher zindex appear on top of the gray out  
	// bgcolor: (#xxxxxx)    
	// Standard RGB Hex color code  
	// grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});  
	// Because options is JSON opacity/zindex/bgcolor are all optional and can appear  
	// in any order.  Pass only the properties you need to set.  
	var options = options || {};   
	var zindex = options.zindex || 50;  
	var opacity = options.opacity || 80;  
	var opaque = (opacity / 100);  
	var bgcolor = options.bgcolor || '#000000';  
	var dark=document.getElementById('darkenScreenObject');  
	if (!dark) {    
	// The dark layer doesn't exist, it's never been created.  So we'll    
	// create it here and apply some basic styles.    
	// If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917    
	var tbody = document.getElementsByTagName("body")[0];    
	var tnode = document.createElement('div');           // Create the layer.        
		tnode.style.position='absolute';                 // Position absolutely        
		tnode.style.top='0px';                           // In the top        
		tnode.style.left='0px';                          // Left corner of the page        
		tnode.style.overflow='hidden';                   // Try to avoid making scroll bars                    
		tnode.style.display='none';                      // Start out Hidden        
		tnode.id='darkenScreenObject';                   // Name it so we can find it later    
	tbody.appendChild(tnode);                            // Add it to the web page   
	dark=document.getElementById('darkenScreenObject');  // Get the object.  
	}  
	if (vis) {    
	// Calculate the page width and height     
	if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {        
		var pageWidth = document.body.scrollWidth+'px';        
		var pageHeight = document.body.scrollHeight+'px';    
	} else if( document.body.offsetWidth ) {      
		var pageWidth = document.body.offsetWidth+'px';      
		var pageHeight = document.body.offsetHeight+'px';    
	} else {
		var pageWidth='100%';
		var pageHeight='100%';    
	}   
	//set the shader to cover the entire page and make it visible.    
	dark.style.opacity=opaque;                  
	dark.style.MozOpacity=opaque;         
	dark.style.filter='alpha(opacity='+opacity+')';
	dark.style.zIndex=zindex;            
	dark.style.backgroundColor=bgcolor;      
	dark.style.width= pageWidth;    
	dark.style.height= pageHeight;    
	dark.style.display='block'; 
	} else { 
	dark.style.display='none'; 
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


