// JavaScript Document

function checkUrgentForm(){
	var oTime = document.getElementById("strTime_cb")
	var oDay = document.getElementById("strDay_cb")
	var oTimeSelected = oTime.selectedIndex
	if(oTime.options[oTimeSelected].value==0){
		oDay.options[0].selected=true;
		oDay.disabled=true;
	} else {
		oDay.disabled=false;
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function clearField(obj,def){if(def==obj.value){obj.value=""}}

function play(id,mp3name,relPath){
	if(window.podcast){	podcast.SetVariable("relPath", relPath);	podcast.SetVariable("mp3file", id);	podcast.SetVariable("mp3name", mp3name);	podcast.TGotoFrame("_level0/",9);	podcast.Play()	} else {	document.podcast.SetVariable("mp3file", id); 	document.podcast.SetVariable("mp3name", mp3name); 	document.podcast.TGotoFrame("_level0/",9);	document.podcast.Play()	}
}


function buttondown( buttonname )
{
      document[ buttonname ].src = gRelPath +"assets/" + buttonname + "-o.jpg";
}
function buttonup ( buttonname )
{
      document[ buttonname ].src = gRelPath +"assets/" + buttonname + ".jpg" 
}
function buttondownpng( buttonname )
{
      document[ buttonname ].src = gRelPath +"assets/" + buttonname + "-o.png";
}
function buttonuppng ( buttonname )
{
      document[ buttonname ].src = gRelPath +"assets/" + buttonname + ".png" 
}


var sliderIntervalId = 0;
var sliderHeight = 100;
var sliderWidth = 800;
var sliding = false;
var slideSpeed = 5;
var target='';
function Slide(parm)
{
   if(sliding)
      return;
   sliding = true;
   var t = document.getElementById('sliderElementId').offsetHeight
   target=parm
   sliderHeight = t
   if(sliderHeight == t){
		document.getElementById('helpOption1').style.display='none'
		document.getElementById('helpOption2').style.display='none'
		document.getElementById('sitestyleTitle').style.display='none'
		sliderIntervalId = setInterval('SlideUpRun()', 20);
  }
}

function SlideUpRun()
{
   slider = document.getElementById('sliderElementId');
   if(sliderHeight <= 0)
   {
      //sliding = false;
      sliderHeight = 0;
      slider.style.height = '0px';
      clearInterval(sliderIntervalId);
	  document.getElementById('sitestyleholder').style.display='none'
	  ajaxFunction(target)
   }
   else
   {
      sliderHeight -= slideSpeed;
      if(sliderHeight < 0)
         sliderHeight = 0;
      slider.style.height = sliderHeight + 'px';
   }
}

function ajaxFunction(sitestyle){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
		}
	}
	var url=gRelPath + "set-style.asp?style=" + sitestyle + "&m="+ (new Date()).getTime();
	
	ajaxRequest.open("GET", url, true);
	ajaxRequest.send(null); 
}
function writeWhosOn(sWOGateway,sWODomain,sWOPage)
{
	var sWOSession;
	var sWOUrl;
	var sWOProtocol=window.location.protocol;
	var iWO=new Image(1,1);

	// create a unique session cookie for the visitor if not already created
	var dt=new Date();
	var sWOCookie=document.cookie.toString();
	if(sWOCookie.indexOf("whoson")==-1){
		sWOSession=parseInt(Math.random()*1000)+"-"+dt.getTime();
		document.cookie="whoson="+sWOSession+";expires=Fri, 31-Dec-2010 00:00:00 GMT;";
	}
	sWOCookie=document.cookie.toString();
	if(sWOCookie.indexOf('whoson')==-1){
		sWOSession="";
	} else {
		var s=sWOCookie.indexOf("whoson=")+7;
		var e=sWOCookie.indexOf(";",s);
		if(e==-1)e=sWOCookie.length;
		sWOSession=sWOCookie.substring(s,e);
	}
	if(sWOPage=="")sWOPage=escape(window.location);
	if(sWOProtocol=="file:")sWOProtocol="http:";
	sWOUrl=sWOProtocol+"//"+sWOGateway+"/stat.gif?u="+sWOSession+"&d="+sWODomain;
	sWOUrl+="&p='"+sWOPage+"'&r='"+escape(document.referrer)+"'";
	iWO.src=sWOUrl;
	return;
}