// JavaScript Document
function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

var http = createRequestObject();

function sndReq(action) {
	showLayer("PleaseWait");
	http.open('get', action);
    http.onreadystatechange = handleResponse;
    http.send(null);
}

function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
        var update = new Array();

        if(response.indexOf('|' != -1)) {
            update = response.split('|');
            document.getElementById(update[0]).innerHTML = update[1];
        }
		hideLayer("PleaseWait");
    }
}

function openClass(classID)
{
	var url = "class.php#" + classID;
	var winName = "class";
	var props = "width=500,height=400,resizable=0,scrollbars=1,status=0,location=0,toolbar=0,menubar=0";
	window.open(url,winName,props);
}

function hideLayer(div) {
	document.getElementById(div).style.display ="none";
}

function showLayer(div) {
	document.getElementById(div).style.display ="block";
}

function showPleaseWait() {
	showLayer("PleaseWait");
	//showLayer("PleaseWaitIframe");
}

function hidePleaseWait() {
	hideLayer("PleaseWait");
	//hideLayer("PleaseWaitIframe");
}

function popGirl(imgNum) {
	var img = "images/ringgirl" + imgNum + "_full.jpg";
	var windowName = "ringgirl";
	var props = "status=0,location=0,menubar=0,toolbar=0,scrollbars=0,width=553,height=820";
	window.open(img,windowName,props);
}

function changeGirl(divId,imgId){
	document.getElementById(divId).innerHTML = "<a href=\"javascript:void(0);\" onclick=\"popGirl('" + imgId + "');return false;\"><img src=\"images/ringgirl" + imgId + ".jpg\" alt=\"\" style=\"width:200px;height:300px;border:none;\" /></a>";
}

function preloadImages(){
	var d=document; if(d.images)
	{
		if(!d.p) d.p=new Array();
		var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0)
		{
			d.p[j]=new Image;
			d.p[j++].src=a[i];
		}
	}
}
preloadImages('/images/nav_home_on.gif','/images/nav_about_on.gif','/images/nav_contact_on.gif','/images/nav_events_on.gif','/images/nav_eventspast_on.gif','/images/nav_fighters_on.gif','/images/nav_sponsors_on.gif');
