// rollover scripts for homepage
if (document.images) {
        var imageNames = new Array("cc_learnmore","pc_learnmore","cc_login","pc_login");
	var imageExtension = ".gif";
	var rolloverImages = new Array(imageNames.length);
	var curName = "";
	var gWhichGlowing = "";
        var imagePath = "/system/modules/com.fiberlink.site/resources/";

	//preload rollover images
	for (var i=0; i<imageNames.length; i++) {
		curName = imageNames[i];
		rolloverImages[curName] = new Array("over","out");
		rolloverImages[curName]["out"] = new Image();
		rolloverImages[curName]["out"].src = imagePath+curName+imageExtension;
		rolloverImages[curName]["over"] = new Image();
		rolloverImages[curName]["over"].src = imagePath+curName+"-over"+imageExtension;
	}
}


//rollover scripts
function Glow(whichImage) {
        if (document.images) {                
		document[whichImage].src = rolloverImages[whichImage]["over"].src;
		gWhichGlowing = whichImage;        	
	}
}

function DeGlow(){
	if (document.images) {
		document[gWhichGlowing].src = rolloverImages[gWhichGlowing]["out"].src;
		gWhichGlowing = "";
	}
}



//script for subpage tab toggle
function toggletopics(clickedtab) {
	var numberoftabs = 4;
	var tabclass;
	var topicclass;
	clickedtab = parseInt(clickedtab);
	
	//make all tabs unselected, all topics hidden, all spacers' class to default
	for (i=1; i<=numberoftabs; i++) { 
		tabname = "tab" + i;
		topicname = "topic" + i;
		spacername = "spacer" + i;
		document.getElementById(tabname).className='';
		document.getElementById(topicname).style.display="none";
		if (i != numberoftabs) {
			document.getElementById(spacername).className="spacer";
		}
	}
	
	// select the clicked tab and show the chosen topic
	tabname = "tab" + clickedtab;
	topicname = "topic" + clickedtab;
	document.getElementById(tabname).className="selected";
	document.getElementById(topicname).style.display="block";
	
	// switch the spacer classes around to match
	if (clickedtab == 1) {
		document.getElementById("spacer" + clickedtab).className="spacerselected"; //this is ok
	} else if (clickedtab == numberoftabs) {
		document.getElementById("spacer" + (eval(clickedtab-1))).className="spacerselected";
	} else {
		document.getElementById("spacer" + (eval(clickedtab-1))).className="spacerselected";
		document.getElementById("spacer" + clickedtab).className="spacerselected";
	}
}


/* the following two scripts are needed for "Email A Page" functionality */
function PopUp(a,features){
	if (!features) features='width=600,height=400,location=0,menubar=0,resizable=1,scrollbars=1,status=1,titlebar=1,toolbar=0,channelmode=0,directories=0,fullscreen=0';
	if (!/resizable/.test(features)) features+=',resizable=1';
	if (!/scrollbars/.test(features)) features+=',scrollbars=1';
	var w = window.open(a.href,a.target,features);
	try{ w.focus() }catch(e){}
	/*
	//It looks like the following was to work with auto-expanding code that no longer exists.
	//Since the popups open to a fixed height which should never be taller than the screen, I've removed it. -- Gavin
	try{
		AttachEvent(w,'load',function(){
			try{
				var bh = w.document.body.offsetHeight;
				var html = w.document.getElementsByTagName('html');
				if (html && html.length>0){
					var hh = html[0].offsetHeight;
					var sh = screen.availHeight;
					//alert('html: ' + hh + '\nbody: ' + bh + '\nscren: ' + sh);
					var y_delta = (hh + 50 > sh) ? (sh - hh - 50) : 0;
					w.resizeBy(0,y_delta);
				}
			}catch(e_inner){}
		},false);
	}catch(e){}
	*/

	return PreventDefault();
}

function PreventDefault(evt){
	//***Cross browser function to prevent the default action from occuring.
	if (!evt && window.event) evt=window.event;
	if (evt!=null){
		if (typeof(evt.preventDefault)=='function') evt.preventDefault();
		else evt.returnValue=false;
	}
	return false;
}

function jumpToLanguage(form) {
	var selIndex = form.newLanguage.selectedIndex;
	document.location = form.newLanguage.options[selIndex].value;
	return false;
}
