sfHover = function() 
{
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) 
	{
	sfEls[i].onmouseover=function() {
	this.className+=" sfhover";
	}
	sfEls[i].onmouseout=function() {
	this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
	}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);





function GetXmlHttpObject1()
{
var xmlHttp=null;
try
  {
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
function stateChanged1() 
{ 
	if (xmlHttp.readyState==4)
		{ 
			document.getElementById("popupContact").innerHTML=xmlHttp.responseText;
		}
}
function checkCat(str)  // Creates a new checkUser functtion.
{
	if (str.length==0)
  	{ 
		document.getElementById("popupContact").innerHTML="";
		return;
  	}
	xmlHttp=GetXmlHttpObject1(); 
	if (xmlHttp==null) // Checks whether the users browser allows ajax
  	{
		alert ("Please use a browser that has ajax enabled!"); // Alerts if the users browser does not support ajax
		return; // Returns the function
  	}
	
	var url="catcheck.jsp"; // Creates a new variable called url
	url=url+"?user="+str; // Assigns an id to the php file (usercheck.php?id=user)
	url=url+"&sid="+Math.random(); // Assigns a random math function to the url
	xmlHttp.onreadystatechange=stateChanged1; // If the forms state has changed
	xmlHttp.open("GET",url,true); // Gets a pages content using ajax
	xmlHttp.send(null);
}


/***************************/
//@Author: Adrian "yEnS" Mato Gondelle
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;

//loading popup with jQuery magic!
function loadPopup(){
	//loads popup only if it is disabled
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.8"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupContact").fadeIn("slow");
		popupStatus = 1;
	}
}

//disabling popup with jQuery magic!
function disablePopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupContact").fadeOut("slow");
		popupStatus = 0;
	}
}

//centering popup
function centerPopup(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupContact").height();
	var popupWidth = $("#popupContact").width();
	//centering
	$("#popupContact").css({
		"position": "absolute",
		"top": 25,
		"left": windowWidth/2-popupWidth/2
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight*1.5,
		"width": windowWidth
	});
}


//CONTROLLING EVENTS IN jQuery
$(document).ready(function(){
	
	//LOADING POPUP
	//Click the button event!
	$(".button8").click(function(){
		//centering with css
		centerPopup();
		//load popup
		loadPopup();
	});
	$(".button9").click(function(){
		//centering with css
		centerPopup();
		//load popup
		loadPopup();
	});
	
$("#linkclickhere").click(function(){
		//centering with css
		centerPopup();
		//load popup
		loadPopup();
	});

				
	//CLOSING POPUP
	//Click the x event!
	$("#popupContactClose").click(function(){
	disablePopup();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			disablePopup();
		}
	});

});



function showmap(map)
{	
	if (map ==1)
	{
	map = "<div id='popmap' class='maplondon'><p><a href=# id='popupContactClose' onclick='disablePopup();'>Close</a></p></div>";		
	}
	if (map ==2)
	{
	map = "<div id='popmap' class='mapnewyork'><p><a href=# id='popupContactClose' onclick='disablePopup();'>Close</a></p></div>";
	}
	if (map ==3)
	{
	map = "<div id='popmap' class='mapleeds'><p><a href=# id='popupContactClose' onclick='disablePopup();'>Close</a></p></div>";
	}

document.getElementById("popupContact").innerHTML=map;
return;
}

