// JavaScript Document
$(document).ready(function(){
	$(".ui-slideopen").accordion({
		header: 'a.faq-question', 
		active: false, 
		alwaysOpen: false, 
		autoHeight: false 		
	});
});


jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++)
	{
		jQuery("<img>").attr("src", arguments[i]);
		/*top.location=arguments[i];*/
	}
	
}

function validcontact(tf) {
	msg='';
	if (tf.name.value == "") msg=msg+'Name is required\n';
	if (tf.company.value == "") msg=msg+'Company is required\n';
	if (tf.email.value == "") msg=msg+'Email is required\n';
	if (tf.telephone.value == "") msg=msg+'Telephone is required\n';
	if (msg!='') {
		alert ('You have the following errors in your form.\nPlease correct and resubmit.\n\n'+msg);
		return false
		}
	return true;
}

function setcur(){
	//changeClass(li,'current');
	for (i=0; i<document.links.length; i++) {
		if(document.links[i].parentNode.parentNode.parentNode.parentNode.id=='nav'&&location.href.indexOf(document.links[i])!=-1){
			document.links[i].parentNode.parentNode.parentNode.className="current expanded";
			document.links[i].parentNode.className="current";
		}
		if(document.links[i].parentNode.parentNode.id=='nav'&&location.href.indexOf(document.links[i])!=-1){
			document.links[i].parentNode.className="current";
		}
		if((location.href=='http://www.skyline.co.uk/hosted/stl/website/'||location.href=='http://www.stlcomms.com/')&&(document.links[i]=='http://www.skyline.co.uk/hosted/stl/website/default.asp'||document.links[i]=='http://www.stlcomms.com/default.asp')){
			document.links[i].parentNode.className="current";
		}
	}
}

function changeClass(Elem, myClass) {
	var elem;
	if(document.getElementById) {
		var elem = document.getElementById(Elem);
	} else if (document.all){
		var elem = document.all[Elem];
	}
	elem.className = myClass;
}
