/*$.ajax({
    type:'post',
    url:'yourFile.php',
    success: function(r){
      var element1 = $(r).find('#element1').html();//get the contents of #element1
      var element2 = $(r).find('#element2').html();//get the contents of #element2

      $('#container1').html(element1);//put html in container1
      $('#container2').html(element2);//put html in container2
    }
});*/
$(".langChange").click(function () {
    document.location.href = $(this).attr('href', $(this).attr('href') + location.hash)
});
$(document).ready(function () {
    $('.zoom').bind("click", function () {
        $('#bigPicture').dialog('open');
    })
/*$("a").click(function(){
	_gaq.push(['_trackEvent',  $(this).attr('title'), 'clicked', $(this).attr('href')])

});
	*/
    $("#bigPicture").dialog({
        autoOpen: false,
        width: "700px",
        height: "700px",
        title: "Zoom",
        modal: true,
        resizable: false,
        overlay: {
            opacity: 0.5,
            background: "white"
        }
    });
    
    var location_hash = location.hash;
    location_hash = location_hash.substr(1);
    var splithash = location_hash.split('-');
    location_hash = splithash[0];
    if (location_hash) {
        bind_these();
        $("." + location_hash).click();
    } else {
        $("#boxCenter").load("content/index-en.html", function () {
            bind_these();
        });
    }
});
$("#back").bind("click", function () {
    $("#box-right").show("slow");
    $("#box-sub").hide("slow");
})

function hide() {
    $("#box-right").hide("slow");
    $("#box-sub").show("slow");
}
var trackUrl;
 $("a").live("click", function () {
      
	    trackUrl = $(this).attr("href");
        //alert(trackurl);
        _gaq.push(['_trackPageview', trackUrl]);
        _gaq.push(['_trackEvent', 'Website', 'Content', trackUrl]);
})
	
function bind_these() {
    $("a").attr("target", "");
   
    $(".home").attr("href", "#home");
    $(".home").bind("click", function () {
        $("#boxCenter").load("content/index-en.html", function () {
            bind_these();
            $("#box-right").show("slow");
            $("#box-sub").hide("slow");
            location.hash = "";
        });
    })
    $(".history").attr("href", "#history");
    $(".history").bind("click", function () {
        $("#boxCenter").load("content/History-en.html", function () {
            $("#box-right").show("slow");
            $("#box-sub").hide("slow");
            location.hash = "#history";
        });
    })
    $(".info").attr("href", "#info");
    $(".info").bind("click", function () {
        $("#boxCenter").load("content/Company_Info-en.html", function () {
            $("#box-right").show("slow");
            $("#box-sub").hide("slow");
            location.hash = "#info";
        });
    })
    $(".contact").attr("href", "#contact");
    $(".contact").bind("click", function () {
        $("#boxCenter").load("content/Contact-en.html", function () {
            $("#box-right").show("slow");
            $("#box-sub").hide("slow");
            location.hash = "#contact";
        });
    })
    $(".represent").attr("href", "#represent");
    $(".represent").bind("click", function () {
        $("#boxCenter").load("content/Representative-en.html", function () {
            $("#box-right").show("slow");
            $("#box-sub").hide("slow");
            location.hash = "#represent";
        });
    })
    $(".vibronet").attr("href", "#vibronet");
    $(".vibronet").bind("click", function () {
        $("#boxCenter").load("content/Products/Water_Dosage/vibronet-en.html");
        $("#sub-image").attr("src", "http://de.vibronet.com/content/images/Products/Water_Dosage/vibronet.gif");
        $("#bigPictureSrc").attr("src", "http://de.vibronet.com/content/images/Products/Water_Dosage/big_vibronet.gif");
     
        location.hash = "#vibronet";
        hide();
    })
    $(".VIB_SystemWeigher").attr("href", "#VIB_SystemWeigher");
    $(".VIB_SystemWeigher").bind("click", function () {
        $("#boxCenter").load("content/Products/Online_Weighing_Dosing/VIB_Systemweigher-en.html");
        $("#sub-image").attr("src", "http://de.vibronet.com/content/images/Products/Online_Weighing_Dosing/VIB_Systemweigher.gif");
        $("#bigPictureSrc").attr("src", "http://de.vibronet.com/content/images/Products/Online_Weighing_Dosing/big_VIB_Systemweigher.gif");
       
        location.hash = "#VIB_SystemWeigher";
        hide();
    })
    $(".VIB_Humidifier").attr("href", "#VIB_Humidifier");
    $(".VIB_Humidifier").bind("click", function () {
        $("#boxCenter").load("content/Products/Water_Dosage/VIB_Humidifier-en.html");
        $("#sub-image").attr("src", "http://de.vibronet.com/content/images/Products/Water_Dosage/VIB_Humidifier.gif");
        $("#bigPictureSrc").attr("src", "http://de.vibronet.com/content/images/Products/Water_Dosage/big_VIB_Humidifier.gif");
 
        location.hash = "#VIB_Humidifier";
        hide();
    })
    $(".VIB_MMS").attr("href", "#VIB_MMS");
    $(".VIB_MMS").bind("click", function () {
        $("#boxCenter").load("content/Products/Water_Dosage/VIB_MMS-en.html");
        $("#sub-image").attr("src", "http://de.vibronet.com/content/images/Products/Water_Dosage/VIB_MMS.gif");
        $("#bigPictureSrc").attr("src", "http://de.vibronet.com/content/images/Products/Water_Dosage/big_VIB_MMS.gif");
       
        location.hash = "#VIB_MMS";
        hide();
    })
    $(".VIB_WaterDosage_ECONO").attr("href", "#VIB_WaterDosage_ECONO");
    $(".VIB_WaterDosage_ECONO").bind("click", function () {
        $("#boxCenter").load("content/Products/Water_Dosage/VIB_WaterDosage_ECONO-en.html");
        $("#sub-image").attr("src", "http://de.vibronet.com/content/images/Products/Water_Dosage/VIB_Water_Dosage_Econo.gif");
        $("#bigPictureSrc").attr("src", "http://de.vibronet.com/content/images/Products/Water_Dosage/big_VIB_Water_Dosage_Econo.gif");
      
        location.hash = "#VIB_WaterDosage_ECONO";
        hide();
    })
    $(".VIB_Surface_Moisture_Control").attr("href", "#VIB_Surface_Moisture_Control");
    $(".VIB_Surface_Moisture_Control").bind("click", function () {
        $("#boxCenter").load("content/Products/Online_Control/VIB_Surface_Moisture_Control-en.html");
        $("#sub-image").attr("src", "http://de.vibronet.com/content/images/Products/Online_Control/VIB_Surface_Moisture_Control.gif");
        $("#bigPictureSrc").attr("src", "http://de.vibronet.com/content/images/Products/Online_Control/big_VIB_Surface_Moisture_Control.gif");
      
        location.hash = "#VIB_Surface_Moisture_Control";
        hide();
    })
    $(".VIB_Protein_Control").attr("href", "#VIB_Protein_Control");
    $(".VIB_Protein_Control").bind("click", function () {
        $("#boxCenter").load("content/Products/Online_Control/VIB_Protein_Control-en.html");
        $("#sub-image").attr("src", "http://de.vibronet.com/content/images/Products/Online_Control/VIB_Protein_Control.gif");
        $("#bigPictureSrc").attr("src", "http://de.vibronet.com/content/images/Products/Online_Control/big_VIB_Protein_Control.gif");
       
        location.hash = "#VIB_Protein_Control";
        hide();
    })
    $(".VIB_Color_Control").attr("href", "#VIB_Color_Control");
    $(".VIB_Color_Control").bind("click", function () {
        $("#boxCenter").load("content/Products/Online_Control/VIB_Color_Control-en.html");
        $("#sub-image").attr("src", "http://de.vibronet.com/content/images/Products/Online_Control/VIB_Color_Control.gif");
        $("#bigPictureSrc").attr("src", "http://de.vibronet.com/content/images/Products/Online_Control/big_VIB_Color_Control.gif");
      
        location.hash = "#VIB_Color_Control";
        hide();
    })
    $(".VIB_CheckPoint").attr("href", "#VIB_CheckPoint");
    $(".VIB_CheckPoint").bind("click", function () {
        $("#boxCenter").load("content/Products/Online_Control/VIB_Checkpoint-en.html");
        $("#sub-image").attr("src", "http://de.vibronet.com/content/images/Products/Online_Control/VIB_Checkpoint.gif");
        $("#bigPictureSrc").attr("src", "http://de.vibronet.com/content/images/Products/Online_Control/big_VIB_Checkpoint.gif");
     
        location.hash = "#VIB_CheckPoint";
        hide();
    })
    $(".VIB_ThermoCabinet").attr("href", "#VIB_ThermoCabinet");
    $(".VIB_ThermoCabinet").bind("click", function () {
        $("#boxCenter").load("content/Products/Conditioning/VIB_ThermoCabinet-en.html");
        $("#sub-image").attr("src", "http://de.vibronet.com/content/images/Products/Conditioning/VIB_ThermoCabinet.gif");
        $("#bigPictureSrc").attr("src", "http://de.vibronet.com/content/images/Products/Conditioning/big_VIB_ThermoCabinet.gif");
    
        location.hash = "#VIB_ThermoCabinet"; 
        hide();
    })
    $(".VIB_vibroDES").attr("href", "#VIB_vibroDES");
    $(".vibroDES").bind("click", function () {
        $("#boxCenter").load("content/Products/Decontamination/vibroDES-en.html");
        $("#sub-image").attr("src", "http://de.vibronet.com/content/images/Products/Decontamination/vibroDES.gif");
        $("#bigPictureSrc").attr("src", "http://de.vibronet.com/content/images/Products/Decontamination/big_vibroDES.gif");
 
        location.hash = "#vibroDES";
        hide();
    })
}
