/*var throbber = "http://portal.campus-connect.com/images/campus_throbber.gif";*/

var xmlhttp=false;
/*if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 	try {
 		 xmlhttp = new XMLHttpRequest();
 	} catch (e) {
 		 xmlhttp=false;
 	}
}*/

/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
if (!xmlhttp){
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
}
@end @*/

/*if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}*/

/* Ultimater's edited version of:
   http://javascript.internet.com/ajax/ajax-navigation.html */

/*var please_wait = "<br><img src=\""+throbber+"\">";

function open_url(url, targetId) {
  if(!xmlhttp)return false;
    var e=document.getElementById(targetId);if(!e)return false;
    if(please_wait)e.innerHTML = please_wait;
    xmlhttp.open("GET", url, true);
    xmlhttp.onreadystatechange = function() { response(url, e); }
    try{
      xmlhttp.send(null);
    }catch(l){
    while(e.firstChild)e.removeChild(e.firstChild);//e.innerHTML="" the standard way
    e.appendChild(document.createTextNode("request failed"));
  }
}

function response(url, e) {
  if(xmlhttp.readyState != 4)return;
    var tmp= (xmlhttp.status == 200 || xmlhttp.status == 0) ? xmlhttp.responseText : "Ooops!! A broken link! Please contact the webmaster of this website ASAP and give him the following error code: " + xmlhttp.status+" "+xmlhttp.statusText;
    var d=document.createElement("div");
    d.innerHTML=tmp;
    setTimeout(function(){
      while(e.firstChild)e.removeChild(e.firstChild);//e.innerHTML="" the standard way
      e.appendChild(d);
    },10)
}*/






//////////////   NEW OPEN URL FUNCTION ////////////////////////
function open_url(url, mydiv, method, querystring, funct, functParams, throbber)
	{
		
		var myRequest = new ajaxObject(url, open_url_new_action);
		if(method == 'get' || method == 'GET')
        myRequest.update(mydiv, querystring, 'get', funct, functParams, throbber);
		if(method == 'post' || method == 'POST')
        myRequest.update(mydiv, querystring, 'post', funct, functParams, throbber);
		
	}

function open_url_new_action(responseText, responseStatus, responseXML, divid, funct, parameters)
{
					if (responseStatus == 200) 
						{
						  document.getElementById(divid).innerHTML=responseText;
						  if(funct !=null)
						  funct();
						} 
					else 
			            {
			             alert(responseStatus);
			            }	
}

////////////////  OPEN URL FOR ----- DYNAMIC LINKS ////////////////////////
//////////////   NEW OPEN URL FUNCTION ////////////////////////
function open_dyna_url(url, mydiv, method, querystring, funct, functParams)
	{
		if(mydiv != 'myaccount_left_main' && mydiv != 'user_profile_left_main' && mydiv != 'cor_body')
		{
		var divid= mydiv+'_out';
		var obj=document.getElementById(divid);
		obj.style.visibility = "visible";
		//alert(obj);
		}
	//alert(functParams);
		var hiddenID = url.substring(0,(url.length - 4));
		if(!document.getElementById(hiddenID))
		{
		var myRequest = new ajaxObject(url, open_url_dyna_action);
		if(method == 'get' || method == 'GET')
        myRequest.update(mydiv, querystring, 'get', funct, functParams);
		if(method == 'post' || method == 'POST')
        myRequest.update(mydiv, querystring, 'post', funct, functParams);	
		}
	}

function open_url_dyna_action(responseText, responseStatus, responseXML, divid, funct, parameters)
{  
					if (responseStatus == 200) 
						{
							if(document.getElementById(divid))
						  		document.getElementById(divid).innerHTML=responseText;
							
						  if(funct !=null)
						  funct();
						} 
					else 
			            {
			             alert(responseStatus);
			            }	
}




function trimEmptyDynamicDivs(divids)
	{
		divarray = divids.split(',');
		for(i=0; i < divarray.length; ++i)
			{
				if(document.getElementById(divarray[i]+'_out'))
				{
				var obj=document.getElementById(divarray[i]+'_out');
				obj.style.visibility = "hidden";
				}
			}
	}