﻿// commented lines are for when full urls are used for the image source

// preload '_on' images with class of 'hover'
$(window).bind('load', function() {
    var preload = new Array();
    $(".hover, .sf-menu img").each(function() {
        s = $(this).attr("src").replace(/\.(.+)$/i, "_on.$1");
		//s = $(this).attr("src").replace(/.gif$/ig,"_on.gif");
        preload.push(s)
    });
    var img = document.createElement('img');
    $(img).bind('load', function() {
        if(preload[0]) {
            this.src = preload.shift();
        }
    }).trigger('load');
});
// apply mouseovers
$(document).ready(function() {
    $(".hover").each(function() {
        if ($(this).attr("src").match(/_on\.(.+)$/i)) {
		//if ($(this).attr("src").match(/_on.gif$/ig)) {
            $(this).removeClass("hover");
        }
    });
    $(".hover").hover(function() {
        s = $(this).attr("src").replace(/\.(.+)$/i, "_on.$1");
		//s = $(this).attr("src").replace(/.gif$/ig,"_on.gif");
        $(this).attr("src", s);
    }, function() {
        s = $(this).attr("src").replace(/_on\.(.+)$/i, ".$1");
		//s = $(this).attr("src").replace(/_on.gif$/ig,".gif");
        $(this).attr("src", s);
    });
});

$(document).ready(function() {
	// initialize the menu
    /* $("ul.sf-menu").superfish();
	// keep top-level nav menu image in hover state as long as its submenus are hovered
    $("ul.sf-menu > li").hover(function() {
        var s = $(this).children().children("img").attr("src").replace(/\.(.+)$/i, "_on.$1");
		//var s = $(this).children().children("img").attr("src").replace(/.png$/ig,"_over.png");
        $(this).children().children("img").attr("src", s);
    }, function() {
        var s = $(this).children().children("img").attr("src").replace(/_on\.(.+)$/i, ".$1");
		//var s = $(this).children().children("img").attr("src").replace(/_over.png$/ig,".png");
        $(this).children().children("img").attr("src", s);
    });*/
});

$(document).ready(function(){
	fieldValues = [];
	$(".ei").each(function(i){
		fieldValues[i] = "Enter Your Email";
		$(this).focus(function(){
			if ($(this).val() == fieldValues[i]) {
				$(this).val("");
			}
			$(this).addClass("activefield");
		}).blur(function(){
			if ($.trim($(this).val()) == "") {
				$(this).val(fieldValues[i]);
			}
			$(this).removeClass("activefield");
		});
	});
});

$(document).ready(function(){
	/* $(".gallery a").colorbox({current:"{current} of {total}",width:"840",height:"700"}); */
});

$(document).ready(function(){
	$("a.archive").click(function(){
		var url = $(this).attr("href");
		window.open(url,'archive','status=0,toolbar=0,location=0,menubar=0,resizable=1,scrollbars=1,height=500,width=680');
		return false;
	});
});