<!--
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
		
var mouseX = 0;
var mouseY = 0;
	
document.onmousemove = mouseMove;
document.onmouseup   = mouseUp;

var dragObject  = null;
var mouseOffset = null;

function mouseCoords(ev){
	if(ev.pageX || ev.pageY){
		return {x:ev.pageX, y:ev.pageY};
	}
	return {
		x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
		y:ev.clientY + document.body.scrollTop  - document.body.clientTop
	};
}

function getMouseOffset(target, ev){
	ev = ev || window.event;
	
	var docPos    = getPosition(target);
	var mousePos  = mouseCoords(ev);
	return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
}

function getPosition(e){
	var left = 0;
	var top  = 0;

	while (e.offsetParent){
		left += e.offsetLeft;
		top  += e.offsetTop;
		e     = e.offsetParent;
	}

	left += e.offsetLeft;
	top  += e.offsetTop;
	
	return {x:left, y:top};
}

function mouseMove(ev){
	ev           = ev || window.event;
	var mousePos = mouseCoords(ev);

	if (IE) {
		mouseX = event.clientX + document.body.scrollLeft;
		mouseY = event.clientY + document.body.scrollTop;
	} else {
		mouseX = ev.pageX;
		mouseY = ev.pageY;
	}
		
	if(dragObject){
		dragObject.style.position = 'absolute';
		dragObject.style.top      = mousePos.y - mouseOffset.y;
		dragObject.style.left     = mousePos.x - mouseOffset.x;

		return false;
	}
}
	
function mouseUp(){
	dragObject = null;
}

function makeDraggable(item){
	if(!item) return;
	item.onmousedown = function(ev){
		dragObject  = this;
		mouseOffset = getMouseOffset(this, ev);
		return false;
	}
}

/* Hidden layer functions */
function showLayer(divid) {
	x = mouseX - document.getElementById(divid).offsetWidth/2;
	y = mouseY + 10;
	
	document.getElementById(divid).style.left=x;
	document.getElementById(divid).style.top=y;
	document.getElementById(divid).style.visibility='visible';
}

function hideLayer(divid) {
	document.getElementById(divid).style.visibility='hidden';
	document.getElementById(divid).style.left=0;
	document.getElementById(divid).style.top=0;
}

function showHideLayer(divid) {
	if (document.getElementById(divid).style.visibility != 'visible') {
		showLayer(divid);
	} else {
		hideLayer(divid);
	}
}

/* Custom tooltips */
function popUpTooltip(content, show) {
	if (show) {
		document.getElementById('popuptooltip').innerHTML = '<div id="tooltip">'+content+'</div>';
		showLayer('popuptooltip');
	} else {
		hideLayer('popuptooltip');
	}
}

/* Open new window with a content */
function popupwindow(title,content,wid,hgt){
if (screen.height-70 < hgt) {
	hgt = screen.height-70;
	wid += 25;
}
newwin=window.open('','popupwin','width='+wid+',height='+hgt+',scrollbars=1,menubars=0,toolbars=0,location=0,directories=0,status=0');
newwin.document.open();
newwin.document.write('<html>\n<head>\n');
newwin.document.write('<title>'+title+'</title>\n');
newwin.document.write('</head>');
newwin.document.write('<body style="margin:0;padding:0">\n'+content+'');
newwin.document.write('\n</body></html>');
newwin.document.close();
newwin.focus();
}

/* get Page size */
 var pageWidth = 0, pageHeight = 0;
 
function getPageSize() {
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    pageWidth = window.innerWidth;
    pageHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    pageWidth = document.documentElement.clientWidth;
    pageHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    pageWidth = document.body.clientWidth;
    pageHeight = document.body.clientHeight;
  }
}

/* Zoom tv in and zoom out by changing the whole iframe source */
var tvZoomed = false;

function zoomTV() {
	getPageSize();
	
	if (!tvZoomed) {
		tvZoomed = true;
		document.getElementById('tv').style.left = (pageWidth/2-360)+'px';
		document.getElementById('tv').style.width = '730px';
		document.getElementById('tvcontainer').innerHTML = "<iframe src='tv/player.php?w=720&h=405' frameborder='0' marginheight='0' marginwidth='0' scrolling='no' width='728' height='454' allowtransparency='true'></iframe>";
	} else {
		tvZoomed = false;
		document.getElementById('tv').style.left = 'auto';
		document.getElementById('tv').style.width = '260px';
		document.getElementById('tvcontainer').innerHTML = "<iframe src='tv/player.php?w=250&h=141' frameborder='0' marginheight='0' marginwidth='0' scrolling='no' width='258' height='190' allowtransparency='true'></iframe>";
	}
}

/* Main menus */
var selectedMainMenu = 1;
function selectMainMenu(menuid) {
	if (!menuid) menuid = 1;
	document.getElementById('mainmenu').className = 's'+menuid;
}

function resetMainMenu() {
	document.getElementById('mainmenu').className = 's'+selectedMainMenu;
}

/* Open new window with a content */
function popupwindow(title,content,wid,hgt){
if (screen.height-70 < hgt) {
	hgt = screen.height-70;
	wid += 25;
}
newwin=window.open('','popupwin','width='+wid+',height='+hgt+',scrollbars=1,menubars=0,toolbars=0,location=0,directories=0,status=0');
newwin.document.open();
newwin.document.write('<html>\n<head>\n');
newwin.document.write('<title>'+title+'</title>\n');
newwin.document.write('</head>');
newwin.document.write('<body style="margin:0;padding:0">\n'+content+'');
newwin.document.write('\n</body></html>');
newwin.document.close();
newwin.focus();
}

/* Select an item and submit the form to add the selected item to cart */
function checkAndSubmit(checkbox, form) {
	document.getElementById(checkbox).checked=true;
	document.getElementById(form).submit();
}

/* Show/hide login form */
function showHideLogin() {
	if (document.getElementById('loginform').style.visibility != 'visible') {
		document.getElementById('loginform').style.top = mouseY+10;
		document.getElementById('loginform').style.left = mouseX-170;
		document.getElementById('loginform').style.visibility = 'visible';
	} else {
		document.getElementById('loginform').style.visibility = 'hidden';
	}
}

/* Check and Uncheck all checkboxes */
function checkUncheckBoxes(form, check) {
	x = document.getElementById(form);
	for(var i=0,l=x.length; i<l; i++)
		if(x[i].type == 'checkbox')
			x[i].checked=check;
}

function divCheckUncheckBoxes(div, check) {
	div = document.getElementById(div);
	var chks = div.getElementsByTagName("*");
	for (var i=0, l=chks.length; i<l; i++)
		if (chks[i].type == "checkbox") 
			chks[i].checked = check; 
}

-->
