/************************************************************
COMMON JS Elements
RibbitFlightSchool.com
Last modified 12-7-2008
************************************************************/
/******************************
DIV DISPLAY TOGGLE
******************************/
function divToggle(id, theclass) {
	/*
	if ($(id).className==theclass) {
		$(id).className=theclass + " display_none";
	} else {
		$(id).className=theclass;
	}
	*/
}
function divClassChange(id, theclass) {
	id = id;
	$(id).attr("class",theclass);
}

/******************************
AJAX
******************************/
//initiates a new xho for multiple browsers
function getXmlHttpObject() {
	var xmlHttp=null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}



/****************************************
POPUP
*****************************************/
function openPopup(url, lwidth, lheight) {
	var lscreenX = ( screen.width - lwidth ) / 2;
	var lscreenY = ( screen.height - lheight ) / 2;
	if(( lscreenX % 1 ) > 0 )

                   lscreenX = lscreenX + .5;

       if(( lscreenY % 1 ) > 0 )

                   lscreenY = lscreenY + .5;

       var strOptions =

              "width=" + lwidth + ",height=" + lheight

              + ",toolbar=no,scrollbars=yes,top=" + lscreenY + ",left=" + lscreenX;

 

       newWin = window.open(url, "openWin", strOptions);

       if (!newWin.closed)

             newWin.focus();

}

//IE silliness
if(!Array.indexOf){
	Array.prototype.indexOf = function(obj){
		for(var i=0; i<this.length; i++){
			if(this[i]==obj){
				return i;
			}
		}
		return -1;
	}
}
