function SiteOSWindowOpen(theURL,winName,features)
{
//die SID mitanhaengen
 var newURL;
 if (theURL.indexOf("?") == -1)
  newURL = theURL + '?' + SiteOSGetSID();
 else
  newURL = theURL + '&' + SiteOSGetSID();  
 window.open(newURL,winName,features);
}

function SiteOSGetSID()
{
 var loc = window.location.search;
 //die alte SID wegschneiden 
 var posSID = loc.lastIndexOf("&SID=");
 if (posSID == -1)
  posSID = loc.lastIndexOf("?SID="); 
 var posEndSID = loc.indexOf("&",posSID+1);
 var strSID;
 // es kommt kein & mehr
 if (posEndSID == -1)
  posEndSID = loc.indexOf("#",posSID+1);
 //SID ist der letzte Parameter
 if(posEndSID == -1)
  strSID = loc.substring(posSID + 1, loc.length);
 else
  strSID = loc.substring(posSID + 1, posEndSID);
 // gibt SID=session-id zurueck (ohne ? bzw. &)
 return strSID;
}

function gotoAnchor(anchorname)
{
 window.location.href = anchorname;
}

function gotoResort(resort_id)
{
 window.location.href = "/resort.xml?vpID=71&resort_id=" + resort_id + "&" + SiteOSGetSID();
}

function gotoTour(tour_id)
{
 window.location.href = "/tour.xml?vpID=72&tour_id=" + tour_id + "&" + SiteOSGetSID();
}

function loadRegion(region_id)
{
 window.location.href= "/region.xml?vpID=23&region=" + region_id + "&" + SiteOSGetSID();
}

function checkEmail(totest)
{
 return ((totest.indexOf("@") >= 1) &&
         (totest.indexOf("@")+1<totest.indexOf(".",totest.indexOf("@"))) &&
         (totest.indexOf(".",totest.indexOf("@"))<totest.length -1));
}

function checkSearchString(teststring,minLength)
{ 
 reg = new RegExp("[0-9a-zA-Z_\.\-]{" + minLength + "}[0-9a-zA-Z_\.\-]*"); 
 return (reg.exec(teststring) == teststring); 
}

function showLayer(Nummer)
{ 
 window.document.all[Nummer].style.visibility = "visible";
}
function hideLayer(Nummer)
{
 window.document.all[Nummer].style.visibility = "hidden";
}

//onload aktion
function laden(preload) {
 winWidth=0;//global
 MM_preloadImages(preload);
 winWidth=getWidth();
}

//testresize
function testresize() {
 if (winWidth!=getWidth()){
  self.location.href=self.location.href;
 }
}
