try {
	document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

$(document).ready(function(){
	// preload Kontakt-Icon Rollover-Bild
	pr01 = new Image;
	pr01.src = "/inc/img/icon_kontakt_1.gif";
	// Rollover einrichten
	$("#servicenav a.icon_kontakt img").hover(function(){
		this.src = (window.location.protocol=="http:" ? "http://www.it-administrator.de/inc/img/icon_kontakt_1.gif" : "/inc/img/icon_kontakt_1.gif");
	},function(){
		this.src = (window.location.protocol=="http:" ? "http://www.it-administrator.de/inc/img/icon_kontakt_0.gif" : "/inc/img/icon_kontakt_0.gif");
	});
	//
	// preload Search-Button
	pr02 = new Image;
	pr02.src = "/inc/img/button_search_1.gif";
	// Rollover einrichten
	$("#search_box input.search_button").hover(function(){
		this.src = (window.location.protocol=="http:" ? "http://www.it-administrator.de/inc/img/button_search_1.gif" : "/inc/img/button_search_1.gif");
	},function(){
		this.src = (window.location.protocol=="http:" ? "http://www.it-administrator.de/inc/img/button_search_0.gif" : "/inc/img/button_search_0.gif");
	});
	// Bestellbutton Home
	pr03 = new Image;
	pr03.src = "/inc/img/bestellbutton_home_1.gif";
	$("#bestellbutton_home img").hover(function(){
		this.src = "/inc/img/bestellbutton_home_1.gif";
	},function(){
		this.src = "/inc/img/bestellbutton_home_0.gif";
	});
	// Bestellbutton Einzelhefte
	pr04 = new Image;
	pr04.src = "/inc/img/bestellbutton_einzelhefte_1.gif";
	$("#bestellbutton_einzelhefte img").hover(function(){
		this.src = "/inc/img/bestellbutton_einzelhefte_1.gif";
	},function(){
		this.src = "/inc/img/bestellbutton_einzelhefte_0.gif";
	});
	// Bestellformular Einzelhefte
	$("form[name='bestellformular_einzelhefte']").submit(function(){
		if ($("input:checked[name^='ita20']").length<=0) {
			alert("Bitte w\u00E4hlen Sie mindestens eine IT-Administrator Ausgabe aus.");
			return false;
		} else {
			return true;
		}
	});
	
	// tweak flash swfs
	// Firefox
    $("embed").attr("wmode", "opaque");
    // IE
	var embedHTML;
	$("embed").each(function(i) {
		embedHTML = $(this).attr("outerHTML");
		if ((embedHTML != null) && (embedHTML.length > 0)) {
			embedHTML = embedHTML.replace(/embed /gi, "embed wmode=\"opaque\" ");
			$(this).attr("outerHTML", embedHTML);
		}
	});
	
	// rewrite golinks
	$("a[class^='golink']").each(function(){
		var golink = $(this).attr("class").substr(6);
		if (golink.length>0) {
			$(this).attr("href", "http://www.it-administrator.de/lib/golink/golink.php?id=" + golink);
		}
	});
	
	// fix floating text around wide images
	$("#content .artikelbox .artikel img").each(function(){
		if ($(this).width()==450) $(this).addClass("wide");
	});
});




/* Produktdetailseite Sonderheft */

/* Öffnet ein Popup und darin eine HTML-Datei mit JS und übergibt die URL des zu ladenden Bilds im Querystring */
function popup(image_xl) {
	var w=450, h=580;
	var u="/img/sonderhefte/popup.html" + "?img=" + image_xl;
	window.open(u,"sohepopup","width="+w+",height="+h+",left=200,top=100,resizable=yes");
}

/* Lädt aus einem Popup heraus anhand des Querystrings das passende Detailbild */
function displayImageXL() {
	if (window.location.search && window.location.search!="") {
		var s = window.location.search;
		s = s.slice(s.lastIndexOf("=")+1,s.length);
		if (document.getElementById) {
			var i = document.getElementById("image_xl");
			if (i && i.getAttribute && !i.getAttribute("src") && i.setAttribute) {
				i.setAttribute("src", s);
			}
		}
	}
}
