// JavaScript Document
$(document).ready(function() {

    // Flash replacements
    swfobject.embedSWF("flash/ave_logo.swf", "logo", "109", "90", "9.0.0", "js/swfobject/expressInstall.swf", {}, { "BGCOLOR": "#FFFFFF", menu: "false" } );

    // CSS tidy: main menu
    $('.main_menu a:last').css('border', '0px');

    // Menu functionality
    $('ul.list li:has(ul)').each(function() {
        $(this).hover(
			function() {
			    $(this).children('ul').show();
			},
			function() {
			    $(this).children('ul').hide();
			}
		);
    });

    //TODO: Remove it when the site goes official
    // If we're working on localhost, subst the image.ashx with audiovisual.metadata.gr/image.ashx
    if ($(window).attr('location').toString().match("localhost") != null) {
        var site = 'www.audiovisual.gr';
        $('img[src*=Image.ashx]').attr('src', function() {
            return 'http://' + site + '/' + $(this).attr('src');
        });
       }

       if ($(window).attr('location').toString().match("audiovisual.metadata.gr") != null) {
       	var site = 'www.audiovisual.gr';
       	$('img[src*=Image.ashx]').attr('src', function() {
       		return 'http://' + site + '/' + $(this).attr('src');
       	});
       }
    

});