/*

  Authors: 
    eylem schwanke, bernd schmidt
  
*/


/* jquery scope */
jQuery(document).ready(function(){



		// ****************************
    // Auswahlmenu für Domains oben
		// ****************************
		$("#periodList3").css("visibility", "hidden");
    
    $('#pageChooser').hover(function(){
        $("#periodList3").css("visibility", "visible");
				$("#periodList3_results").css("visibility", "hidden");
    }, function(){
        $("#periodList3").css("visibility", "hidden");
				$("#periodList3_results").css("visibility", "visible");
    });
    
    
    $('#periodList3 a').click(function(){
        check_href = $(this).attr('href');

        location.href = $(this).attr('href');;
        
        return false;
    });



		// ****************************
    // produkzte drop down
		// ****************************
    $("select#produktDropdown").change(function(){
       
       vals = $(this).attr('value');   
       
       if(vals) location.href = vals;
    });

		// ***********************************
    // Nicht auf englisch, falls keine Übersetzung
		// ***********************************
		$("#notavailable a").click(function(){
			$("#notavailable span").css("display", "inline");	
			
			return false;
		});


		// ****************************
    // produkte image preview
		// ****************************
    imagePreview();
		
	  /* print */
    $('.print').click(function(){
      self.print();
      return false;
    });

    
    
    
});




function doOpenBlankWindow(url, name){
    popWin = window.open(url, name, "fullscreen=yes,location=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes,titlebar=yes");
    popWin.focus();
}



/* misc functions */
function openSitemap(){
    Navigation = window.open("index.php?id=58&type=98", "Navigation", "height=600,width=350,scrollbars=yes");
    return false;
}

function openBigImage(){
    //Navigation.focus();
    
    //$(this).add("span");
    return false;
}




/* ********************
 IMAGE preview
 ******************** */
this.imagePreview = function(){
    /* CONFIG */
    
    yOffset = 150;
    xOffset = -525;
    
    // these 2 variable determine popup's distance from the cursor
    // you might want to adjust to get the right result
    
    /* END CONFIG */
    $("a.preview").hover(function(e){
        this.t = this.title;
        this.title = "";
        var c = (this.t != "") ? "<br/>" + this.t : "";
        $("body").append("<p id='preview'><img src='" + this.href + "' alt='Image preview' />" + c + "</p>");
        $("#preview").css("top", (e.pageY - yOffset) + "px").css("left", (e.pageX + xOffset) + "px").fadeIn("fast");
    }, function(){
        this.title = this.t;
        $("#preview").remove();
    });
    
    $("a.preview").mousemove(function(e){
        $("#preview").css("top", (e.pageY - yOffset) + "px").css("left", (e.pageX + xOffset) + "px");
    });
    
    $("a.preview").click(function(e){
        return false;
    });
    
};






