/**
 * jquery_hre - JS-Functions based on JQuery, used in the Holding Internet
 *
 * @copyright       Copyright 2008, Achim Roth
 * @license         Dual licensed under the MIT (MIT-LICENSE.txt)
 *                  and GPL (GPL-LICENSE.txt) licenses.
 * @link            https://achim-roth.de
 * @package         js
 * @id				$Id: jquery_hre.js 635 2008-08-17 09:40:15Z achim $
 * @revision        $Rev: 635 $
 * @lastmodified    $Date: 2008-08-17 11:40:15 +0200 (So, 17 Aug 2008) $
 */

var newWindow = null;

function closeWin() {
	if (newWindow != null) {
		if(!newWindow.closed) newWindow.close();
	}
}

function popUpWin(url, type, strWidth, strHeight) {
	
	closeWin();
		
	type = type.toLowerCase();
	if (type == "fullscreen") {
		strWidth = screen.availWidth;
		strHeight = screen.availHeight;
	}

	var tools="";
	if (type == "browser") tools = "";
	if (type == "standard") tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";
	if (type == "console" || type == "fullscreen") tools = "resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=0,top=0";

	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}

function WindowWidth() {
	if (window.innerWidth) {
    	return window.innerWidth;
	} else if (document.body && document.body.offsetWidth) {
    	return document.body.offsetWidth;
	} else {
    	return 0;
	}
}

function WindowHeight() {
	if (window.innerHeight) {
    	return window.innerHeight;
	} else if (document.body && document.body.offsetHeight) {
    	return document.body.offsetHeight;
	} else {
    	return 0;
	}
}

function reloadPage() {
  if (width != WindowWidth() || height != WindowHeight())
    location.href = location.href;
}


function initPage(blnRdPge)
{
	/* Intitialise the Dropdown-Menus */
	var ddmx1 = new DropDownMenuX("menu1");
	ddmx1.type = "horizontal";
	ddmx1.delay.show = 0;
	ddmx1.delay.hide = 300;

	if($.browser.opera) {
		ddmx1.position.level1.top = -23;
	} else {
		ddmx1.position.level1.top = -3;
	}

	ddmx1.fixIeSelectBoxBug = false;
	ddmx1.init();

	var ddmx2 = new DropDownMenuX("menu2");
	ddmx2.type = "horizontal";
	ddmx2.delay.show = 0;
	ddmx2.delay.hide = 300;

	if ($.browser.opera) {
		ddmx2.position.level1.top = -19;
	} else if ($.browser.msie) {
	    if ($.browser.version = "6.0") {
	        ddmx2.position.level1.left = 1;
	        ddmx2.position.level1.top = 0;
	    }
	    if ($.browser.version = "7.0") {
	        ddmx2.position.level1.left = 0;
            ddmx2.position.level1.top = 1;
	    }
	} else {
		ddmx2.position.level1.top = 1;
	}

	ddmx2.fixIeSelectBoxBug = false;
	ddmx2.init();

	$("#tabProductNav tr > td").not(".tdProductCD").hover(
		function () {
			$(this).css("background-color", "#a1a290");
			$(this).find("a").css("color", "#ffffff");
		},
		function () {
			$(this).css("background-color", "transparent");
			$(this).find("a").css("color", "#626256");
		}
	);

	$("#tabProductNav tr > td").bind("click", function(){ location.href = $(this).find("a").attr("href"); });

	$(".lnkPrint").bind("click", function(){ window.print(); });

	$("#lnkServiceNavSubmit").bind("click", function(){ document.forms[0].submit(); });

}