jQuery(document).ready(function() {

    if (jQuery.browser.msie) {
        jQuery(".note").corner("7px");
        jQuery(".roundedbox").corner("9px");
        jQuery(".submenu .current").corner("5px");
    }
    
    jQuery(".overviewpicture .services a").click(function() {    	
        var ref = jQuery(this).attr("content");
        jQuery("#" +ref).show();
        jQuery(".overviewpicture .fade").show().fadeTo(0, 0.65);
    });

    jQuery(".overviewpicture .popup a.close").click(function() {
    	jQuery(".overviewpicture .popup").hide();
    	jQuery(".overviewpicture .fade").hide();
    });


    // Fix the :focus selector in IE
    if (jQuery.browser.msie) {
        jQuery("input.text")
            .focus(function(){
                jQuery(this).addClass("textFocus");
            })
            .blur(function(){
                jQuery(this).removeClass("textFocus");
            });
        jQuery("textarea")
            .focus(function(){
                jQuery(this).addClass("focus");
            })
            .blur(function(){
                jQuery(this).removeClass("focus");
            });
    }

    jQuery('.buttons img').imghover({
        suffix: '-over'
    });

    if (!jQuery.browser.msie || jQuery.browser.msie && jQuery.browser.version != '6.0') {
        jQuery('.mainbuttons img').imghover({
            suffix: '-over'
        });
    }
    
    if (jQuery.browser.msie && jQuery.browser.version == '6.0') {
     	jQuery('.hide').hide();
    }
    
    jQuery('.search input.text')
        .focus(function() {
            jQuery(this).attr("value","");
            jQuery(this).parent().parent().addClass('out');
        })
        .change(function() {
            jQuery(this).parent().parent().removeClass('out');
        })
        .blur(function() {
            jQuery(this).parent().parent().removeClass('out');
        });

    jQuery("div.subscribe a.contact").click(function(eventObj) {
        jQuery("div.subscribe").addClass("contact");
        jQuery(this).toggle();
        jQuery("div.subscribe a.subscrib").toggle();
        jQuery(".subscribecontent").toggle();
        jQuery(".contactcontent").toggle();
        eventObj.preventDefault();
    });
	
    jQuery("div.subscribe a.subscrib").click(function(eventObj) {
        jQuery("div.subscribe").removeClass("contact");
        jQuery(this).toggle();
        jQuery("div.subscribe a.contact").toggle();
        jQuery(".contactcontent").toggle();
        jQuery(".subscribecontent").toggle();
        eventObj.preventDefault();
    });

    jQuery('.submenu a').addClass("grey");

    jQuery(".submenu li a")
        .mouseover(function() {
            if (jQuery.browser.msie) {
                jQuery(this).addClass("hover")
            } else {
                jQuery(this)
                    .addClass("hover")
                    .animate( {
                        paddingTop: "10px",
                        marginTop: "-5px",
                        paddingBottom: "10px",
                        marginBottom: "-4px"
                    } , 100 )
            }
        })
        .mouseout(function() {
            if (jQuery.browser.msie) {
                jQuery(this).removeClass("hover")
            }else{
                jQuery(this)
                .animate( {
                    paddingTop: "5px",
                    marginTop: "0px",
                    paddingBottom: "6px",
                    marginBottom: "0px"
                } , 100 )
                .removeClass("hover")
            }
        });

    var imgOver = new Array();
    for (var i = 0; i < preloadImages.length; i++) {
        imgOver[imgOver.length] = new Image();
        imgOver[imgOver.length-1].src = preloadImages[i];
    }

    jQuery("a.buttondownload").click(function() {
    	HrefAttr = jQuery(this).attr("href");
    	document.location.href = HrefAttr;
    });	
 
    jQuery(".otherdownload .link a").click(function() {
    	jQuery(this).addClass("opened").blur();
    	jQuery(".otherdownload .extra").show();
    });

    jQuery('.otherdownload div.extra').mouseover(function() {
       obj = jQuery(this);
       obj.addClass("opened");
       obj.show();
    });

    jQuery(".otherdownload").mouseleave(function() {
    	jQuery(".otherdownload .link a").removeClass("opened");
        jQuery(".otherdownload div.extra").hide();
    });

    jQuery('.otherdownload div.extra a').click(function() {
        var wich = jQuery(this).attr("rel");
        jQuery('.dwn').hide();
        jQuery("." + wich).show();
    });

  if (jQuery.browser.msie && (jQuery.browser.version == '6.0' ||
        jQuery.browser.version == '7.0')) {        
     } else{
          jQuery(".mainMenu").hover(
             function() {
                 jQuery('ul', this)
                    .css('display', 'block')
                    .data('hover', true); },
             function() {
                 jQuery('ul', this).data('hover', false);
                  window.setTimeout(
                    jQuery.proxy(function() {
                            var hover = jQuery('ul', this).data('hover');
                            if(hover != true){
                                jQuery('ul', this)
                                    .css('display', 'none')
                                    .data('hover', false);
                                }
                        },
                        this),
                    300);
                }
         );
     }
    
    jQuery(".subscribe #email").watermark("Enter your e-mail address");
    jQuery(".subscription #email").watermark("Enter your e-mail address");
    
});


function ShowHideHint(element)
{
    obj="." + element;
    if(jQuery(obj).css("display")=="none"){
        jQuery(obj).show();
    }else{
        jQuery(obj).hide();
    }
}

