/*
 * This function is required to create a pop-up for a print-ready page 
 */

var gAutoPrint = false; // Flag for whether or not to automatically call the print function

function printSpecial()
{
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';

		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}
		
		html += '\n</HE' + 'AD>\n<BODY>\n';
		
		var printReadyElem = document.getElementById("printReady");
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
			
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		
		var printWin = window.open("","printSpecial");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
	}
	else
	{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}
}


/*
 * This function is required to pop-up a window defined through the HTML Editor
 * as new window pop-up hyperlink 
 */
function openLink(URI,w,h)
{
win =window.open(URI,"secWin","width="+w+",height="+h+",left=100,borders=no,scrollbars=yes,resizable=yes,location=no");
win.focus;
}

/*
 * This function is required to pop-up the Voting Polls window fro the Home Page 
 */
function showNewWindow(PageName, WindowName, WindowWidth, WindowHeight, VarResizable,ScrollBar)
			{	
window.open(PageName,WindowName,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=' + ScrollBar + ',resizable=' + VarResizable + ',width=' + WindowWidth + ',height=' + WindowHeight);

/*
 * This function is required for the Weather Network component on the Home Page 
 */			}
function getCity(param) 
{					
		if (navigator.appName != "Netscape") 
		{							
				document.all["showCity"].style.display = '';
				document.all["searchForCity"].style.display = '';			
				var pairs=unescape(location.search.substring(1).replace(/\+/g," ")).split('&');
				var startI = 1;				
				if (pairs[0].substring(0,7) == '')
				{
					startI = 0;
				}
				for (var i=startI;i<pairs.length;i++)
				{
					var pair = pairs[i].split('=');	
					if 	(pair[0] != 'default')
					{
						if (param == '')
						{
							document.all["showCity"].style.display = 'none';
							return  'Edmonton_AB';
						}
						else
						{
							document.all["searchForCity"].style.display = 'none';
							return param;
						}												
					}
					else
					{	
						var pair2= pairs[i+1].split('=');							
						if (pair2[0] == 'wcity' && pair2[1] != '')						
						{											
							document.all["searchForCity"].style.display = 'none';
							return pair2[1];
						}	
						else
						{													
							document.all["showCity"].style.display = 'none';
							return  'Edmonton_AB';
						}				
					}		
				}
		}	
		else
		{

				document.getElementById("showCity").style.display = '';
				document.getElementById("searchForCity").style.display = '';
				
				var pairs=unescape(location.search.substring(1).replace(/\+/g," ")).split('&');
				var startI = 1;
				if (pairs[0].substring(0,7) == '')
				{
					startI = 0;
				}
				
				for (var i=startI;i<pairs.length;i++)
				{
					var pair = pairs[i].split('=');	
					if 	(pair[0] != 'default')
					{
						if (param == '')
						{
							document.getElementById('showCity').style.display = 'none'; 
							return  'Edmonton_AB';
						}
						else
						{
							document.getElementById('searchForCity').style.display = 'none'; 
							return param;
						}												
					}
					else
					{	
						var pair2= pairs[i+1].split('=');							
						if (pair2[0] == 'wcity' && pair2[1] != '')						
						{											
							document.getElementById('searchForCity').style.display = 'none'; 
							return pair2[1];
						}	
						else
						{													
							document.getElementById('showCity').style.display = 'none'; 
							return  'Edmonton_AB';
						}				
					}		
				}
		}									
}	


function DL_GetElementLeft(eElement)
 {
   var nLeftPos = eElement.offsetLeft;
   var eParElement = eElement.offsetParent;
   while (eParElement != null)
   {
    nLeftPos += eParElement.offsetLeft;
    eParElement = eParElement.offsetParent;
   }
   return nLeftPos;
 }
function DL_GetElementTop(eElement)
 {
   var nTopPos = eElement.offsetTop;
   var eParElement = eElement.offsetParent;
   while (eParElement != null)
   {
    nTopPos += eParElement.offsetTop;
    eParElement = eParElement.offsetParent;
   }
   return nTopPos;
 }
function CalendarPos(ebtn)
 {
   tt = document.all('CalPosY');
   tt.value =DL_GetElementTop(ebtn)+"px";
   tt = document.all('CalPosX');
   tt.value =DL_GetElementLeft(ebtn)+20+"px";
   tt = document.all('CalReturnField');
   tt.value =ebtn.id;
 }

/*
 * This function is required for Tool Tip support on public pages 
 */

// Tool Tip Variables
var xMousePos = 0; // Horizontal position of the mouse on the screen
var yMousePos = 0; // Vertical position of the mouse on the screen
var xMousePosMax = 0; // Width of the page
var yMousePosMax = 0; // Height of the page		
var offSet = 10;


//ToolTips Start
function showToolTip(thetext)
{				
	var DivRef;
	var IfrRef;		
			
	if (navigator.appName != "Netscape") {
		DivRef =document.all["toolTip"];
		IfrRef=document.all["HelpShim"];
	}
	else {
		DivRef =document.getElementById("toolTip");
		IfrRef=document.getElementById("HelpShim");
	}//layers
			
												
	//set div properties			
	DivRef.style.visibility = "visible";	
	DivRef.style.zIndex = 99999;	
	DivRef.innerHTML=thetext;																					
			
	DivRef.style.top = yMousePos+offSet;
	DivRef.style.left = xMousePos+offSet;	
		
	//set shin properties	
	IfrRef.style.zIndex = DivRef.style.zIndex - 1;			
	IfrRef.style.display = "block";				
	IfrRef.style.width = DivRef.offsetWidth;
    IfrRef.style.height = DivRef.offsetHeight;    		    		
    IfrRef.style.top = DivRef.style.top;
    IfrRef.style.left = DivRef.style.left;        																				
}
		
function closeToolTip(){		
	if (navigator.appName != "Netscape") {
		document.all["toolTip"].style.visibility = "hidden";
		document.all["HelpShim"].style.display = "none";
	} 
	else {
		document.getElementById("toolTip").style.visibility = "hidden";
		document.getElementById("HelpShim").style.display = "none";				
	}
}
						
function trackMousePos(){
	if (navigator.appName != "Netscape") {				
		document.onmousemove = captureMousePosition;							
	} else { 					
		document.captureEvents(Event.MOUSEMOVE);										
		document.onmousemove = captureMousePosition;								
	}									
}	
function captureMousePosition(e) {			
	 if (navigator.appName != "Netscape") {    
		xMousePos = window.event.x+document.body.scrollLeft;
		yMousePos = window.event.y+document.body.scrollTop;
	    xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
		yMousePosMax = document.body.clientHeight+document.body.scrollTop;				
	} else  {        				
		xMousePos = e.pageX;
        yMousePos = e.pageY;		        
		xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
	}				
}	
//ToolTips End

/*
 * This function is required for the Polls Vote Pop-up Window 
 */

function redirectBack()
{
if (window.history.length > 0)
{
window.history.forward();
}
getRadioValue();
}
function getRadioValue()
{
if (navigator.appName != "Netscape")
{
for (var i=0; i < document.Form1.btn.length; i++)
{
if (document.Form1.btn[i].checked)
{
document.all('tbAnswerID').value = document.Form1.btn[i].value;
}
}
}
else
{
for (var i=0; i < document.Form1.btn.length; i++)
{
if (document.Form1.btn[i].checked)
{
document.getElementById('tbAnswerID').value	= document.Form1.btn[i].value;
}
}
}
}