/*
	COMIT JAVASCRIPT
	CREATED: 01.02.08
	MODIFIED: 01.05.08
	AUTHOR: ANDY FIELD
*/

/* MATRIX
******************************************/

function viewLesson(llid) {
	//window.open("viewlesson.jsp?llid=" + llid,"llWin","toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=450,height=200");
	window.location.href="viewlesson.jsp?llid=" + llid;
}

function sendFeedback( url, title ) {
	var cr = String.fromCharCode(0013) + String.fromCharCode(0013);
	if(url!="") {
			if(url.charAt(0)=="/") {
					var root="http://www.comitproject.org.uk";
					var newUrl;
					newUrl=" at " + root + url;
			} else {
					newUrl=" at " + escape(url);
			}
	}
	var messageBody="Dear COMIT, " + '%0\A%0\D' + "I would like to submit the following comments relating to your COMIT article " + title + newUrl + ":" + '%0\A%0\D';
	location.href="mailto:gerry.samuelsson-brown@comitproject.org.uk?subject=COMIT - Feedback on " + title + "&body=" + messageBody;
}

function sendToFriend( url, title ) {
	var cr = String.fromCharCode(0013) + String.fromCharCode(0013);
	if(url!="") {
			if(url.charAt(0)=="/") {
					var root="http://www.comitproject.org.uk";
					var newUrl;
					newUrl=" at " + root + url;
			} else {
					newUrl=" at " + escape(url);
			}
	}
	var messageBody="Hi, " + '%0\A%0\D' + "I found the following article on the COMIT website and thought you might be interested, please click the link below:" + '%0\A%0\D' + "COMIT article: " + title + newUrl + ".";
	messageBody=messageBody + '%0\A%0\D' + "Kind Regards";
	location.href="mailto:?subject=COMIT Article - " + title + "&body=" + messageBody;
}

function check_keywordsearch() {
	if(document.keywordsearch.keywords.value=="") {
			alert("Please enter at least one word to search for");
			return false;
	}
}

function check_alphabeticalsearch() {
	if(document.alphabeticalsearch.keywords.selectedIndex==0) {
			alert("Please select a letter from the list");
			return false;
	}
}

/* TOOGLE
******************************************/

function toggleLayer( whichLayer )
{
	var elem, vis;
  	if( document.getElementById ) // this is the way the standards work
    	elem = document.getElementById( whichLayer );
	  else if( document.all ) // this is the way old msie versions work
		elem = document.all[whichLayer];
	else if( document.layers ) // this is the way nn4 works
		elem = document.layers[whichLayer];
	vis = elem.style;
  // if the style.display value is blank we try to figure it out here
	if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
		vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
	vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

/* SEARCH CHECK
******************************************/

function searchCheck() {
	if(document.quicksearch.term.value=="") {
			alert("Please enter something to search for");
			return false;
	}
}

/* COMMUNITY ROLLOVERS
******************************************/

img2=new Image();
img2.src="/images/construct.jpg";
img3=new Image();
img3.src="/images/tech.jpg";
img4=new Image();
img4.src="/images/trade.jpg";
img5=new Image();
img5.src="/images/rnd.jpg";
img6=new Image();
img6.src="/images/centre.jpg";

function imageswap(rep,pic)
{
document.images[pic].src=rep;
}

/* EXTERNAL LINKS
******************************************/

function externalLinks() { 
	if (!document.getElementsByTagName) return; 
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) { 
		var anchor = anchors[i]; 
		if (anchor.getAttribute("href") && 
	anchor.getAttribute("rel") == "external") 
	anchor.target = "_blank"; 
	} 
}

/* HACK TO GET MULTIPLE INSTANCES OF ONLOAD WORKING */

function multipleOnload()
{
	externalLinks();
}
window.onload = multipleOnload;



