function load_URL(url)
{
	//console.log(url);
 	window.location.href= url;
}

function bookmark(bookTarget) {
 doc=encodeURIComponent(location.href);
 title=encodeURIComponent(document.title);
 switch(bookTarget) {
 case 'delicious':
 window.open('http://del.icio.us/post?url='+doc+'&title='+sbtitle);
 break;
 case 'mrwong':
 window.open('http://www.mister-wong.de/index.php?action=addurl&bm_url='+doc+'&bm_description='+title);
 break;
 case 'blinkList':
 window.open('http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url='+doc+'&Title='+title);
 break;
 case 'yahoo':
 window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+doc+'&t='+title);
 break;
 case 'yigg':
 window.open('http://yigg.de/neu?exturl='+doc+'&exttitle='+title);
 break;
 case 'furl':
 window.open('http://www.furl.net/storeIt.jsp?u='+doc+'&t='+title);
 break;
 case 'oneview':
 window.open('http://beta.oneview.de:80/quickadd/neu/addBookmark.jsf?URL='+doc+'&title='+title);
 break;
 case 'folkd':
 window.open('http://www.folkd.com/submit/page/'+doc);
 break;
 case 'linkarena':
 window.open('http://linkarena.com/bookmarks/addlink/?url='+doc+'&title='+title+'&desc=&tags=');
 break;
 case 'google':
 window.open('http://www.google.com/bookmarks/mark?op=add&hl=de&bkmk='+doc+'&title='+title);
 break;
 case 'webnews':
 window.open('http://www.webnews.de/einstellen?url='+doc+'&title='+title);
 break;
 }
}
function find_ehotel(str)
{
	
	var city=document.getElementById('city').value;
	var start=document.getElementById('start-hidden').value;
	var end=document.getElementById('end-hidden').value;
	var hc=document.getElementById('hc').value;
	var bc=document.getElementById('bc').value;
	var rt=document.getElementById('roomType').value;
	var lang=document.getElementById('lang').value;
	var reqid=document.getElementById('reqid').value;
	var lat=document.getElementById('lat').value;
	var lon=document.getElementById('lon').value;	

    	var URL = "http://www.ehotel.de/IBE/";
    	URL +="Direct?";
    	if(str=="IndexPage")
		{
			var city_index=document.getElementById('city_index').value;
			if(city_index.length > 0)
    		{
    			URL +="city="+city_index;
    		}
		}
    	
    	if(str=="CityPage" || str=="IndexPage" )
	{
		
		var stars="";
	 	for(var i=1 ; i <= 5; i++)
    		{
       			stars += (document.getElementById(String(i)).checked==true ? String(i) + ",":"");
     			// alert("Sterne: "+stars);
    		}
	
		if(stars.length > 0)
		{
			stars=stars.substr(0,stars.length-1);
		}
		var hotel=document.getElementById('hotel').value;
		
		
		if(city.length > 0)
    	{
    		
    		URL +="city="+city;
    	}
    	if(hotel.length > 0)
    	{
    		
    		URL +="&hotelName="+hotel;
    	}
    		if(stars.length > 0)
    	{
    		URL += "&stars="+stars;
    	}
    	
    }
    	if(hc.length > 0 && bc.length > 0 )
    	{
    		
    		URL += "hc="+hc+"&bc="+bc;
    	}
    	
    	if(city.length > 0)
    	{
    		
    		URL +="&city="+city;
    	}
    	if(start.length > 0 && end.length > 0)
    	{
    		URL += "&start="+start+"&end="+end;
    	}
    	if(rt.length > 0 )
    	{
    		URL += "&rt="+rt;
    	}
    		
	if(lat.length > 0 && lon.length > 0 )
	{
		URL+= "&lat="+lat+"&lon="+lon;
	}
	URL += "&reqid="+reqid+"&lang="+lang;
    	
	
	//console.log(URL);
	
    	load_URL(URL);
}


function addDays(date,count)
{
	var ms=date.valueOf();
  	var add = count * 1000*60*60*24;
  	var newDate = new Date(ms+add);
  
  return newDate;
}


function formatDate(date)
{
 var an_tag = (date.getDate());
 var an_mon = (date.getMonth() +1);
 var an_jah = date.getFullYear();
 //if(an_jah < 999) an_jah += 1900;
 
 return an_jah+"-"+an_mon+"-"+an_tag;   
}

function toggle_func(id) {

	// wenn lightbox sktiviert ist
	// kann dann die toggle nicht identifizieren
 	
    var hide_div =document.getElementById("hide_"+id);
    var show_div =document.getElementById("show_"+id);
 	var e = document.getElementById(id);
 	
       if(e.style.display == 'block')
       {
          e.style.display = 'none';
          show_div.style.display = 'block';
          hide_div.style.display = 'none';
          }
       else
       {
          e.style.display = 'block';
          hide_div.style.display = 'block';
          show_div.style.display = 'none';
          }
    }
    
    
function toggle(id) {

	 var hide_div =document.getElementById(id);
	 var e = document.getElementById(id);
 		console.log("lalalalalal");
      
 	if(e.style.display == 'none')
    {
          hide_div.style.display = 'block';
          e.style.display = 'block';
    }
    else
    {
       e.style.display = 'block';
       hide_div.style.display = 'block';
       
       } 
   
    }    

