﻿//Initialization of pretyPhoto
$("a[rel^='prettyPhoto']").prettyPhoto();

//Search Validation
$("input[id$='_imgSearch']").click(function() {
    if ($("input[id$='_txtSearch']").val().length < 2) { alert("Please enter search word"); return false;}
    return true;
});
$("input[id$='_txtSearch']").click(function() { $(this).val(""); });
$("#search_block").keypress(function(e) {
    if ((e.which == 13) || (e.keyCode && e.keyCode == 13)) {
        $("input[id$='_imgSearch']").click();
        return false;
    }
});

//Border radius
$(".bor_rad").wrap('<div class="bor_mb"><div class="bor_m"></div></div>');
$(".bor_mb").before('<div class="bor topl"><div class="bor topr"><div class="borm topm"><div></div></div></div></div>')
$(".bor_mb").after('<div class="bor botl"><div class="bor botr"><div class="borm botm"><div></div></div></div></div>')
$(".bor_mid").wrap('<div class="col_mb"><div class="col_m"></div></div>');

//Side Menu
$(".menu_item").hover(function() {
$("a", this).removeClass("menu_link"); $("a", this).addClass("menu_link_on"); $(".sub_menu", this).show(300);
}, function() {
    $("a", this).removeClass("menu_link_on"); $("a", this).addClass("menu_link"); $(".sub_menu", this).hide(0);
})
$(".smenu_item").hover(function() {
    $("a", this).removeClass("smenu_link"); $("a", this).addClass("smenu_link_on");
}, function() {
    $("a", this).removeClass("smenu_link_on"); $("a", this).addClass("smenu_link");
})
$("#menu li:last-child").addClass("menu_item_last");
$(".sub_menu li:last-child").addClass("smenu_item_last");

//NewsLoop
$("#news_block").cycle({ fx: 'scrollDown', sync: 0, delay: -2000, pause:true });

//Gallery Page
$("#gal_hol > div.img_hol:nth-child(5n)").addClass("img_hol_last");

$("#def_cycle").cycle({ fx: 'fade', sync: 0, delay: -2000, pause: true });


