function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  adjustMyFrameHeight(myHeight);
}


    function getElement(aID)
    {
        return (document.getElementById) ?
            document.getElementById(aID) : document.all[aID];
    }

    function getIFrameDocument(aID){ 
        var rv = null; 
        var frame=getElement(aID);
        
	if (frame.contentDocument)
        rv = frame.contentDocument;
        else 
        rv = document.frames[aID].document;
        return rv;
    }

    function adjustMyFrameHeight(height)
    {
        var frame = getElement("myFrame");
        //var frameDoc = getIFrameDocument("myFrame");
        //frame.height = frameDoc.body.offsetHeight;
        var newHeight = height - 185;
	if (frame != undefined)
	{
        	frame.height = newHeight;
	}
    }

function xmlhttpPost(myurl,mysection,mycourse,mydirection)
{
    var filename = myurl.substring(myurl.lastIndexOf('/')+1);
    var strURL = "geturl.php";
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest)
    {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject)
    {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function()
    {
        if (self.xmlHttpReq.readyState == 4)
        {
            updatepage(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(getquerystring(filename,mysection,mycourse,mydirection));
}

function getquerystring(myurl,mysection,mycourse,mydirection) {
    
	qstr = 'myurl=' + escape(myurl) +'&mysection=' + escape(mysection)+'&mycourse='+escape(mycourse)+'&mydirection='+escape(mydirection);  // NOTE: no '?' before querystring
    return qstr;
}

function updatepage(str)
{

	var myArray = str.split("|");
	//alert(str);	
	if (myArray[2]>0)
	{
		//special case, update whole page
		top.location.href=myArray[4]+"?id="+myArray[2];
	}
	else
	{
		//lets just change frame
		//parent.myFrame.location.href="/hmm/"+myArray[1]+"/"+myArray[0];
		document.getElementById('myFrame').src = "/hmm/"+myArray[1]+"/"+myArray[0];
		
	}	
	
}

function showMKUser(tid)
{
window.open('/elc/user/popview.php?id='+tid+'&course=1','showuser','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,scrollbars=yes,width=550,height=400');
}
function goforward(myurl,mysection,mycourse)
{
	var filename = myurl.substring(myurl.lastIndexOf('/')+1);
	alert(filename+","+mysection+","+mycourse);
}

