<!--

// ----------------------------------------------
// StyleSwitcher functions written by Paul Sowden
// http://www.idontsmoke.co.uk/ss/
// - - - - - - - - - - - - - - - - - - - - - - -
// For the details, visit ALA:
// http://www.alistapart.com/stories/alternate/

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);


// Toggle Layer Function

function toggle( targetId){
  if (document.getElementById){
		target = document.getElementById( targetId );
				target.style.display = "block";
	}
}
function toggleOff( targetId ){
  if (document.getElementById){
		target = document.getElementById( targetId );
				target.style.display = "none";
	}
}

function toggleOnOff(targetId, imgId)
{
	if (document.getElementById){
		target = document.getElementById( targetId );
		targetImage = document.getElementById(imgId);
		if (target.style.display == "none") 
		{
			target.style.display = "block";
			targetImage.src="../img/aa-centre/btn-minus.gif"; 
			targetImage.alt="collapse";
		} 
		else 
		{
			target.style.display = "none";
			targetImage.src="../img/aa-centre/btn-plus.gif"; 
			targetImage.alt="expand";
		}
	}
}

function expand(thistag, tag,htmlsrc) {
   styleObj=document.getElementById(thistag).style;
   if (styleObj.display=='none')
   {
   	styleObj.display='';
	tag.innerHTML = htmlsrc;
   }
   else {
   	styleObj.display='none';
    tag.innerHTML = htmlsrc;
   }
}

// pop up Photo

function popPhoto(imgPath,title,w,h){
	display = window.open('pop-photo.php?img='+imgPath+'&title='+title,'photo','width='+w+',height='+h+',top=100,left=100,scrollbars=no,resizable=yes');
	}
	
	// used by 101 index and  gallery pages
	function checkAllCatagories(){
		var v = document.searchForm.selectAll.checked;
		var l = document.searchForm.totCat.value;
		for(var i=1;i<l;i++){
			eval("document.searchForm.category_"+i+".checked = "+v);
		}
	}
function popup101(url,x,y){
  displayWindow = window.open(url, "newWindow", "resizable=yes,status=0,scrollbars=yes,width="+x+",height="+y+",left=100,top=100");
}

function popupBudget(url,x,y){
  displayWindow = window.open(url, "newWindow", "resizable=yes,status=0,scrollbars=yes,width="+x+",height="+y+",left=100,top=100");
}

function popup_simple(url,x,y){
	var name = 'newWindow'+(new Date().getTime());
	var iT = (screen.height / 2) - (y / 2);
	var iL = (screen.width  / 2) - (x / 2);
  displayWindow = window.open(url, name, "resizable=yes,status=0,scrollbars=yes,width="+x+",height="+y+",left="+iL+",top="+iT	);
	return false;
}

function popWindow(url, x, y, form){
	//alert(form);
	var formName = 'newWindow'+(new Date().getTime());
  displayWindow_x = window.open(url, formName, "resizable=yes,status=0,scrollbars=yes,width="+x+"px,height="+y+"px,left=100,top=100");
	document.getElementById(form).target = formName;
	document.getElementById(form).submit();
	return false;
}

function ShowHide(menu, btn, shortDesc)
	{
		//alert('call showhide');
	   var thismenu = document.getElementById(menu);
	   var thisbtn = document.getElementById(btn);
	   var thisshortDesc = document.getElementById(shortDesc);
	   if ( typeof(thismenu)=='object' )
		 if ( thismenu.style.display=='none' )
		 {
			 thisshortDesc.style.display='none';
			 thismenu.style.display = '';
			 thisbtn.className = "hide-details";
	
		 }
		 else
		 {
			 thisshortDesc.style.display='';
			 thismenu.style.display = 'none';
			 thisbtn.className = "show-details";
			 return false;
		 }
	}
	
function fullScreen(url){
		var width = screen.width;
		var height = screen.height;
		window.open(url,'fullScreenWin', 'height='+height+',width='+width+', left=0,top=0,toolbar=no,scrollbars=yes,resizable=yes,status=yes,location=yes');
}	
//-->