
function showHighlight(row) {
	if(row.tagName == 'TR') {
		row.cells[0].className = 'tdHighlight1';
		row.cells[1].className = 'tdHighlight2';
		row.cells[2].className = 'tdHighlight3';
	}
}
function clearHighlight(row) {
	if(row.tagName == 'TR') {
		row.cells[0].className = 'tdNormal1';
		row.cells[1].className = 'tdNormal2';
		row.cells[2].className = 'tdNormal3';
	}
}

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 MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

function MoveInit(e){
  topOne=isIE ? "BODY" : "HTML";
  whichOne=isIE ? document.all.FloatingVaraus : document.getElementById("FloatingVaraus");  
  ActiveOne=isIE ? event.srcElement : e.target;  
  while (ActiveOne.id!="titleBar"&&ActiveOne.tagName!=topOne){
    ActiveOne=isIE ? ActiveOne.parentElement : ActiveOne.parentNode;
  }  
  if (ActiveOne.id=="titleBar"){
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichOne.style.left);
    nowY=parseInt(whichOne.style.top);
    MoveEnabled=true;
    document.onmousemove=Move;
  }
}

function Move(e){
  if (!MoveEnabled) return;
  whichOne.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  whichOne.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;  
}

function MoveN4(whatOne){
  if (!isN4) return;
  N4=eval(whatOne);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isActive){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}

function ToggleFloatingVaraus(DivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[DivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(DivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[DivID].style.visibility = iState ? "visible" : "hidden";
    }
}

function writeEmbed(str){
	document.write(str);
}

function addToList(picPath, picName) {
    var nextArrayIndex = picArray.length;
    picArray[picArray.length] = picPath;
    picNameArray[picNameArray.length] = picName;
}

function swapImage(picId) {
    
    if(picId < 0 || picId >= picArray.length)
        return false;
    
    MM_swapImage('bigPicture','',picArray[picId]);             
    
    currentImage = picId;
    
    document.getElementById("divPhotoName").innerHTML = picNameArray[picId];
    
    if(currentImage > 0)
        document.getElementById("link_previmg").style.display = 'block';
    else
        document.getElementById("link_previmg").style.display = 'none';

    
    if(currentImage < (picArray.length-1))
        document.getElementById("link_nextimg").style.display = 'block';
    else
        document.getElementById("link_nextimg").style.display = 'none';
    
    
}

function switchToNextImage()
{
    swapImage(currentImage + 1);
}

function switchToPrevImage()
{
    swapImage(currentImage - 1);
}

function avaaKuvat(strHotelId)
{
    var kuvatPopup = 'HotelPicturesServlet?hotelId=' + strHotelId;
    window.open(kuvatPopup,'picturesPopup','menubar=no,toolbar=no,status=yes,scrollbars=no,resizable=no,width=470,height=460');
}

function avaaTiedot(strHotelId)
{
    var tiedotPopup = 'HotelDetailsServlet?hotelId=' + strHotelId;
    window.open(tiedotPopup,'detailsPopup','menubar=no,toolbar=no,status=yes,scrollbars=yes,resizable=no,width=735,height=550');
}

function avaaVirtuaali(strHotelId,strIndex)
{
    var virtualPopup = 'VirtualTourServlet?hotelId=' + strHotelId + '&virtualId=' + strIndex;
    window.open(virtualPopup,'virtualPopup','menubar=no,toolbar=no,status=yes,scrollbars=no,resizable=no,width=460,height=380');
}

function avaaKokous(strHotelId)
{
    var conferencePopup = 'HotelConferenceServlet?hotelId=' + strHotelId;
    window.open(conferencePopup,'conferencePopup','menubar=no,toolbar=no,status=yes,scrollbars=yes,resizable=no,width=547,height=600');
}