// (C) Netlogic, 2003

OnLoadHitchs = function () {};
window.onload = function() {
	GeckoALTfixer();
}

function Open(url, w, h) {
	w = window.open(url,'popUp','toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,width='+w+',height='+h);
	w.focus();
	return false;
}

function OpenSearch(url, w, h, id) {
	w = window.open(url,id,'toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,width='+w+',height='+h);
	w.focus();
	return false;
}

function printIt() {
	window.print() ;
	return false;
}

function GeckoALTfixer() {
	if (navigator.product && navigator.product == 'Gecko') {
		var i, j, images = Array(document.getElementsByTagName('IMG'), document.getElementsByTagName('INPUT'), document.getElementsByTagName('AREA'));
		for (i = 0; i < images.length; i++) {
			for (j = 0; j < images[i].length; j++) {
				with (images[i][j]) {
					if (getAttribute('alt') && !getAttribute('title')) setAttribute('title', getAttribute('alt'));
				}
			}
		}
	}
}


// Flash detection
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

if (plugin) {
	plugin = parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= 4;
} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0)) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('plugin = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4")))\n');
	document.write('</SCRIPT\> \n');
}

function Show(name) {
	var a = document.getElementById('menu-' + name);
	if(a) a.style.visibility = 'visible';
}

function Hide(name) {
	var a = document.getElementById('menu-' + name);
	if(a) a.style.visibility = 'hidden';
}

function openPic(url, w, h) {
	if (w == undefined || h == undefined) {
		winprops='width=680,height=520';
	} else {
		winprops='width='+w+',height='+h;
	}

	openwinsrc = window.open('/photo.html', 'winw', winprops+"resizable=no,scrollbars=no");
	openwinsrc.document.open();
	openwinsrc.document.write('<HTML><HEAD><TITLE>Chelsea FC</TITLE><STYLE>HTML, BODY { padding: 0; margin: 0; background-color: #FFFFFF; height: 100%;}</STYLE></HEAD><BODY><TABLE width="100%" style="height: 100%;" cellpadding="0" cellspacing="0" border="0"><TR><TD align="center"><IMG src="'+url+'" border="0" onclick="window.close();"></TD></TR></TABLE></BODY></HTML>');
	openwinsrc.document.close();
	openwinsrc.focus();
	return false;
}


function SlideShow(path) {
	select = document.getElementById('slideshowSel');

	if(select.selectedIndex) {
		Open(path+select.options[select.selectedIndex].value, 800, 700);
	} else {
		ValidateNotice(select);
	}

	return false;
}

function ReloadWebcam(i) {
	url = i.src.replace(/\?.*$/, '');
	url += '?rnd='+Math.random();
	i.src = url;
}

function ReloadAllWebCam() {
	imgs = document.getElementsByTagName('img');
	for(i in imgs) {
		if(imgs[i].className === 'webcam') {
			ReloadWebcam(imgs[i])
		}
	}

	setTimeout('ReloadAllWebCam()',5000);
}

oldOnLoad = window.onload;
window.onload = function() {
	if(typeof oldOnLoad == 'function') {
		oldOnLoad();
	}

	setTimeout('ReloadAllWebCam()', 5000);
}
/*table*/
hitchs.add(
	function() {
		$(".zebra > tbody > tr:even").addClass("bg");;
	}
);

hitchs.add(
	function() {
		$("#search input[type='text']").focus( function () {$(this).val("");} );
	}
);

hitchs.add(
	function() {
		$("#menu > li").mouseover(function () {
			$(this).addClass("menu");
		})
		$("#menu > li").mouseout(function () {
			$(this).removeClass("menu")
		})
	}
);

hitchs.add(
	function() {
		var back = document.getElementById('back');
		var sub = document.getElementById('submits')
		if(back !== null && history.length) {
			back.parentNode.onclick = function() {
				history.back();
				return false;
			}
		}
		if(sub !== null) {
			sub.style.display = 'none';
		}
	}
);

