

popUpWindow = function(URL,windowName,width,height) {
	var w = screen.availWidth;
	var h = screen.availHeight;
	var leftPos = Math.round((w-width)/2);
	var topPos = Math.round((h-height)/2);
	var defaults = "scrollbars=yes,resizable=yes,";
	var centerOnScreen = "top="+topPos+",left="+leftPos+",width="+width+",height="+height;
	// safari seems to need the trailer comma
	var options = defaults + centerOnScreen + ",";
	var msgWindow = window.open(URL,windowName,options);
	msgWindow.focus();
}


// function that's called if pre-onload handlers are available
var preInitDone = false;
beforeOnloadInit = function() {
	preInitDone = true;
	init();
};

// proprietary DOMContentLoaded Mozilla event handler
if (document.addEventListener) document.addEventListener("DOMContentLoaded", beforeOnloadInit, null);

// fall back to window.onload if needed
window.onload = function() { if (!preInitDone) init(); };

// load stylesheet for js-enabled browsers
if(document.getElementById && document.createTextNode) {
	document.writeln("<link href=\"/css/js_enabled.css\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />");
}

init = function() {
	setStyles();
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

setStyles = function() {
  var cookie = readCookie("carrsStyles");
  var title = cookie ? cookie : "0";
	createCookie("carrStyles", title, 365);
 	setActiveStyleSheet(title);
	ts(title,'content-wrapper')
}

setActiveStyleSheet = function(title) {

  if(document.getElementById && document.createTextNode) {
		if(document.getElementById("link-1")) {
			document.getElementById("link-2").style.color = "#ffffff";
			document.getElementById("link-1").style.color = "#ffffff";
			document.getElementById("link-0").style.color = "#ffffff";			
			var l = document.getElementById("link-" + title);
			l.style.color = "#000000";
		}
		
	}
}

createCookie = function(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=/";
}

readCookie = function(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;
}



/*------------------------------------------------------------
	Document Text Sizer- Copyright 2003 - Taewook Kang.  All rights reserved.
	Coded by: Taewook Kang (txkang.REMOVETHIS@hotmail.com)
	Web Site: http://txkang.com
	Script featured on Dynamic Drive (http://www.dynamicdrive.com)
	
	Please retain this copyright notice in the script.
	License is granted to user to reuse this code on 
	their own website if, and only if, 
	this entire copyright notice is included.
--------------------------------------------------------------*/

//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div','td','span','p');

//Specify spectrum of different font sizes:
var szs = new Array( '11px','12px','14px' );

ts = function( sz, trgt ) {
	if (!document.getElementById) return
	var d = document,cEl = null,i,j,cTags;
		
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];
	cEl.style.fontSize = szs[ sz ];

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}
		
	createCookie("carrsStyles",  sz , 365);
	setActiveStyleSheet( sz );
}
