// JavaScript Document

if(!Array.indexOf){
	    Array.prototype.indexOf = function(obj){
	        for(var i=0; i<this.length; i++){
	            if(this[i]==obj){
	                return i;
	            }
	        }
	        return -1;
	    }
	}


function strstr( haystack, needle, bool ) {
    var pos = 0;
 
    pos = haystack.indexOf( needle );
    if( pos == -1 ){
        return false;
    } else{
        if( bool ){
            return haystack.substr( 0, pos );
        } else{
            return haystack.slice( pos );
        }
    }
}
$(document).ready(function(){
	
	$('#index img').hover(function() {
		$.src = $(this).attr('src');
		$.src = $.src.split('.');
 		 $(this).attr('src','http://www.starmela.'+$.src[$.src.length-3]+'.'+$.src[$.src.length-2]+'-over.png');
	}, function() {
  		$(this).attr('src','http://www.starmela.'+$.src[$.src.length-3]+'.'+$.src[$.src.length-2]+'.png');
	});
	$('.subnav-img img').hover(function() {
		$.src = $(this).attr('src');
		
		if (!strstr($.src, '-over.png')){
			$.src = $.src.split('.');
			$(this).attr('src','http://www.starmela.'+$.src[$.src.length-3]+'.'+$.src[$.src.length-2]+'-over.png');
		}
 		
	}, function() {
		if (!strstr($.src, '-over.png')){
  		$(this).attr('src','http://www.starmela.'+$.src[$.src.length-3]+'.'+$.src[$.src.length-2]+'.png');
		}
	});
	
	$('div.itemrow').each(function(){
		if ( this.childNodes.length == 0 )
  		$(this).remove();						   
	});
	
	//accordion
	if ($.browser.msie && $.browser.version==6){
		$('#right-col').css('width','745px');
		$('#content').css('width','971px');
	}else{
	$('.subnav').hide();
	$('.nav-link').click(function(){
		$(this).next('span').slideToggle('slow').siblings('.subnav:visible').slideUp('slow');
		return false;
	});
	}
	
	var windowh = $(window).height();
	$('#whole').attr('height',windowh);
	
});