var reEmail=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
var reText=/^([a-zA-Z0-9 \-']{2,30})+$/

//**********************************************************************************************************************
var ElementObjectsCache=new Object();
function GetE(objID){
  if (!ElementObjectsCache[objID]) ElementObjectsCache[objID]=document.getElementById(objID);    
  return ElementObjectsCache[objID];
}

//**********************************************************************************************************************
function Search(currentCat){
  //document.forms.mainform.submit();  
  if (GetE('SearchCatSelect')){
    document.location=GetE('SearchCatSelect').value+(GetE('keyword').value?'?keyword='+GetE('keyword').value:'');
  }
}

//**********************************************************************************************************************
 function showPic(RootUrl,imageID){
   w = window.open('','PopUpImage','top=0,left=0,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,copyhistory=no,width=20,height=20');
   w.document.write("<html>                                                                                                               ");
   w.document.write("  <head>                                                                                                             ");
   w.document.write("    <title>..:: Photo ::..</title>                                                                               ");
   w.document.write("    <script language='JavaScript'>                                                                                   ");
   w.document.write("    IE5=NN4=NN6=false;                                                                                               ");
   w.document.write("    if(document.all) {                                                                                               ");
   w.document.write("      IE5=true;                                                                                                      ");
   w.document.write("    } else if(document.getElementById){                                                                              ");
   w.document.write("      NN6=true;                                                                                                      ");
   w.document.write("    } else if(document.layers) {                                                                                     ");
   w.document.write("      NN4=true;                                                                                                      ");
   w.document.write("    }                                                                                                                ");
   w.document.write("  function autoSize() {                                                                                              ");
   w.document.write("   W=document.images[0].width;H=document.images[0].height;                                             ");
   w.document.write("   if (W>screen.width-80){                                                                                           ");
   w.document.write("     H=Math.round(H*(screen.width-80)/W);                                                                            ");
   w.document.write("     W=screen.width-80;                                                                                              ");
   w.document.write("   }                                                                                                                 ");
   w.document.write("   if (H>screen.height-80){                                                                                          ");
   w.document.write("     W=Math.round(W*(screen.height-80)/H);                                                                           ");
   w.document.write("     H=screen.height-80;                                                                                             ");
   w.document.write("   }                                                                                                                 ");
   w.document.write("   document.images[0].width=W;document.images[0].height=H;                                                           ");
   w.document.write("   if(IE5) {self.resizeTo(W+10,H+28);}                                                                               ");
   w.document.write("   else if(NN6) {self.resizeTo(W+19,H+43);}                                                                          ");
   w.document.write("   else {top.window.resizeTo(W,H);}                                                                                  ");
   w.document.write("   self.moveTo((screen.width-W)/2,(screen.height-H-62)/2);                                                           ");
   w.document.write("   self.focus();                                                                                                     ");
   w.document.write("  }                                                                                                                  ");
   w.document.write("  </scr");
   w.document.write("ipt>                                                                                                                 ");     
   w.document.write("  </head>                                                                                                            ");
   w.document.write("  <body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' onLoad='javascript:autoSize();window.focus();'>");
   w.document.write("    <img src='"+RootUrl+"/Photos/"+imageID+".jpg' border='0' onClick='javascript:window.close();'>                   ");
   w.document.write("  </body>                                                                                                            ");
   w.document.write("</html>                                                                                                              ");
   w.document.close();
 }


//**********************************************************************************************************************
function Rezervare(lng,lid){
  X=560;
  Y=500;
  windowprops = "top="+(screen.height-Y)/2+",left="+(screen.width-X)/2+",status=no,scrollbars=no,directories=no,location=no,toolbar=no,resizable=no,menubar=no,width="+X+",height="+Y;
  window.open("rezervation.php?lng="+lng+"&lid="+lid,"Rezervations",windowprops);
}

//**********************************************************************************************************************
function RezervareChangeCombo(){
  var TOTAL=0;
  var CalculationLinePriceTotal=0;
  var DoubleSelectionValue=0;
  for(key in CalculationPrices){
    Buc=CalculationPrices[key].combo[CalculationPrices[key].combo.selectedIndex].value;
    if (key==_ALLOWED_CHILDREN_CI_) DoubleSelectionValue=Buc;
    if (key==-1) {
      if (Buc>DoubleSelectionValue) {
        CalculationPrices[key].combo.selectedIndex=DoubleSelectionValue;
        Buc=DoubleSelectionValue;
        alert(_Rezervation_WarningNRChild_);
      }
    }
    CalculationLinePriceTotal=CalculationPrices[key].lineprice*Buc;
    document.getElementById("CalculationLinePriceTotal['"+key+"']").innerHTML=CalculationLinePriceTotal;
    TOTAL+=CalculationLinePriceTotal;
  }
  document.getElementById("CalculationTOTAL").innerHTML=TOTAL;
  CalculationTOTAL=TOTAL;
}