(function ($) {
  $(document).ready(function () {
//    $('#seite_weiterempfehlen').click(function () {
//      //alert('test');
//      return false;
//    });


    
    if (/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)) {
      $('#seite_weiterempfehlen').colorbox({width:"360", height:"380", iframe:true, opacity: 0.4});
    } else {
      $('#seite_weiterempfehlen').colorbox({width:"350", height:"370", iframe:true, opacity: 0.4});
    }
    
    
    var print_icon = $('#top #icons .print');
    var sitemap_icon = $('#top #icons .sitemap');
    var recommend_icon = $('#top #icons #seite_weiterempfehlen');
    var search_field = $('#top #search .phrase');
    var search_form = $('#top #search #search_form');
    var search_results_next = $('.simplePageNav.next');
    var search_results_prev = $('.simplePageNav.prev');
    
    var recommend_from = $('#email_an');
    var recommend_to = $('#email_von');
    var recommend_text = $('#bemerkung');
    var recommend_send = $('#submit_place #senden');
    var recommend_cancel = $('#submit_place #abbrechen');
    
	var params = getUrlVars();
	//console.log(params.id);
	
	if (!parseInt(params.id)) {
		document.title = 'Taxomex AG: Home';
	}
    
    switch (gup('L')) {
    	case '2':
    		print_icon.attr('title', 'Imprimer la page');
    		sitemap_icon.attr('title', 'Carte du site');
    		recommend_icon.attr('title', 'Recommander la page');    		
    		recommend_icon.attr('href', recommend_icon.attr('href') + '?L=2');
    		
    		search_field.attr('title', 'Chercher');
    		search_form.attr('action', search_form.attr('action') + "&L=2");
    		search_results_next.html('Suivant &raquo;');
    		search_results_prev.html('&laquo; Retour');
    		
    		recommend_from.prev().html('A l\'attention de: <span>(e-mail)</span>');
    		recommend_to.prev().html('De: <span>(e-mail)</span>');
    		recommend_text.prev().html('Message:');
    		recommend_send.val('Envoyer');
    		recommend_cancel.val('Effacer');   
    	    $('#module_parkieren').click(function () {
		      window.location.href = 'index.php?id=17&L=2';
		    });
		    $('#module_verkehr').click(function () {
		      window.location.href = 'index.php?id=113&L=2';
		    });    		
    		
    		break;
    	case '3':
    		print_icon.attr('title', 'Stampa pagina');
    		sitemap_icon.attr('title', 'Mappa del sito');
    		recommend_icon.attr('title', 'Raccomanda questa pagina');
    		recommend_icon.attr('href', recommend_icon.attr('href') + '?L=3');
    		search_field.attr('title', 'Cercare');
    		search_form.attr('action', search_form.attr('action') + "&L=3");
    		search_results_next.html('Andante &raquo;');
    		search_results_prev.html('&laquo; Indietro');
    		
    		recommend_from.prev().html('Destinatario: <span>(e-mail)</span>');
    		recommend_to.prev().html('Da: <span>(e-mail)</span>');
    		recommend_text.prev().html('Commento:');
    		recommend_send.val('Inviare');
    		recommend_cancel.val('Annulare');   
    	    $('#module_parkieren').click(function () {
		      window.location.href = 'index.php?id=17&L=3';
		    });
		    $('#module_verkehr').click(function () {
		      window.location.href = 'index.php?id=113&L=3';
		    }); 
    		break;
    	case '1':
    	default:
    	    $('#module_parkieren').click(function () {
		      window.location.href = 'index.php?id=17';
		    });
		    $('#module_verkehr').click(function () {
		      window.location.href = 'index.php?id=113';
		    });
    		break;
    }
    
    
  });  
} )(jQuery);


function gup( name ) {
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}


function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}
