// JavaScript Document
var Xcoord = 270;
var Ycoord;
var x = 1;


/*window.onload = init;
function init() {
  if (window.Event) {
    document.captureEvents(Event.MOUSEMOVE);
  }
  document.onmousemove = getXY;
}

function getXY(e) {
  x = (window.Event) ? e.pageX : event.clientX;
  y = (window.Event) ? e.pageY : event.clientY;

  document.ee.sd.value = x+":"+y;
}*/

// get width of the browser
function GetWidth()
{
        var x = 0;
        if (self.innerHeight)
        {
                x = self.innerWidth;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
        {
                x = document.documentElement.clientWidth;
        }
        else if (document.body)
        {
                x = document.body.clientWidth;
      	}
		return x;
};



function anything(e){	
	
	Ycoord = e.pageY - 70;
	MidWidth = GetWidth() / 2;
	Xcoord = ((window.Event) ? e.pageX : event.clientX) - MidWidth + 520; //position of event - MidWidth + 520(half of template width)
	obj = 'help_box';
	document.getElementById(obj).style.top = Ycoord + "px";
	document.getElementById(obj).style.left = Xcoord + "px";
	//alert('fired' + Ycoord + ' ' + Xcoord + " X = " + x);
	//alert(x);
	$('#help_heading').html('English for Academic Purposes (EAP)');
	$('#help_text').html('A language course that includes learning skills and vocabulary appropriate for study and is designed to support students in their academic education.');
	//if (x%2 == 0) {setYLVisible(obj);}
	if (document.getElementById(obj).style.visibility = 'hidden'){		
	setYLVisible(obj);
	};
	x= x+1;	
};

function lectures(e){
	Ycoord = e.pageY - 60;
	MidWidth = GetWidth() / 2;
	Xcoord = ((window.Event) ? e.pageX : event.clientX) - MidWidth + 475; //position of event - MidWidth + 520(half of template width)
	//Xcoord = e.pageX / 2;
	obj = 'hover_box';
	document.getElementById(obj).style.top = Ycoord + "px";
	document.getElementById(obj).style.left = Xcoord + "px";
	//alert('fired' + Ycoord + ' ' + Xcoord + " X = " + x);
	//alert(x);
	$('#hover_heading').html('<span style="color:#66cc00">Lectures</span>');
	$('#hover_text').html('These cover a variety of topics from discussions on current affairs, British life and culture and the English language.');
	//if (x%2 == 0) {setYLVisible(obj);}
	if (document.getElementById(obj).style.visibility = 'hidden'){		
	setYLVisible(obj);
	};
	x= x+1;	
};

function one2one(e){
	Ycoord = e.pageY - 60;
	MidWidth = GetWidth() / 2;
	Xcoord = ((window.Event) ? e.pageX : event.clientX) - MidWidth + 475; //position of event - MidWidth + 520(half of template width)
	//Xcoord = e.pageX / 2;
	obj = 'hover_box';
	document.getElementById(obj).style.top = Ycoord + "px";
	document.getElementById(obj).style.left = Xcoord + "px";
	//alert('fired' + Ycoord + ' ' + Xcoord + " X = " + x);
	//alert(x);
	$('#hover_heading').html('<span style="color:#ffcc00">1 to 1 tuition</span>');
	$('#hover_text').html('In consultation with you, a teacher develops a tailor-made programme to develop your English language skills.');
	//if (x%2 == 0) {setYLVisible(obj);}
	if (document.getElementById(obj).style.visibility = 'hidden'){	
	setYLVisible(obj);
	};
	x= x+1;	
};

function dstudy(e){
	Ycoord = e.pageY - 60;
	MidWidth = GetWidth() / 2;
	Xcoord = ((window.Event) ? e.pageX : event.clientX) - MidWidth + 475; //position of event - MidWidth + 520(half of template width)
	//Xcoord = e.pageX / 2;
	obj = 'hover_box';
	document.getElementById(obj).style.top = Ycoord + "px";
	document.getElementById(obj).style.left = Xcoord + "px";
	//alert('fired' + Ycoord + ' ' + Xcoord + " X = " + x);
	//alert(x);
	$('#hover_heading').html('<span style="color:#ff0099">Directed study</span>');
	$('#hover_text').html('Your teacher will set a personalised programme of study for you to complete each week in your own time. You can complete this in the study centre or at home. Your attendance will be recorded and your progress measured.');
	//if (x%2 == 0) {setYLVisible(obj);}
	if (document.getElementById(obj).style.visibility = 'hidden'){	
	setYLVisible(obj);
	};
	x= x+1;
};

function gstudy(e){
	Ycoord = e.pageY - 60;
	MidWidth = GetWidth() / 2;
	Xcoord = ((window.Event) ? e.pageX : event.clientX) - MidWidth + 475; //position of event - MidWidth + 520(half of template width)
	//Xcoord = e.pageX / 2;
	obj = 'hover_box';
	document.getElementById(obj).style.top = Ycoord + "px";
	document.getElementById(obj).style.left = Xcoord + "px";
	//alert('fired' + Ycoord + ' ' + Xcoord + " X = " + x);
	//alert(x);
	$('#hover_heading').html('<span style="color:#339966">Guided study</span>');
	$('#hover_text').html('Take advantage of a variety of learning materials and advice from teachers in the study centre. The number of guided study hours for each course is our recommendation, however you can also access the study centre at other times.');
	//if (x%2 == 0) {setYLVisible(obj);}
	if (document.getElementById(obj).style.visibility = 'hidden'){	
	setYLVisible(obj);
	};
	x= x+1;
};

function group(e){
	Ycoord = e.pageY - 60;
	MidWidth = GetWidth() / 2;
	Xcoord = ((window.Event) ? e.pageX : event.clientX) - MidWidth + 475; //position of event - MidWidth + 520(half of template width)
	//Xcoord = e.pageX / 2;
	obj = 'hover_box';
	document.getElementById(obj).style.top = Ycoord + "px";
	document.getElementById(obj).style.left = Xcoord + "px";
	//alert('fired' + Ycoord + ' ' + Xcoord + " X = " + x);
	//alert(x);
	$('#hover_heading').html('<span style="color:#ff6600">Group tuition</span>');
	$('#hover_text').html('Time spent in class with your teacher and fellow students.');
	//if (x%2 == 0) {setYLVisible(obj);}
	if (document.getElementById(obj).style.visibility = 'hidden'){	
	setYLVisible(obj);
	};
	x= x+1;
	};






function setDim (id_d, h) {  
document.getElementById(id_d).style.height=h + "px";
//alert("setDim Fired");
}

function getDim (id) {  
document.getElementById(id).style.height="auto";
// match box models
if (document.all) {
gh = document.getElementById(id).offsetHeight+10;
}
else {
gh = document.getElementById(id).offsetHeight;
}

if (/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)){
	//alert("isIE");
	h = gh-30;
}
else {	
h = gh-20;
}

//alert ("getDim fired h = " + h);


switch (id)
{
	case "hover_box":
	setDim("hover_box_l", h);
	setDim("hover_box_r", h);
	break;
	case "help_box":
	setDim("hover_box_l", h);
	setDim("hover_box_r", h);
	break;
	case "timetable_hover":
	setDim("timetable_hover_l", h);
	setDim("timetable_hover_r", h);
	break;
	
}

}



function setYLVisible(obj)
{
	getDim(obj);
	obj = document.getElementById(obj);
	obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
}
