$(document).ready(function(){
    /*if(document.getElementById('fade'))
    {
		$('#fade').load(function(){
			show_content();
    	});	
    } 
    else*/ 
    show_content();
});
function set_menu_width()
{
	$('.menu').each(function(){
    	children = $(this).children();
    	//if($(this).attr('class') == 'menu active') 	alert($(children[1]).width());	
    	$(children[0]).width($(children[1]).width());
    }) 
}
function show_content()
{
	
	
	$('body').css({'backgroundColor' : '#ffffff'});
    $('.content').fadeIn();
    set_menu_width();
    setTimeout(set_menu_width,500);
    $("div.imageContainer > img").css({"width": $('body').width()});
    //$("div.menu").css({"margin-top": $("div.imageContainer > img").height()-114+'px'});
    //$("div.menu").css({"width": $('body').width()});
    //$("body").css({"height":window.innerHeight+'px'});
    $(window).bind('resize',function(){
        if($('body').width() > parseInt($('div.content').css('min-width')))
        {
            $("div.imageContainer > img").css({"width": $('body').width()});
            //$("div.menu").css({"width": $('body').width()}); 
        }
        //else $("div.menu").css({"width": parseInt($('div.content').css('min-width'))});     
    })
    set_menu_width();
    blind();
}
function blind()
{
    var i = 0;
    $('.pic1').each(function (){
        var par = $(this).parent();
        
        $(this).prepend("<div id='white_"+ i +"' style='cursor: pointer;background-color: #fff;display: none;width: "+ $(this).width() +"px; height: "+ $(this).height() +"px;	filter:progid:DXImageTransform.Microsoft.Alpha(opacity=20); opacity: 0.2;position: absolute;'></div>");
        pic = this;
        $('div',this).click(function(){
            location.href = $(this).next().attr('href');
            $(this).next().click();      
        });
        $(this).mouseover(function(){
            $('div',this).show();
            $('.grey_line', par).attr({'class' : 'black_line'});
        });
        $(this).mouseout(function(){
            $('div',this).hide();
            $('.black_line', par).attr({'class' : 'grey_line'});
        });
        i++;
        return;
    });
    $('.brand_gal').each(function (){
        $(this).prepend("<div id='white_"+ i +"' style='cursor: pointer;background-color: #fff;display: none;width: "+ $(this).width() +"px; height: "+ $(this).height() +"px;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=20); opacity: 0.2;position: absolute;'></div>");
        pic = this;
        $('div',this).click(function(){
            location.href = $(this).next().attr('href');
            $(this).next().click();      
        });
        $(this).mouseover(function(){
            $('div',this).show();
        });
        $(this).mouseout(function(){
            $('div',this).hide();
        });
        i++;
        return;
    });
}
function array_search( needle, haystack, strict ) {	// Searches the array for a given value and returns the corresponding key if
	// successful
	// 
	// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)

	var strict = !!strict;

	for(var key in haystack){
		if( (strict && haystack[key] === needle) || (!strict && haystack[key] == needle) ){
			return key;
		}
	}

	return false;
}


