function makeCookie()
	{
	createCookie ('firstvisit', 'this visitor has already visited', 3);
	}
	
	
	
function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  }            
} 
	
	

function setVideoState(videoOn)
{	
	
	createCookie("videocookie", videoOn, 14);
	
}

function setVolume(vol)
{	
	
	createCookie("volumecookie", vol, 14);
}

function getCookie(name) {
    var sPos = document.cookie.indexOf(name + "=");
	
    var len = sPos + name.length + 1;
	   
    if(sPos == -1){
        return null;
    }
			
    var ePos = document.cookie.indexOf(';', len);
    if(ePos == -1) ePos = document.cookie.length;
    return unescape(document.cookie.substring(len, ePos));
} 


function checkIfCookieExists(cookiename)
	{
		if (document.cookie.indexOf(cookiename) > -1)
		{
			return true;
		} else
		{
			return false;
		}
	}
	
	
function createCookie(name,value,days) 
{

		
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();	
		
		
		document.cookie = name+"="+value+expires+"; path=/";
				
}
	
//uncomment this line to delete the cookie
//createCookie ('firstvisit', 'this visitor has already visited', -1);


$(document).ready(function() {
	
	$('#gallery a').lightBox();
	//floorPlan("1","30");
	doTable();
	makethisCookie();
	if(checkIfCookieExists("firstvisit")) $('#ac_notice').hide();
	doXML(flashvars.XMLPath);
	

});


function doTable()
{
	
	 $("#table").tablesorter({ 
        sortList:[[0,0],[0,1]], widgets: ['zebra'],// pass the headers argument and assing a object 
        headers: {3: {sorter: false}} 
    });
	 
	$('table.tablesorter tbody td:first-child')
								.addClass('firstChild');
								
	$('table.tablesorter thead tr th:first-child')
								.addClass('firstChild');
}

function makethisCookie()
{
	$('.close').click(function(){ 
			$('#ac_notice').hide();
			makeCookie();
			});
}





function floorPlan(floorNum,floorName,sqFeet)
{
	$("#sage").attr({
				 href: "images/large_plans/" + floorNum + ".gif",
				 title:"<h1><span>Floor</span> " + floorName + "</h1>" + sqFeet + "SQ FT"
	});
	$("#sage").trigger('click');
}

	function GroupDelegate(id) {
		var objLink = document.getElementById(id);
		lightBox.prototype.start(objLink);
	}
