/* IE6 flicker fix
-------------------------------------------------- */
try {
	document.execCommand("BackgroundImageCache", false, true);
} catch (err) { }

/* Popup
-------------------------------------------------- */
function popup(url, window_name) {

    window_width = '800px';
    window_height = '600px';

    settings =
	"toolbar=no,location=no,directories=no," +
	"status=no,menubar=no,scrollbars=yes," +
	"resizable=yes,width=" + window_width + ",height=" + window_height;

    NewWindow = window.open(url, window_name, settings);

    if (window.focus) {
        NewWindow.focus();
    }
}

/* jQuery
-------------------------------------------------- */
function langHover() {
	$j("#lang p.lang a").hover(
		function(){
			$j(this).parents("#lang").find("div.desc p").hide();

			if($j(this).is(".es")) {
				$j(this).parents("#lang").find("div.desc p.es").show();
			}
			if($j(this).is(".fr")) {
				$j(this).parents("#lang").find("div.desc p.fr").show();
			}
			if($j(this).is(".de")) {
				$j(this).parents("#lang").find("div.desc p.de").show();
			}
			if($j(this).is(".ar")) {
				$j(this).parents("#lang").find("div.desc p.ar").show();
			}
		},
		function(){
			$j(this).parents("#lang").find("div.desc p").hide();
			$j(this).parents("#lang").find("div.desc p.en").show();
		}
	);
}
function searchFocus() {
	$j("#nav p.search input:text").focus(function() {
		$j(this).addClass("text-focus");
	}).blur(function() {
		$j(this).removeClass("text-focus");
	});
}
function buttonHover() {
	$j("#nav p.search input:image").hover(
		function(){
			$j(this).addClass("submit-hover");
		},
		function(){
			$j(this).removeClass("submit-hover");
		}
	);
}

$j(document).ready(function() {

	langHover();

	if($j.browser.mozilla && parseFloat($j.browser.version) >= 1.9){
		$j(":reset, :button, :submit").css("-moz-border-radius","3px");
	}

	/* IE */
	if($j.browser.msie){
		searchFocus();
	}

	/* IE6 */
	if($j.browser.msie && ($j.browser.version < 7) ){
		buttonHover();
	}

});