
// global variables
var usernameAltered = 0;
var passwordAltered = 0;
var searchAltered = 0;

// Menu code

function globalActions() {

    // apply correct backgrounds
    $(".latest.tsipouradika").each(function() {
            $(this).css("background-image", 'url("images/themes/tsipouradika/main_bg.gif")');
    });
    $(".latest.mezedopoleia").each(function() {
        $(this).css("background-image", 'url("images/themes/mezedopoleia/main_bg.gif")');
    });
    
    $("#areaInput").change(function() {

        window.location = $(this).val();

    });
    
    $("#topmenu img").not(".active").hover(
        function() {
            var newSrc = $(this).attr("src").replace("/topmenu/", "/topmenuHover/");
            $(this).attr("src", newSrc);
        },
        function() {
            var newSrc = $(this).attr("src").replace("/topmenuHover/", "/topmenu/");
            $(this).attr("src", newSrc);
        }
    );
    
    $("div.latest .images li a").click(function(event) {
        event.preventDefault();
        $("div.latest .photo img").attr("src", $(this).attr("href"));
        
        // change selected
        $("div.latest .images li").removeClass("selected");
        $(this).parent().addClass("selected");
    });
    
/*    $("#trackInput").focus(function() {
        if (trackClicked == 0) {
            trackClicked = 1;
            $(this).attr("value","");
        }
    });
    
    $("#trackInput").blur(function() {
        if ($(this).attr("value") == "")                
            $(this).attr("value","Enter tracking number");
            trackClicked = 0;
    });
*/

    $("#username").focus(function() {
        if ($(this).attr("value") == "username")
            $(this).attr("value", "");    
    });

    $("#username").blur(function() {
        if ($(this).attr("value") == "")
            $(this).attr("value", "username");    
    });

    $("#password").focus(function() {
        if ($(this).attr("value") == "password")
            $(this).attr("value", "");    
    });

    $("#password").blur(function() {
        if ($(this).attr("value") == "")
            $(this).attr("value", "password");    
    });
    
    $("#searchField").focus(function() {
        if ($(this).attr("value") == "Αναζήτηση")
            $(this).attr("value", "");    
    });

    $("#searchField").blur(function() {
        if ($(this).attr("value") == "")
            $(this).attr("value", "Αναζήτηση");    
    });    
    
}


