
addEventXX(window, 'load', hackForLogin);



function hackForLogin() {                                    // hack to fix login float right with ie 7 and 8
	var eleLogin = document.getElementsByName('login');
	//alert(eleLogin.length);
	//alert("value is: " + eleLogin[0].action);
	if (eleLogin[0] != null) {
		eleLogin[0].parentNode.style.width='auto';
	}
}


function addEventXX(obj, evType, fn){ 
	if (obj.addEventListener){ 
		obj.addEventListener(evType, fn, false); 
		return true; 
	} else if (obj.attachEvent){ 
		var r = obj.attachEvent("on"+evType, fn); 
		return r; 
	} else { 
		return false; 
	} 
}




function breakout(cName, cZoom) {
    lnk = "/joomla/index.php?option=com_content&view=article&id=75&Itemid=63&detAName=" ;
    lnk += cName;
    lnk += "&detAZoom=";
    lnk += cZoom;
    if (window.top!=window.self) {
        window.top.location = lnk;
    }
}


function breakout2Link(lnk)  {
    if (window.top!=window.self) {
        window.top.location = lnk;
    }
}


function breakout2Article(num)  {
    lnk = "/joomla/index.php?option=com_content&view=article&id=" + num;
    if (window.top!=window.self) {
        window.top.location = lnk;
    }
}

// Blake
function breakout2Home()
{
   // go to home page
   lnk = "/joomla/index.php" ;
   if (window.top!=window.self) {
      window.top.location = lnk;
   }
}



var ajaxObj = null;
var cCode = -7;


function getAjaxObj() {

    // native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
        try {
            req = new XMLHttpRequest();
        } catch(e) {
            req = false;
        }
    // IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
        try {
            req = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                req = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                req = false;
            }
        }
    } else {
        req = false;
    }

    return req;

}



function setOutput() {
    if (ajaxObj.readyState == 4) {

        if (ajaxObj.status != 200) {
            alert("Ajax Request Error: " + ajaxObj.status);
        } else {
            //var cType = ajaxObj.getResponseHeader("Content-Type")
            //alert("type " + cType);
            var respObj = JSON.parse(ajaxObj.responseText);
            cCode = respObj.cCode;
            //alert("cCode " + cCode);
        }

    }
}



function getClubID() {
    ajaxObj = getAjaxObj();
    if (ajaxObj != null) {
        ajaxObj.open("GET", "/joomla/CourseDetails/php/serveClubID.php?cachebuster=" + new Date().getTime(), true);
        ajaxObj.send(null);
        ajaxObj.onreadystatechange = setOutput;
    } else {
      alert("Failed to get Ajax Object.");
    }
}



function processOptions(poForm) {
    promoOption = -1;

    for (i=0;i<poForm.promo.length;i++) {
        if (poForm.promo[i].checked) {
            promoOption = poForm.promo[i].value;
        }
    }

    if (promoOption == -1) {
        alert("Please select 'Create', 'Edit' or 'Review'");
        return (false);
    }

    if (promoOption == 1) {
        poForm.action = "/joomla/index.php?option=com_content&view=article&id=122&code=" + cCode;
        return (true);
    }
    if (promoOption == 2) {
        alert("Sorry!  Only 'create' is available at the moment.");
        return (false);
    }
    if (promoOption == 3) {
        alert("Sorry!  Only 'create' is available at the moment.");
        return (false);
    }

    return (false);
}



