
$(document).ready(function(){
	try{
			$('#pricesList tr:odd').addClass("pricesOdd");
		}
	catch(e){}
});

var tempX = 0
var tempY = 0

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;
function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE

	//////////////////////////////////////////
	if (document.documentElement && !document.documentElement.scrollTop){
		// IE6 +4.01 but no scrolling going on
		tempY = event.clientY + document.documentElement.scrollTop
	}else if (document.documentElement && document.documentElement.scrollTop){
		// IE6 +4.01 and user has scrolled
		tempY = event.clientY + document.documentElement.scrollTop
	}else if (document.body && document.body.scrollTop){
		// IE5 or DTD 3.2 
		tempY = event.clientY + document.body.scrollTop
	}
	///////////////////////////////////////////////////////////
	if (document.documentElement && !document.documentElement.scrollLeft){
		// IE6 +4.01 but no scrolling going on
		tempX = event.clientX + document.documentElement.scrollLeft
	}else if (document.documentElement && document.documentElement.scrollLeft){
		// IE6 +4.01 and user has scrolled
		tempX = event.clientX + document.documentElement.scrollLeft
	}else if (document.body && document.body.scrollLeft){
		// IE5 or DTD 3.2 
		tempX = event.clientX + document.body.scrollLeft
	}
	
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  
  return true
}

function showDiv(e)
{
	var hours = document.getElementById("hours");
	hours.style.display = "block";
}

function hideDiv()
{
	var hours = document.getElementById("hours");
	hours.style.display = "none";
}

var newwindow = null;

function showPreviewImg(img)
{
	var imgToShow = "../../images/"+img;
	//getImgSize(imgToShow);
	//alert(getImgWidth(imgToShow));
	//alert(getImgHeight(imgToShow));
	ShowPicture("",imgToShow);
}

function closePreviewImg()
{
	HidePicture();
}

function ShowPicture(id,Source) {
	id = "imgPreview";
	
	//tempX = tempX+"px";
	//tempX = 15+"px";
	var imgSrc = Source;
	//var img = document.createElement("IMG");
	//img.src = Source;
	Source = "url("+Source+")";
	innerText = "<br><br><strong><p align='center'>Veuillez patientez pendant le chargement de l'image...<br><br>Please wait while image is loading...</p></strong>";
	if (document.layers){
		document.layers[''+id+''].innerHTML=innerText
		//document.layers[''+id+''].backgroundColor="white"
		//document.layers[''+id+''].backgroundImage = Source
		document.layers[''+id+''].innerHTML="<img id='previewImg' width='350' src='"+imgSrc+"' />";
		//document.layers[''+id+''].appendChild(img);
	}else if (document.all){
		document.all[''+id+''].innerHTML=innerText
		//document.all[''+id+''].style.backgroundColor="white"
		//document.all[''+id+''].style.backgroundImage = Source
		document.all[''+id+''].innerHTML="<img id='previewImg' width='350' src='"+imgSrc+"' />";
		//document.all[''+id+''].appendChild(img);
	}else if (document.getElementById){
		document.getElementById(''+id+'').innerHTML=innerText
		//document.getElementById(''+id+'').style.backgroundColor="white"
		//document.getElementById(''+id+'').style.backgroundImage = Source
		document.getElementById(''+id+'').innerHTML="<img id='previewImg' width='350' src='"+imgSrc+"' />";
		//document.getElementById(''+id+'').appendChild(img);
	}

	if (document.layers){// ???
		if(document.layers[''+id+''].visibility = "show")
		{
			if(getImgWidth(imgSrc) != "0px" && getImgHeight(imgSrc) != "0px")
			{

				//document.layers[''+id+''].width = getImgWidth(imgSrc);
				//document.layers[''+id+''].height = getImgHeight(imgSrc);
			}
	
			document.layers[''+id+''].visibility = "show"
			tempY = (tempY - (document.layers[''+id+''].offsetHeight/2)-0)+"px";
			tempX = (tempX - document.layers(''+id+'').offsetWidth) - 35 +"px";
			//tempX = (tempX - document.layers(''+id+'').offsetWidth/2) - 25 +"px";
			document.layers[''+id+''].top = tempY;
			document.layers[''+id+''].left = tempX;
		}
	}else if (document.all){// IE
		if(document.all[''+id+''].style.visibility != "visible")
		{
			if(getImgWidth(imgSrc) != "0px" && getImgHeight(imgSrc) != "0px")
			{

				//document.all[''+id+''].style.width = getImgWidth(imgSrc);
				//document.all[''+id+''].style.height = getImgHeight(imgSrc);
			}
			
			document.all[''+id+''].style.visibility = "visible"
			tempY = (tempY - (document.all[''+id+''].offsetHeight/2)-0)+"px";
			tempX = (tempX - document.all(''+id+'').offsetWidth) - 35 +"px";
			document.all[''+id+''].style.top = tempY;
			document.all[''+id+''].style.left = tempX;
		}
	}else if (document.getElementById){ // FIREFOX
		if(document.getElementById(''+id+'').style.visibility != "visible")
		{
			//alert(getImgHeight(Source));
			if(getImgWidth(imgSrc) != "0px" && getImgHeight(imgSrc) != "0px")
			{
				//document.getElementById(''+id+'').style.width = getImgWidth(imgSrc);
				//document.getElementById(''+id+'').style.height = getImgHeight(imgSrc);
			}
			
			document.getElementById(''+id+'').style.visibility = "visible"
			tempY = (tempY - (document.getElementById(''+id+'').offsetHeight/2)-0)+"px";
			tempX = (tempX - document.getElementById(''+id+'').offsetWidth) - 35 +"px";
			document.getElementById(''+id+'').style.top = tempY;
			document.getElementById(''+id+'').style.left = tempX;
		}
	}
}

function getImgHeight(imgSrc)
{
	//document.writeln("<div><img src='"+imgSrc+"'></div");
	var newImg = new Image();
	newImg.src = imgSrc;
	//var height = newImg.height;
	//var width = newImg.width;
	//alert ('The image size is '+width+' * '+height);
	return newImg.height+"px";
}

function getImgWidth(imgSrc)
{
	//document.writeln("<div><img src='"+imgSrc+"'></div");
	var newImg = new Image();
	newImg.src = imgSrc;
	//var height = newImg.height;
	//var width = newImg.width;
	//alert ('The image size is '+width+' * '+height);
	return newImg.width+"px";
}

function HidePicture() {
	id = "imgPreview";
	
	if (document.layers){
		document.layers[''+id+''].visibility = "hide"
	}else if (document.all){
		document.all[''+id+''].style.visibility = "hidden"
	}else if (document.getElementById){
		document.getElementById(''+id+'').style.visibility = "hidden"
	}
	
	if (document.layers){
		document.layers[''+id+''].backgroundImage = ""
		document.layers[''+id+''].width = "375px";
		document.layers[''+id+''].height = "375px";
	}else if (document.all){
		document.all[''+id+''].style.backgroundImage = ""
		document.all[''+id+''].style.width = "375px";
		document.all[''+id+''].style.height = "375px";
	}else if (document.getElementById){
		document.getElementById(''+id+'').style.backgroundImage = ""
		document.getElementById(''+id+'').style.width = "375px";
		document.getElementById(''+id+'').style.height = "375px";
	}

}