function redirect(url, target)
{
	if(target != "_blank")
	{
		window.location = url;
	}
	else
	{
		window.open (url); 
	}
}

var largeFontSize = "14px";
var mediumFontSize = "13px";

function LargestFontSize()
{
	document.body.style.fontSize = largeFontSize;
}
function LargerFontSize()
{
	document.body.style.fontSize = mediumFontSize;
}
function resetFontSize()
{
	document.body.style.fontSize = "12px";
}
function RemoveCssClass(el, classname) 
{
	if (ElementExists(el))
		if (el.className.indexOf(classname) != -1)
			el.className = el.className.replace(classname, "");
}
function AddCssClass(el, classname) 
{
	if (ElementExists(el))
		if (el.className.indexOf(classname) == -1)
		el.className = el.className + " " + classname;
}
function ElementExists(element)
{
	if(element != null && element != undefined)
		return true;
	else
		return false;
}
function ShowElement(sender, el)
{
	if(ElementExists(el))
	{
		el.className = el.className.replace("Hidden","");
		if(ElementExists(sender))		
			sender.className += " Expanded";	
	}
}
function HideElement(sender, el)
{
	if(ElementExists(el))
	{
		if(el.className.indexOf("Hidden") == -1)
		{
			el.className += " Hidden";
			if(ElementExists(sender))		
				sender.className = sender.className.replace("Expanded","");
		}
	
	}
}
function HideRadioButtons(elid) 
{
	
	var el = document.getElementById(elid);
	if (ElementExists(el)) 
	{
	
		var selRB = null;
		var selLBL = null;
		
		var rbs = el.getElementsByTagName('input');
		for (var i = 0; i < rbs.length; i++) {
			HideElement(null, rbs[i]);
			if(rbs[i].checked)
				selRB = rbs[i];
		}

		var lbls = el.getElementsByTagName('label');
		for (var k = 0; k < lbls.length; k++) 
		{
			lbls[k].onclick = function() { for (var j = 0; j < lbls.length; j++) { RemoveCssClass(lbls[j], 'Selected'); } AddCssClass(this, 'Selected'); var rb = document.getElementById(this.htmlFor); rb.click(); }
			lbls[k].parentNode.className = "CenterAlign Width75px";
			if(ElementExists(selRB))
				if(lbls[k].htmlFor == selRB.id)
					selLBL = lbls[k];
		}
		
		if(ElementExists(selRB) && ElementExists(selLBL))
		{
			for (var j = 0; j < lbls.length; j++) { RemoveCssClass(lbls[j], 'Selected'); } AddCssClass(selLBL, 'Selected');
		}
	}
}
function SetupPaymentOptions(elid,txtid)
{
	
	var el = document.getElementById(elid);
	var txt = document.getElementById(txtid);
	if (ElementExists(el) && ElementExists(txt)) 
	{
		var rbs = el.getElementsByTagName('input');
		var lbls = el.getElementsByTagName('label');
		
		var selRB = null;
		
		for (var i = 0; i < rbs.length; i++) 
		{
			rbs[i].onclick = function() { txt.value = this.value; }
			if(rbs[i].checked)
				selRB = rbs[i];
		}
		
		for (var k = 0; k < lbls.length; k++) {

			lbls[k].onclick = function() { try { txt.value = rbs[k].value; } catch (ex) { } }
		}
		
		if(ElementExists(selRB))
		{
			selRB.click();
		}
		else
		{
			txt.value = "";
		}
		
	}
}
function FixSecondaryMenu(elid)
{
	var el = document.getElementById(elid);
	var tds = document.getElementsByTagName('td');
	var lnktds = new Array();
	
	if(ElementExists(el) && tds.length > 0)
	{
		for(var i = 0; i < tds.length; i++)
		{
			if(ElementExists(tds[i].firstChild))
				if(ElementExists(tds[i].firstChild.tagName))
					if(tds[i].firstChild.tagName.toLowerCase() == "a")
						lnktds.push(tds[i]);
		}
		
		for(var j = 0; j < lnktds.length; j++)
		{
			AddCssClass(lnktds[j],'LinkContainer');
		}
		
		AddCssClass(lnktds[lnktds.length - 1],'LastItem');
	}
}
function FixAllNavigation(indexVal)
{
	var siteNav = document.getElementById('divNavigation');
	var secondaryNav = document.getElementById('divSecondaryNavigation');

	var navLinks = new Array();
	if (ElementExists(siteNav)) 
	{
		navLinks = siteNav.getElementsByTagName('a');
		var selectedIndex = indexVal;
		if(ElementExists(navLinks[selectedIndex]))
		{
			AddCssClass(navLinks[selectedIndex],"Active");
		}
	}
	
	if(ElementExists(secondaryNav))
	{
		AddCssClass(secondaryNav,"SiteSecondaryNavigation" + selectedIndex.toString());
	}
}
function ResizeElements(items)
{
	var recs = new Array();
	for(i = 0; i < items.length; i++)
	{	
		recs[i] = document.getElementById(items[i]);
	}
	
	var max = 0;
	
	
	
	for(i=0; i<recs.length; i++)
	{
		if(ElementExists(recs[i]))
		{
			recs[i].style.height = "";
			
			if(recs[i].offsetHeight > max)
			{
				max = recs[i].offsetHeight;
			}
		}
	}
	for(i = 0; i < recs.length; i++)
	{
		
		if(ElementExists(recs[i]))
		{
	
			recs[i].style.height = max  + "px";
		}
	}
	
}
function ResizeCallouts(elid)
{
	var el = document.getElementById(elid);
	var items = new Array();
	if(ElementExists(el))
	{
		var divs = el.getElementsByTagName('div');
		for(var i = 0; i < divs.length; i++)
		{
			if(divs[i].className.indexOf('CalloutBody') != -1)
			{
				items.push(divs[i]);
				divs[i].id = "divSiteResizedCallout" + i.toString();
			}
		}
		var strVal = "";
		for(var i = 0; i < items.length; i++)
		{
			strVal += "'" + items[i].id + "',";
		}
		strVal = strVal.substring(0,strVal.length - 1);
		//ResizeElements(items);
		setTimeout("ResizeElements(new Array(" + strVal + "));",1000);
	}
}
/* Ad Rotator */

var adContainer = null;
var changeSpeed = 7500;
var adIndex = -1;
var adInterval = null;
var currentID = 0;

function ClearAdInterval() 
{
	clearInterval(adInterval);
}

function PreviousAd() 
{
	var ind = adIndex - 1 < 0 ? adItems.length - 1 : adIndex - 1;
	ChooseAd(ind);
}

function NextAd() 
{

	var ind = adIndex + 1 >= adItems.length ? 0 : adIndex + 1;
	ChooseAd(ind);		
}

function ChooseAd(strIndex) 
{
	var nextIndex = strIndex;
	
	var item = adItems[nextIndex];

	if (ElementExists(item)) 
	{

		var lastID = currentID;
		
		currentID = item[0];

		
		
		var lastActiveEl = (document.getElementById("lnkNav" + adIndex));

		if (ElementExists(lastActiveEl)) 
		{
			RemoveCssClass(lastActiveEl, 'Selected');
		}
		
		RemoveCssClass(adContainer, 'adClass' + lastID);
		adIndex = nextIndex;
		
		var nextActiveEl = document.getElementById("lnkNav" + adIndex);
		
		
		AddCssClass(adContainer, 'adClass' + currentID);
		
		if (ElementExists(nextActiveEl)) 
		{
			AddCssClass(nextActiveEl, 'Selected');
		}
		
	}
}

function InitializeAds() 
{
	adContainer = document.getElementById("divBox");
		
	var docNav = document.createElement("div");

	//var prevLink = document.createElement("a");
	//prevLink.href = "#";
	//prevLink.innerHTML = "&nbsp;";
	//prevLink.className = "Previous";
	//prevLink.onclick = function() { PreviousAd(); ClearAdInterval(); return false; }
	//docNav.appendChild(prevLink);
	
	for (var i = 0; i < adItems.length; i++) 
	{
		var anc = document.createElement("a");
		var ancin = i;

		anc.onclick = function() { ChooseAd(parseInt(this.innerHTML) - 1); ClearAdInterval(); return false; }
		anc.innerHTML = (i + 1).toString();
		anc.id = "lnkNav" + (i).toString();
		anc.href = "#";
		docNav.appendChild(anc);
	}
			
	//var nextLink = document.createElement("a");
	//nextLink.href = "#";
	//nextLink.innerHTML = "&nbsp;";
	//nextLink.onclick = function() { NextAd(); ClearAdInterval(); return false; }
	//nextLink.className = "Next";
	//docNav.appendChild(nextLink);
	
	docNav.className = "adRotatorNavigation";
	adContainer.appendChild(docNav);

	NextAd();
	adInterval = setInterval('NextAd();', changeSpeed);
}

var adItems = new Array();
var inc = 0;

/* End Ad Rotator */

/* Tooltip */

/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
var tipobj = null;
var btnsender = null;
var btnevent = null;

function setTipObj(id)
{
	if(id == null)
		id="dhtmltooltip";
	tipobj = document.getElementById(id);
	if(tipobj != null)
		tipobj.className = tipobj.className.indexOf('dhtmlPopup') == -1 ? tipobj.className + "dhtmlPopup" : tipobj.className;
}
function ietruebody()
{
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function ddrivetip(thetext, thecolor, thewidth, event,sender,id,inOverlay)
{   
	if(inOverlay == null)
		inOverlay = false;
    if (ns6||ie)
    {
		setTipObj(id);	
        if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px";
		
        if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor;
       
		positiontip(event,sender,inOverlay);
		
		var interior = document.getElementById('dhtmltooltipContent');
		
		if(interior.length > 0)
			interior = interior[0];
		
		if (typeof thewidth!="undefined") interior.style.width=thewidth+"px";
		
        interior.innerHTML=thetext;
        enabletip=true;
        tipobj.style.display="block";
        return false;
    }
}

function positiontip(e,sender,inOverlay)
{
	if (!enabletip && ElementExists(tipobj))
	{
		/*var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
		//Find out how close the mouse is to the corner of the window
		var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20;
		var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20;
		var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000;
		//if the horizontal distance isn't enough to accomodate the width of the context menu
		if (rightedge<tipobj.offsetWidth)
			//move the horizontal position of the menu to the left by it's width
			tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
		else if (curX<leftedge)
			tipobj.style.left="5px";
		else
			//position the horizontal position of the menu where the mouse is positioned
			tipobj.style.left=curX+offsetxpoint+"px";

		//same concept with the vertical position
		if (bottomedge<tipobj.offsetHeight)
			tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px";
		else
			tipobj.style.top=curY+offsetypoint+"px";*/
		
		var relativeTo = tipobj;
		
		if(sender != null)
			relativeTo = sender;
		
		
		
		tipobj.style.left = getposOffset(relativeTo,"left") + "px";
		tipobj.style.top = getposOffset(relativeTo,"top") + relativeTo.offsetHeight+ "px";
		
		if(inOverlay)
		{
			var par = sender.offsetParent;
			var i = 0;
			
			while(par.id.indexOf("pnlPopup") != (par.id.length - ("pnlPopup").length))
			{
				par = par.parentNode;
				
				i++;
			}
			
			
			var meaLeft = par.offsetLeft;
			var meaTop =  par.offsetTop;
			
			
			tipobj.style.left = (parseInt(tipobj.style.left) - meaLeft) + "px";
			tipobj.style.top = (parseInt(tipobj.style.top) - meaTop) + "px";
		}	
	}
}

function hideddrivetip(id)
{
	setTipObj(id);
	if (ns6||ie)
	{
		enabletip=false;
		if(ElementExists(tipobj))
		{
			tipobj.style.display="none";
			tipobj.style.left="-1000px";
			tipobj.style.backgroundColor='';
			tipobj.style.width='';
		}
	}
}
var fixoffsetleft = 0;
var fixoffsettop = 0;
function getposOffset(what, offsettype)
{
	var totaloffset=(offsettype=="left")? (what.offsetLeft - fixoffsetleft) : (what.offsetTop + fixoffsettop);
	var parentEl = what.offsetParent;
	
	while (parentEl!=null)
	{
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl = parentEl.offsetParent;
		
    }
    
	return totaloffset;
}

setTimeout('setTipObj();',1000);

//setTimeout('document.onmousemove=positiontip;',2000);

/* End Tooltip */

/* Modal Popup */

/*
 * jqModal - Minimalist Modaling with jQuery
 *   (http://dev.iceburg.net/jquery/jqModal/)
 *
 * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 * 
 * $Version: 03/01/2009 +r14
 */
(function($) {
$.fn.jqm=function(o){
var p={
overlay: 50,
overlayClass: 'jqmOverlay',
closeClass: 'jqmClose',
trigger: '.jqModal',
ajax: F,
ajaxText: '',
target: F,
modal: F,
toTop: F,
onShow: F,
onHide: F,
onLoad: F
};
return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;
H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};
if(p.trigger)$(this).jqmAddTrigger(p.trigger);
});};

$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};
$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};
$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t);});};
$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});};

$.jqm = {
hash:{},
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);
 if(c.modal) {if(!A[0])L('bind');A.push(s);}
 else if(c.overlay > 0)h.w.jqmAddClose(o);
 else o=F;

 h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;
 if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}

 if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
  r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
 else if(cc)h.w.jqmAddClose($(cc,h.w));

 if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);	
 (c.onShow)?c.onShow(h):h.w.show();e(h);return F;
},
close:function(s){var h=H[s];if(!h.a)return F;h.a=F;
 if(A[0]){A.pop();if(!A[0])L('unbind');}
 if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
 if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F;
},
params:{}};
var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false,
i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}},
L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() {
 if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});};
})(jQuery);

/* End Modal Popup */