var dDate = new Date();
	dDate.setHours(0,0,0);
var v, g, so;
var vendor, resIDs=new Array(), classSlotIDs=new Array(), eventID, service;

function initResIDs(user,rs) {
	resIDs[user]=new Array(rs);
    classSlotIDs[user]=new Array(rs);
}
function addResID(user,index,resID, classSlotID) {
	resIDs[user][index] = resID;
    classSlotIDs[user][index] = classSlotID;
}
function showTables(eventType){
	var el=document.getElementById("stub");
	if(el!=null)
		el.style.display="none";
	el=document.getElementById("blueMess");
	if(el!=null)
		el.style.display="";
	var schtab=document.getElementById("schooltab");
	if (schtab != null) { // this is because the mac needs a kick to relay out the table.
		var row = schtab.rows[0];
		if (row != null && row.cells.length > 1) {
			row.cells[1].style.display="none";
		}
	}
	for(userID in resIDs){
		var table=document.getElementById("tableid"+userID);
		if(table!=null)
			table.style.display="";
	}
	if (schtab != null) { // this is because the mac needs a kick to relay out the table.
		var row = schtab.rows[0];
		if (row != null && row.cells.length > 1) {
			row.cells[1].style.display="";
		}
	}
}
function resizeTable(){
	var buttons = new Array("hideshowImg", "hideshowImg2");
	var i, img;
	for(i in buttons){
		img =document.getElementById(buttons[i]);
		if(img!=null && img.style.display=="none")
			img.style.display="";
	}
	var base=document.getElementById("studentTables");
	if(base==null)
		return;
	var pickad=document.getElementById("pickad");
	var newHeight=document.body.clientHeight-base.offsetTop;
	if (pickad!=null)
		newHeight -= pickad.offsetHeight;
    newHeight -= 110;
	if (newHeight>0)
        for(userID in resIDs){
            var resCol=document.getElementById("res"+userID);
            if(resCol!=null && resCol.clientHeight > newHeight)
                resCol.style.height=newHeight;
        }

    if (base.maxWidth == null)
        base.maxWidth = base.offsetWidth;

    var colCount = document.getElementById('schooltab').rows[0].cells.length;
    var newWidth = document.body.offsetWidth - 30;

    if (colCount == 2)
    {
        if (document.getElementById("Whateverid") == null)
            newWidth -= (document.getElementById('divLegend').offsetWidth  + 30);
        else
            newWidth -= 320;
    }
    else if (colCount == 3)
        newWidth -= (document.getElementById('divLegend').offsetWidth + 330);

    if (newWidth > 250)
        base.style.width = (newWidth  < base.maxWidth)? newWidth : ((/MSIE (\d+\.\d+);/.test(navigator.userAgent))? base.maxWidth : "100%");
}
function displaylogo()
{
	var frs = window.parent.document.getElementById('top_frameset');
    document.getElementById("logoImage").style.display=(frs!=null)?"none":"";
    document.getElementById('LinkMenuDiv').style.marginBottom = (frs!=null)?"15px": "45px";
}
function hideShow(){
	if(type == typeMICROSOFT && document.readyState != "complete")
		return;

	var table=document.getElementById("schedule");
	var img =document.getElementById("hideshowImg");
    var linkyourschedule=document.getElementById("yourschedule");

    if(table!=null)
    {
        if(table.style.display==""){
            table.style.display="none";
            if(linkyourschedule!=null)
            linkyourschedule.innerHTML = "Show Your Schedule";
            
            if (img!=null)
            {
                img.src="images/show.gif";
                img.title="show the appointments scheduled by you";
                img.alt="show the appointments scheduled by you";
            }
        }
        else{
            table.style.display="";
            if(linkyourschedule!=null)
            linkyourschedule.innerHTML = "Hide Your Schedule";
           
            if (img!=null)
            {
                img.src="images/hide.gif";
                img.title="hide the appointments scheduled by you";
                img.alt="hide the appointments scheduled by you";
            }
        }
        resizeTable();
    }
    else
    {

    }
}

function hideTeach(left){
	if(type == typeMICROSOFT && document.readyState != "complete")
		return;
	var table=document.getElementById("resource_table");
	var img =document.getElementById("hideshowImg2");
	var colorid = document.getElementById("clickbelow");
	var blueMess = document.getElementById("blueMess");
    var scheduledAppt = document.getElementById("scheduledAppt");
    var unavailableAppt = document.getElementById("unavailableAppt");
    if(table==null)
		return;
	if(table.style.display==""){
		table.style.display="none";
		img.src="images/show.gif";
		img.title="show the legend";
        if (left){
             colorid.style.display="none";
		     if (blueMess != null)
				blueMess.style.display="";
        }
        else{
             colorid.style.display = document.getElementById("schooltab")? "": "none";
             if (blueMess != null)
				blueMess.style.display="none";
             if (scheduledAppt != null)
				scheduledAppt.style.display="none";
             if (unavailableAppt != null)
				unavailableAppt.style.display="none";
         }
    }
	else{
		table.style.display="";
		img.src="images/hide.gif";
		img.title="hide the legend";
		colorid.style.display="none";
		if (blueMess != null) blueMess.style.display="";
        if (scheduledAppt != null) scheduledAppt.style.display="";
        if (unavailableAppt != null) unavailableAppt.style.display="";
    }

	resizeTable();
}
function notifyParent() {
	try {
		var bod = document.body;
		var el = parent.window.document.getElementById("theiframe");
		if (el != null) {
			el.height = bod.scrollHeight+20;
		}
	} catch (e) {
		return;
	}
}

function setRptLinks(){
    var obj = document.getElementById("tdBookAppt");
    
    if(obj == null)
        return;

    try{
        rptVenID;
    }catch(e){
        return;
    }

    if(obj.style.display == "none" && rptVenID > 0){
        var a = document.getElementById("aBookAppt");
        a.href = "client?ven=" + rptVenID + "&event="+ rptEventID;
        obj.style.display = "";
    }
}

function hideStudentTeachers(id){
	var arr = document.getElementsByName(id);
	var img = document.getElementById("hideshow" + id);
	var hidden = img.getAttribute("hidden")==true || img.getAttribute("hidden")=='true';

	img.setAttribute("hidden", !hidden);
	img.src = hidden? "images/hide.gif": "images/show.gif";
	img.title = hidden? "hide student's teachers": "show student's teachers";

	for(var i = 0; i < arr.length; i++)
		arr[i].style.display = hidden? "": "none";
}

function PayPalChangeSum()
{
    document.getElementsByName("paypalcheckout").item(0).amount.value = document.getElementsByName("googlecheckout").item(0).item_price_1.value;
    document.forms["paypalcheckout"].submit();
}


