// JavaScript Document

//----------------------------------------------------------------------------
function GetSize(file) {
     var fso=new ActiveXObject("Scripting.FileSystemObject");
     var f=fso.getFile(file);
     return fso.getFile(file).size;
}

function checkFileSize(ctrl) {
    //check if file size is > 500Kb
    if(GetSize(ctrl.value) > 512000) 
    {
      alert('Cannot attach file, your file size is '+ parseInt(GetSize(ctrl.value) / 1024) + ' Kb');
      ctrl.form.reset();//file greater than limit then reset form 
    }
}

//----------------------------------------------------------------------------

function myOpen(page,width,height) {
    if (navigator.appName == 'Netscape') {
        adjWidth = 640 + 10;
        adjHeight = 390 + 20;
    }
    else {
        adjWidth = 640 ;
        adjHeight = 420 ;
    }
    window.open(page,'','width=' + width + ',height=' + height + ',directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=no,screenX=0,screenY=0');
}

//----------------------------------------------------------------------------

function gotoItem() {
    if (document.iwanttoform.verbSelected.value=="0") {
      alert("Please Select a Category.");
      return false;
    } else if (document.getElementById("nounSelected").value=="") {
      alert("Please Select a Sub-Category.");
      return false;
    } else {
      window.location=document.getElementById("nounSelected").value;
      return true;
    }
}

//----------------------------------------------------------------------------

function SendData(page)
{
window.opener.location.href = page;
self.close();
}


var slideShowSpeed = 5000
var crossFadeDuration = 3
var Pic = new Array() 
Pic[0] = 'images/main1.jpg'
Pic[1] = 'images/main2.jpg'
Pic[2] = 'images/main3.jpg'
Pic[3] = 'images/main4.jpg'
Pic[4] = 'images/main5.jpg'
Pic[5] = 'images/main6.jpg'
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)
}

//----------------------------------------------------------------------------

function CheckAll(){
	f = document.checkboxform;
	if (f.elements.length - 2 == 1){
		f.sel.checked = f.allbox.checked;
	}
	else{
		for (i=0;i<f.elements.length-1;i++){
			f.sel[i].checked=f.allbox.checked;
		}
	}
}


