/* ==============================YourStudentCentre.com Basic Javascrit Functions==============================This Javascript cucumber was pickled by:>> Robin Wallar at See Design>> www.seedesign.ca | robin [at] seedesign.ca------------------------------Written with massive mits on while scraping ice of the screenof my icicle that serves as a monitor. ------------------------------------------------------------Feel free to use this to educateyourself on the wonders of javascript.If you plan on copying something directly please contact us. ------------------------------*/var checkflag = "false";function check(field) {	if (checkflag == "false")	{		for (i = 0; i < field.length; i++)		{			field[i].checked = true;		}		checkflag = "true";		return "Uncheck All"; 	}else{		for (i = 0; i < field.length; i++)		{			field[i].checked = false;		}		checkflag = "false";		return "Check All";	}}function confirm_do(){	var confirmed = confirm("Are you sure you want to do that?");	if(confirmed)	{		return true;	}else{		return false;	}}function check_form(error, get_field){	if(get_field=="")	{		alert(error);			return false;	}else{		return true;	}}/*this will get the style attributes of a css element - ussualyl a div or span */function getStyleObject(objectId) {    // cross-browser function to get an object's style object given its    if(document.getElementById && document.getElementById(objectId)) {	// W3C DOM	return document.getElementById(objectId).style;    } else if (document.all && document.all(objectId)) {	// MSIE 4 DOM	return document.all(objectId).style;    } else if (document.layers && document.layers[objectId]) {	// NN 4 DOM.. note: this won't find nested layers	return document.layers[objectId];    } else {	return false;    }} // getStyleObjectfunction view_news(url){	window.location.href = url;}	/* Nav Hack for IE */function startList() {	if(document.all && document.getElementById)	{		navRoot = document.getElementById("nav_primary");		for (i=0; i<navRoot.childNodes.length; i++)		{			node = navRoot.childNodes[i];			if (node.nodeName=="LI")			{				node.onmouseover=function()				{					this.className+=" over";				}				node.onmouseout=function()				{					this.className=this.className.replace					(" over", "");			 	}			}		}	}}/* End Nav Hack for IE *//*preload images function*/var preloaded = new Array();function preload_images(){    for (var i = 0; i < arguments.length; i++)	{        preloaded[i] = document.createElement('img');        preloaded[i].setAttribute('src',arguments[i]);    };};/*validate the contact form*/function  validate_contact(){	if(document.contact.name.value!="")	{		var email_reg=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;		if(email_reg.test(document.contact.email.value))		{			if(document.contact.body_txt.value!="")			{									return true;			}else{				alert("Please enter content");				return false;			}		}else{			alert("Please enter a real email");			return false;		}	}else{		alert("Please enter your name");		return false;	}			}		/*validate the email list subscription and send to server for processing*/function mlist_send_signup(){	var email_reg=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;	if(email_reg.test(document.mlist_signup.email.value))	{					var poststr = "email=" + encodeURI(document.mlist_signup.email.value ) +				"&mlist=" + encodeURI(document.mlist_signup.mlist_check.value);							makePOSTRequest('ajax/mlist_signup.php', poststr, 'mlist');		return true;	}else{		alert("Please enter a real email");		return false;	}}/*this will be used to post ajax forms on enter - making IE sit in corner */function submit_on_enter(input){    input.onkeydown = function(e)	{		e = e || window.event;		if (e.keyCode == 13)		{			var email_reg=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;			if(email_reg.test(input))			{					mlist_send_signup(document.getElementById('mlist_signup'))				return false;			}		}		}}/*********OVERLAY FUNCTIONS*********/var overlay_opac=0;function open_overlay(){	style_overlay = document.getElementById('overlay').style;	document.getElementById('overlay_admin').visibility="hidden";	style_overlay.width="100%";		this.overlay_opac += .2;		if (this.overlay_opac <= .8)	{		style_overlay.opacity = this.overlay_opac;		timer =	setTimeout('open_overlay()', 0);	}else{	}	}/*File listing stuff*/var file_field="file_list";var file_id;var mini_cal_ids = new Array();function assign_file_field(input){	this.file_field.value = input;		document.getElementById(this.file_id).innerHTML = "";}function file_list_close(){	document.getElementById(this.file_id).innerHTML = "";}function file_list(url, field, span){	this.file_field=field;	this.file_id = span;	ajax(url, span);}/*ende file listing stuff*//*swap testimony content to show the full testimony*/function testimony_swap_content(){	var viewer_id = document.getElementById('testimony_viewer');	var hider_id =document.getElementById('testimony_hider');	var viewer_link = document.getElementById('testimony_link');		if(viewer_link.innerHTML == "LESS")	{		viewer_link.innerHTML = "MORE";	}else{		viewer_link.innerHTML = "LESS";	}			var viewer = viewer_id.innerHTML;	var hider =hider_id.innerHTML;		viewer_id.innerHTML = hider;	hider_id.innerHTML = viewer;	}function show_div(id){	gebi(id).style.overflow = "visible";	gebi(id).style.visibility = "visible";	}function hide_div(id){	gebi(id).style.overflow = "hidden";	gebi(id).style.visibility = "hidden";}function popup(url){	 window.open(url,'name','height=220,width=320,left=100,top=100,resizable=no,scrollbars=no,toolbar=no,status=no'); 	}