﻿/*--- specific preload image function ---*/

$.fn.image = function(fn) {
var total = this.length, loaded = 0;
this.each(function() {
var i = new Image();
i.src = this.src;
$(i).load(function(){
loaded++;
if(loaded==total) fn();
});
});
}


$(document).ready(function(){
	ieHover('#top-nav li');
	screenshotPreview();
});


/*--- IE6 hover ---*/
function ieHover(h_list) {
	if ($.browser.msie && $.browser.version < 7) {
		$(h_list).hover(function() {
			$(this).addClass('hover');
		}, function() {
			$(this).removeClass('hover');
		});
	}
}

jQuery(document).ready(function(){
	
	var opts = { 
	align:'center',
	source: function(i){ return this.src.replace('logo_sm_','logo_'); }
	};
	
	jQuery('#dock').jqDock(opts);
		
	
	$("a.#erhscale").fancybox({ 
			'padding': 6,
			'zoomSpeedIn': 300, 
			'zoomSpeedOut': 500, 
			'overlayShow': true,
			'hideOnContentClick': false,
			'frameWidth': 300,
			'frameHeight': 220,
			'overlayOpacity': .6
	}); 
	
	$("a.erhfull").fancybox({ 
			'padding': 6,
			'zoomSpeedIn': 300, 
			'zoomSpeedOut': 500, 
			'overlayShow': true,
			'hideOnContentClick': false,			
			'overlayOpacity': .6
	}); 
	
	$("a.#erhcheckout").fancybox({ 
			'padding': 0,
			'zoomSpeedIn': 300, 
			'zoomSpeedOut': 300, 
			'overlayShow': true,
			'hideOnContentClick': false,
			'frameWidth': 400,
			'frameHeight': 405,
			'overlayOpacity': .6
	}); 
	$("a.#erhmemlogin").fancybox({ 
			'padding': 0,
			'zoomSpeedIn': 300, 
			'zoomSpeedOut': 300, 
			'overlayShow': true,
			'hideOnContentClick': false,
			'frameWidth': 400,
			'frameHeight': 405,
			'overlayOpacity': .6
	});
	$("a.#erhwlmessage").fancybox({ 
			'padding': 0,
			'zoomSpeedIn': 300, 
			'zoomSpeedOut': 300, 
			'overlayShow': true,
			'hideOnContentClick': false,
			'frameWidth': 400,
			'frameHeight': 475,
			'overlayOpacity': .6
	});
	$("a.#erhadvsearch").fancybox({ 
			'padding': 0,
			'zoomSpeedIn': 300, 
			'zoomSpeedOut': 300, 
			'overlayShow': true,
			'hideOnContentClick': false,
			'frameWidth': 400,
			'frameHeight': 475,
			'overlayOpacity': .6
	});
	
	
	$("a[name^='faq-']").each(function() {
		$(this).click(function() {
			if( $("#" + this.name).is(':hidden') ) {
				$("#" + this.name).fadeIn('slow');
			} else {
				$("#" + this.name).fadeOut('slow');
			}			
			return false;
		});
	});

	
	
	});						

function ERH_jumpMenu(targ,selObj,restore){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}




this.screenshotPreview = function(){
        /* CONFIG */

                xOffset = 40;
                yOffset = 10;

                // these 2 variable determine popup's distance from the cursor
                // you might want to adjust to get the right result

        /* END CONFIG */
        $("a.screenshot").hover(function(e){
                this.t = this.title;
                this.title = "";
                var c = (this.t != "") ? "" + this.t : "";
                $("body").append("<p id='screenshot'><img src='"+ this.rel +"'  />"+ c +"</p>");
                $("#screenshot")
                        .css("top",(e.pageY - xOffset) + "px")
                        .css("left",(e.pageX + yOffset) + "px")
                        .fadeIn("slow");
    },
        function(){
                this.title = this.t;
                $("#screenshot").remove();
    });
        $("a.screenshot").mousemove(function(e){
                $("#screenshot")
                        .css("top",(e.pageY - xOffset) + "px")
                        .css("left",(e.pageX + yOffset) + "px");
        });
};





