var galleryImagesPath="assets/img/dataset/";

$(function(){
   //Initlize Manu
$('#menu > li', '#top-menu').bind("mouseover", function(ev) {
    $(this).find("ul").show();
    $(this).addClass('active');
});

$('#menu > li', '#top-menu').bind("mouseout", function(ev) {
    $(this).find("ul").hide();
    $(this).removeClass('active');
});

	
	//Fix Home Page Layout
	if ($("#home-items-container")[0]){
		$(".item-box:first","#home-items-container").addClass("first-box");
	}

	//init gallery
	if ($("#gallery")[0]){
		$("#gallery a").bind("click", function(ev) {
					ev.preventDefault();
					$("#gallery a").removeClass("selected");	   
					$(this).addClass("selected");
					$("#gallery-viewer")[0].src = galleryImagesPath + $(this).find("img").attr("class");
					$("#gallery-image-details").html($(this).find("img").attr("title"));
				});
	}// end gallery init

});


/**
* DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
*/

function echeck(str) {

    var at = "@"
    var dot = "."
    var lat = str.indexOf(at)
    var lstr = str.length
    var ldot = str.indexOf(dot)
    if (str.indexOf(at) == -1) {
       // alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr) {
      //  alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr) {
      //  alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(at, (lat + 1)) != -1) {
      //  alert("Invalid E-mail ID")
        return false
    }

    if (str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot) {
      //  alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(dot, (lat + 2)) == -1) {
      //  alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(" ") != -1) {
      //  alert("Invalid E-mail ID")
        return false
    }

    return true
}
