// JavaScript Document
document.write("<div id=\"DimShade\" style=\"position:absolute; left:0px; top:0px; width:10px; height:10px; z-index:90000; background-color:#333333; layer-background-color: #333333; border: 1px none #000000; filter: alpha(opacity=80);-moz-opacity:.80;opacity:.80; visibility: hidden\"></div>");
document.write("<div id=\"calendarContent\" align=\"center\" style=\"position:absolute; left:0px; top:0px; width:400px; z-index:100000; border: 1px solid #000000; visibility: hidden; background-color: #ffffff; layer-background-color: #ffffff; padding:10px;\">HERE</div>");
            
			// width:451px; height:309px;
			//<div id="createLogin" align="center" style="position:absolute; left:0px; top:0px; width:451px; height:309px; z-index:100000; border: 1px solid #000000; visibility: hidden; background-color: #ffffff; layer-background-color: #ffffff;"> 
var IsNote = 0;

function growDim(){
	IsNote = 1;

	document.getElementById("DimShade").style.visibility = "visible";
	document.getElementById("DimShade").style.left = 0;
	document.getElementById("DimShade").style.top = 0;
	
	resizeNote();
}
function showCalendarContent(){
	growDim();

	document.getElementById("calendarContent").style.visibility = "visible";				 
}
/*
function addSupportTicket(){
	growDim();

	document.getElementById("createTicket").style.visibility = "visible";				 
}
*/
function resizeNote(){
	if (IsNote == 1){
		document.getElementById("DimShade").style.height = document.body.scrollHeight;
		document.getElementById("DimShade").style.width = document.body.scrollWidth;
		
		//Create Login
		var w = document.getElementById("calendarContent").style.width;
		//var h = document.getElementById("createLogin").style.height;
		//h = parseInt(document.body.clientHeight) - parseInt(h);
		//h = h/2;
		w = parseInt(document.body.clientWidth) - parseInt(w);
		w = w/2;
		document.getElementById("calendarContent").style.top = 20;
		document.getElementById("calendarContent").style.left = w;
	}
}
function closeAll(){
	IsNote = 0;
	
	document.getElementById("calendarContent").style.visibility = "hidden";
	document.getElementById("DimShade").style.visibility = "hidden";
	//document.getElementById("createTicket").style.visibility = "hidden";
}

var xmlHttp;

function getCalendarContent(url){

				xmlHttp=GetXmlHttpObject()
				if (xmlHttp==null){
					alert ("Browser does not support HTTP Request")
					return
				} 
				
				//if (studyid == ""){
				//	document.getElementById("Quizes").innerHTML = "[Select A Study First]";
				//}
				//else{
				//	document.getElementById("Quizes").innerHTML = "Finding Quizes...";
					//var url="content.html"
					//var url="popup_details.php"
						url=url+"&sid="+Math.random()
						//url=url+"&eventid=13"
						//url=url+"&quizid="+quizid
					xmlHttp.onreadystatechange=ContentReturned 
					xmlHttp.open("GET",url,true)
					xmlHttp.send(null)
				//}
} 

function float(url){

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
	} 
				
	if (url.indexOf("?") == -1){
		url=url+"?sid="+Math.random()
	}
	else{
		url=url+"&sid="+Math.random()
	}

	xmlHttp.onreadystatechange=ContentReturned 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
} 

function ContentReturned(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		document.getElementById("calendarContent").innerHTML = xmlHttp.responseText;
		showCalendarContent();
	} 
} 

			function GetXmlHttpObject(){ 
				var objXMLHttp=null
				if (window.XMLHttpRequest){
					objXMLHttp=new XMLHttpRequest()
				}
				else if (window.ActiveXObject){
					objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
				}
				return objXMLHttp
			} 

function getAJAXData(url){

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
	} 
	
	if (url.indexOf("?") < 0){
		url=url+"?sid="+Math.random()
	}
	else{
		url=url+"&sid="+Math.random()
	}

	xmlHttp.onreadystatechange=DataReturned
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
} 

function DataReturned(){
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		document.getElementById(returndiv).innerHTML = xmlHttp.responseText;
	} 
} 
