if (document.images) {
	but_over = new Image();
	but_over.src = "../images/but_over.gif";
	but_out = new Image();
	but_out.src = "../images/but_out.gif";
}

function doClock() { // By Paul Davis - www.kaosweaver.com
  var t = new Date(), a = doClock.arguments, str = "", i, a1, lang="1";
  var month = new Array('January','Jan', 'February','Feb', 'March','Mar', 'April','Apr', 'May','May', 'June','Jun', 'July','Jul', 'August','Aug', 'September','Sep', 'October','Oct', 'November','Nov', 'December','Dec');
  var tday = new Array('Sunday','Sun','Monday','Mon', 'Tuesday','Tue', 'Wednesday','Wed','Thursday','Thr','Friday','Fri','Saturday','Sat');
  for (i=0; i<a.length; i++) {
  		a1 = a[i].charAt(1);
  		switch (a[i].charAt(0)) {
  			case "M":
  				if  ((Number(a1)==3) && ((t.getMonth()+1)<10)) str+="0";
  				str += (Number(a1)>1)?t.getMonth()+1:month[t.getMonth()*2+Number(a1)];
  				break;
  			case "D":
  				if ((Number(a1)==1) && (t.getDate()<10)) str+="0";str+=t.getDate();
  				break;
  			case "Y":
  				str+=(a1=='0')?t.getFullYear():t.getFullYear().toString().substring(2);
  				break;
  			case "W":
  				str+=tday[t.getDay()*2+Number(a1)];break; default: str+=unescape(a[i]);
  		}
  	}
  	return str;
}

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 submitOnce(obj) {
	obj.form.submit();
	obj.disabled = true;
	obj.value = "please wait...";
	return true;
}

function openImageWindow(directory, image) {	
	if (typeof(window.innerWidth ) == 'number' ) {
		//Non-IE
		x = window.innerWidth;
		y = window.innerHeight;
	} else {
		//IE
		x = screen.width;
		y = screen.height;
	}

	newWin = window.open(directory + 'image.php?img=' + image + '&x=' + x + '&y=' + y, 'images', 'height=400, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
	newWin.focus();
	return false;
}

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i = 0; i < vars.length; i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
  alert('Query Variable ' + variable + ' not found');
}

function resizeImageWindow() {	
	if (document.images[0].complete) {
		x = getQueryVariable('x');
		y = getQueryVariable('y');
				
		imgWidth = document.images[0].width;
		imgHeight = document.images[0].height;
		
		window.resizeTo(imgWidth, imgHeight);
		if (typeof(window.innerWidth) == 'number') {
			//Non-IE
			imgWidth += (imgWidth - window.innerWidth);
			imgHeight += (imgHeight - window.innerHeight);
		} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))  {
			//IE 6+ in 'standards compliant mode'
			imgWidth += (imgWidth - document.documentElement.clientWidth);
			imgHeight += (imgHeight - document.documentElement.clientHeight);
		} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
			//IE 4 compatible
			imgWidth += (imgWidth - document.body.clientWidth);
			imgHeight += (imgHeight - document.body.clientHeight);
		}
		window.resizeTo(imgWidth, imgHeight);
		
		x = (x / 2) - (imgWidth / 2);
		y = (y / 2) - (imgHeight / 2);
		if (x < 0) x = 0;
		if (y < 0) y = 0;
	
		window.moveTo(x, y);
	}
}

function getWindowSize() {
	var myWidth = 0, myHeight = 0;
	if (typeof(window.innerWidth) == 'number') {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	
	windowInfo = new Array(myWidth, myHeight);
	return windowInfo;
}

function entryDetails(id, type) {
	newWin = window.open('../home/comp_details.php?id=' + id + '&type=' + type, 'entry_details', 'height=170, width=300, toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
	newWin.focus();

	return false;
}

function backImgButton() {
	if (history.length > 1) {
		history.back();
		return false;
	} else return true;
}