var VCC = new Object();

VCC.setTextSize = function ( size ) {
	size = 0 + size;
	document.body.style.fontSize = size + "px";
	
	var sizestring = ('00' + size).slice(-2);
	
	var allanchors = document.getElementById('textsizeblock').getElementsByTagName('A');
	for (var i=0; i<allanchors.length; i++) {
		allanchors[i].className = "";
	}
	document.getElementById( 'textsizeanchor_' + sizestring ).className = "current";
	
	document.cookie = "fontsize=" + sizestring + "; path=/";
};

VCC.init = function () {
	var cookies = ' ' + document.cookie;
	
	var at = cookies.indexOf( ' fontsize=' );
	VCC.raw = '10';
	if ( at >= 0 ) {
		VCC.raw = cookies.substr( at + 10, 2 ); // always 2 digits	
	}

	VCC.setTextSize(parseInt(VCC.raw));
	VCC.insertShadow("homelink");
	VCC.insertShadow("loginlink");
};

VCC.insertShadow = function ( elementid ) {
	try {
		var element = document.getElementById( elementid );
		if (! element ) { return; };
		var shadow = document.createElement('SPAN');
		shadow.className = "shadow";
		shadow.innerHTML = element.innerHTML.replace(/<\/?[^>]+>/gi,"");
		element.appendChild(shadow);
	} catch (e) {};
};

VCC._navbarLinks = null;
VCC.allMenuLinksInactive = function () {
	if (VCC._navbarLinks == null) {
		VCC._navbarLinks = $('navbar').getElementsByTagName("a");
	}
	
	for (var i=0; i<VCC._navbarLinks.length; i++) {
		VCC._navbarLinks[i].className = "";
	};
};

VCC.onMenuShow = function( menu, block, callingelement ) {
	VCC.allMenuLinksInactive();
	callingelement.className = "active";
};

VCC.onMenuHide = function() {
	VCC.allMenuLinksInactive();
};

do {
	/* Internet Explorer */
	/*@cc_on @*/
	/*@if (@_win32)
		if ( window.location.protocol != "https:" ) {
			document.write("<sc" + "ript id='__ie_observeDOMReady' defer='defer' src='javascript:void(0);'><\/sc" + "ript>");
			VCC.DOMReadyBrowserDevice = document.getElementById("__ie_observeDOMReady");
			VCC.DOMReadyBrowserDevice.onreadystatechange = function() {
				if (this.readyState == "complete") {
					VCC.init(); // call the onload handler
				}
			};
			break;
		}
	/*@end @*/
	
	/* Safari/Konqueror */
	/* WebKit must be tested for before DOM2 standard because WebKit supports document.addEventListener but NOT the 
	   DOMContentLoaded event. */
	if (/WebKit/i.test(navigator.userAgent)) { 
		Event.DOMReadyBrowserDevice = setInterval(function() {
			if (/loaded|complete/.test(document.readyState)) {
				clearInterval(Event.DOMReadyBrowserDevice);
				VCC.init(); 
			}
		}, 10);
		break;
	}
	
	/* Mozilla/Opera9/DOM2 Compliant browsers */
	if (document.addEventListener) {
		document.addEventListener("DOMContentLoaded", VCC.init, false);
		break;
	}

	/* Anything else */
	if (window.addEventListener) {
		window.addEventListener("load", VCC.init, false);
	} else if(window.attachEvent) {
		window.attachEvent("onload", VCC.init);
	}

} while(0);


/*==============================*/


function openRegistrationWindow( pageToLoad, winName, width, height, center) {
                                 
	    xposition=0; yposition=0;
	    if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
	        xposition = (screen.width - width) / 2;
	        yposition = (screen.height - height) / 2;
	    }
	    args = "width=" + width + "," 
	    + "height=" + height + "," 
	    + "location=0," 
	    + "menubar=1,"
	    + "resizable=1,"
	    + "scrollbars=1,"
	    + "status=1," 
	    + "titlebar=1,"
	    + "toolbar=1,"
	    + "hotkeys=1,"
	    + "screenx=" + xposition + ","  //NN Only
	    + "screeny=" + yposition + ","  //NN Only
	    + "left=" + xposition + ","     //IE Only
	    + "top=" + yposition;           //IE Only
	
	    window.open( pageToLoad,winName,args );
	}
	