//slideshow front page sept 2010
var slideShowSpeed = 4000;
var crossFadeDuration = 12;
var Pic = new Array();
Pic[0] = 'images/pic1.png'
Pic[1] = 'images/pic2.png'
Pic[2] = 'images/pic3.png'
Pic[3] = 'images/pic4.png'
Pic[4] = 'images/pic5.png'
Pic[5] = 'images/pic6.png'
Pic[6] = 'images/pic7.png'
Pic[7] = 'images/pic8.png'
Pic[8] = 'images/pic9.png'
Pic[9] = 'images/pic10.png'
Pic[10] = 'images/pic11.png'
Pic[11] = 'images/pic12.png'
Pic[12] = 'images/pic13.png'
Pic[13] = 'images/pic14.png'
Pic[14] = 'images/pic15.png'
Pic[15] = 'images/pic1.png'
Pic[16] = 'images/pic2.png'
Pic[17] = 'images/pic3.png'
Pic[18] = 'images/pic4.png'
Pic[19] = 'images/pic5.png'
Pic[20] = 'images/pic6.png'
Pic[21] = 'images/pic7.png'
Pic[22] = 'images/pic8.png'
Pic[23] = 'images/pic9.png'
Pic[24] = 'images/pic10.png'
Pic[25] = 'images/pic11.png'
Pic[26] = 'images/pic12.png'
Pic[27] = 'images/pic13.png'
Pic[28] = 'images/pic14.png'
Pic[29] = 'images/pic15.png'
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
	preLoad[i] = new Image();
    preLoad[i].src = Pic[i];
}
function runSlideShow() {
if (document.all) {
	document.images.SlideShow.style.filter="blendTrans(duration=2)";
	document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
	document.images.SlideShow.filters.blendTrans.Apply();
	}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
	document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j >(p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
// text for job application
}
function btStateSelect() {
		var iStateIndx = document.mainForm.lookupB.selectedIndex;
		var sState = document.mainForm.lookupB.options[iStateIndx].value;
		document.mainForm.MAIN_PRE_STATE.value = sState;
	}
 
	function stStateSelect() {
		var iStateIndx = document.mainForm.lookupS.selectedIndex;
		var sState = document.mainForm.lookupS.options[iStateIndx].value;
		document.mainForm.MAIN_PER_STATE.value = sState;
	}
	
	function ismaxlength(obj)
	{
		var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
		if (obj.getAttribute && obj.value.length>mlength)
		obj.value=obj.value.substring(0,mlength)
	}
	
	function showhidetext()  
	{ //cyril 
			
			 var elm = document.getElementById("Specify");
			 var sIndex = document.mainForm.MAIN_REFERAL_SOURCE.selectedIndex;
			
			switch(sIndex)
			{
				 case  0:
					elm.style.display =  "none";
					break
			     
				 case  1:
					elm.style.display =  "none";
					break;
				 case 2:
					elm.style.display =  "inline";
					break;
				case  3:
					elm.style.display =  "inline";
					break;
				case 4:
					elm.style.display =  "inline";
					break;
				case  5:
					elm.style.display =  "inline";
					break;
				case 6:
					elm.style.display =  "none";
					break;
				case 7:
					elm.style.display =  "inline";
					break;
				case  8:
					elm.style.display =  "inline";
					break;			 
			}			
	}
	
 function addLoadEvent(func) 
 { //This will have the specify referral Source showing any time the page errors.     
	var oldonload = window.onload;   
	if (typeof window.onload != 'function')
	{   
      window.onload = func;   
    } 
	else 
	{   
			window.onload = function() 
		{   
	      oldonload();          
		  func();   
	    }   
    }   
 }
 
 function limitText(limitField, limitCount, limitNum) 
 {
     if (limitField.value.length > limitNum) 
     {
         limitField.value = limitField.value.substring(0, limitNum);
     }
     else 
     {
         limitCount.value = limitNum - limitField.value.length;
     }
 }
	
	
	
	
	function HoldSelValue()
	{
		var sel = document.getElementById("MAIN_Q_OVER18");
		var sIndex = document.mainForm.MAIN_Q_OVER18.selectedIndex;
		switch(sIndex)
			{
				  
				 case  1:
					document.mainForm.MAIN_Q_OVER18.selectedIndex =  1;
					break;
				 case 2:
					document.mainForm.MAIN_Q_OVER18.selectedIndex =  2;
					break;
			}
 
	}
	
	
	
	
 
	function textCounter(field,cntfield,maxlimit) {
		if (field.value.length > maxlimit) // if too long...trim it!
			field.value = field.value.substring(0, maxlimit);
			// otherwise, update 'characters left' counter
		else
			cntfield.value = maxlimit - field.value.length;
	}
	
	function CopyName()
	{
	   //Cyril Tracker # AU68015
	   var fName = document.mainForm.MAIN_FIRSTNAME.value;
	   var lName = document.mainForm.MAIN_LASTNAME.value;
	   var mName = document.mainForm.MAIN_MIDDLENAME.value;
	   var fullName = fName + " " + mName + " " + lName;
	   document.mainForm.MAIN_APPLICANTS_FULL_NAME.value = fullName;
	   //document.mainForm.MAIN_SIGNATURE.value = fName + " " + mName + " " + lName;
	  
	}
	
	
	function data_change(field)
     {
	 	  
          var check = true;
          var value = field.value; //get characters
          //check that all characters are digits, ., -, or ""
          for(var i=0;i < field.value.length; ++i)
          {
               var new_key = value.charAt(i); //cycle through characters
               if(((new_key < "0") || (new_key > "9")) && 
                    !(new_key == ""))
               {
                    check = false;
                    break;
               }
          }
          //apply appropriate colour based on value
          if(!check)
          {
		  	   alert("Date Must Be Numeric");
               field.style.backgroundColor = "red";
          }
          else
          {
               field.style.backgroundColor = "white";
          }
     }
	 
	 //Limit the amount of chars entered in textareas' Cyril.
	   function maxLength(field,maxChars)
		 {
			   if(field.value.length >= maxChars) {
				  event.returnValue=false; 
				  alert("Please enter less than " +maxChars + " chars");
				  return false;
			   }
		
		 }  
 
	 function maxLengthPaste(field,maxChars)
	 {
		   event.returnValue=false;
		   if((field.value.length +  window.clipboardData.getData("Text").length) > maxChars) {
			 alert("Please enter less than " +maxChars + " chars");
			 return false;
		   }
		   event.returnValue=true;
	 }
 
	 function selectNewPosition(jobCode) 
	 {
	   var index;
	   index = jobCode.indexOf("_");
	   jobCode = jobCode.substr(0, index);
	   document.mainForm.UPDATEMODE.value = "FALSE";
	   document.mainForm.JOBCODE.value = jobCode;
	   //alert(document.mainForm.UPDATEMODE.value + " : " + document.mainForm.JOBCODE.value);
	   document.forms["mainForm"].submit();	 
	 }
	//drop down menu function
	 
function showmenu(elmnt)
{
document.getElementById(elmnt).style.visibility="visible";
}
function hidemenu(elmnt)
{
document.getElementById(elmnt).style.visibility="hidden";
}
//-->
