// JavaScript Document

function addJavascript(jsname) {
	var th = document.getElementsByTagName('head')[0];
	var s = document.createElement('script');
	s.setAttribute('type','text/javascript');
	s.setAttribute('src',jsname);
	th.appendChild(s);
	
} 

//addJavascript('../js/shadowbox/src/adapter/shadowbox-base.js'); 
//addJavascript('/shadowbox-2.0/src/adapter/shadowbox-prototype.js');
//addJavascript('../js/shadowbox/src/shadowbox.js');


function highlightCurrent(){
   if (typeof(calendarLoad) != "undefined"){
		WindowLoad();	
	}
    if(document.getElementById && document.createTextNode) {
        focusForm();
    applyDates();
    }
	try{
		if(loadCustomFunction == true){
			loadFunction();	
		}
	}
	catch(err){
		
	}
}

function openInfoWindow(url){
	var newwindow = '';
	if (!newwindow.closed && newwindow.location)
	{
		newwindow.location.href = url;
	}
	else
	{
		newwindow=window.open(url,"locationInfo","width=600,height=600,resizable=yes,scrollbars=yes");
		if (!newwindow.opener) newwindow.opener = self;
	}
	if (window.focus) {newwindow.focus();}
	return false;
}


// Dreamweaver funcitons for rollovers

function swapImage(tab,onOff){
	var img = document.getElementById(tab+'Img');
	var imgUrlBase = img.src.substring(0,img.src.length-5);
	if (onOff == 'off' && img.className != 'current'){
		img.src = imgUrlBase+'1.jpg';
	}
	else if (onOff == 'on' && img.className != 'current'){
		img.src = imgUrlBase+'3.jpg';
		img.zIndex = 1;	
	}
	else if (onOff == 'current'){
		img.src = imgUrlBase+'2.jpg';
		img.className = 'current';
	}
}

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 deleteObj(url, objectType){
  var r=confirm("Are you sure you want to delete this "+objectType+"?");
  if (r==true)
    {
    document.location.href = url;
    }
  else
    {
    
    }
}
/**************************************************************
* title  : Enchancing dd/mm/yyyy forms with unobtrusive javascript
*
* story  : Two javascript functions to enchance interaction with
*          HTML forms. The focusForm will focus to the first
*          input type='text' field which is not disabled.
*         
*          The applyDates function will draw dd, mm, and yyyy letters
*          in the appropriate fields. These will be erased on focus
*          and redraw again on blur and when the user hasn't
*          writen anything in them. It's pretty useful because
*          you dont have to explicitly state what goes in which
*          field with extra <label> elements on the markup.
*          So just have a class='dd' or class='mm' or class='yyyy'
*          in the fields you want this behaviour to be applied
*          and the rest will be done for you.
*         
*          Live demo @ LINK1http://temp.cherouvim.com/forums/ddmmyyyyLINK1
*         
* author : Ioannis Cherouvim
* web    : http://cherouvim.com
* date   : 2005-12-12
**************************************************************/


//////////////////////////////////////////////////////////////
//script.js

applyDates = function() {
    var inputs = document.getElementsByTagName("input");
    for(var i = 0, length = inputs.length; i < length; i++) {
        if ((inputs[i].className=='dd') ||
            (inputs[i].className=='mm') ||
            (inputs[i].className=='yyyy') ) {

            inputs[i].setAttribute('autocomplete', 'off');

            if (inputs[i].value=='')
                inputs[i].value=inputs[i].className;

            inputs[i].onfocus=function() {
                if(this.value==this.className)
                    this.value='';
            }
            inputs[i].onblur=function() {
                if(this.value=='')
                    this.value=this.className;
            }
        }
    }
}

focusForm = function() {
    var inputs = document.getElementsByTagName("input");
    for(var i = 0, length = inputs.length; i < length; i++) {
        if ((inputs[i].getAttribute("type"))=="text" && !inputs[i].disabled) {
            inputs[i].focus();
            return;
        }
    }
}
//////////////////////////////////////////////////////////////
//demo HTML

function showHide(id,show,className){
	if (show == true){
		if (className != -1){
			document.getElementById(id).className=className;
		}
		else{
			document.getElementById(id).className='visible';	
		}
	}
	else{
		document.getElementById(id).className='hidden';	
	}
	return true;
}









