﻿
var redirectPage;
var siteUrl;
var _d = document;
var _w = window;

function setRedirectPage(url){
	redirectPage = url;
}

function setSiteUrl(url)
{ 
	siteUrl = url;
}

function processRedirect(){
	_w.location= siteUrl + redirectPage + '';
	return false;
}

function allLink(link)
{
	redirectPage = link.getAttribute("RedirectPage");
}


function loadBrowserFix(cssLinkId)
{
	version=0
	if (navigator.appVersion.indexOf("MSIE")!=-1){
		temp=navigator.appVersion.split("MSIE")
		version=parseFloat(temp[1])
	}
	cssLink = _d.getElementById(cssLinkId);	
	switch(Math.floor(version))
	{
		case 6:
			cssLink.href = '/css/browser/ie60fixes.css';
			break;
		case 7:
			cssLink.href = '/css/browser/ie70fixes.css';
			break;
	}
}

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 (_d.getElementById) { // DOM3 = IE5, NS6
		_d.getElementById(id).style.display = 'none';
	}
	else {
		if (_d.layers) { // Netscape 4
			_d.id.display = 'none';
		}
		else { // IE 4
			_d.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
	if (_d.getElementById) { // DOM3 = IE5, NS6
		_d.getElementById(id).style.display = 'block';
	}
	else {
		if (_d.layers) { // Netscape 4
			_d.id.display = 'block';
		}
		else { // IE 4
			_d.all.id.style.display = 'block';
		}
	}
}

function togglediv(id) {
	//safe function to show an element with a specified id
		 
	if (_d.getElementById) { // DOM3 = IE5, NS6
		if(_d.getElementById(id).style.display == 'none'){
			_d.getElementById(id).style.display = 'block';
		}else{
			_d.getElementById(id).style.display = 'none';
		}
	}
	else {
		if (_d.layers) { // Netscape 4
			if(_d.id.display == 'none'){
				_d.id.display = 'block';
			}else{
				_d.id.display = 'none';
			}
		}
		else { // IE 4
			if(_d.all.id.style.display == 'none'){
				_d.all.id.style.display = 'block';
			}else{
				_d.all.id.style.display = 'none';
			}
		}
	}
}
/*
* Helper object with custom methods for DHTML/AJAX/etc type handling
*/
var _dom = {
	getId: function (id) {
		if(_d.getElementById)
		{
			return _d.getElementById(id);
		}
	}
};

function radAjaxRequest(id)
{
	var radPanel = _w[id];
	if(radPanel)
	{
		radPanel.AjaxRequest();
	}
}

function popup(url, name){

settings=
"toolbar=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=no,"+
"resizable=no,width=701,height=680";
try{
window.open(url,name,settings);
}
catch(e){}
}

function setCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var 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) {
	setCookie(name,"",-1);
}
