$(document).ready(function(){
    
        $('.the-home-fade').cycle({
        timeout: 3000,
        speed: 800
    });
    
    
    $("#appari").hide();
        $('#form-to-validate').validate();
	

    $("div#main-menu ul.ul-level-1").superfish({
        autoArrows: false,
        dropShadow: true,
        animation: {
            opacity: 'show',
            height: 'show'
        }, // fade-in and slide-down animation 
        speed: 'fast'
    });
    
    $('#ticker-wrapper').hide();
    $("div#center-section-content-padding ul.regions").superfish({
        animation: {
            opacity: 'show',
            height: 'show'
        }, // slide-down effect without fade-in 
        speed: 'fast' // 1.2 second delay on mouseout 
    });
    
    
    
    
    $('.xt-multimediacontents-wrapper').hide();
    $('#bookmark').show();
    $('#bookmark').css({
        width: '640',
        height: '420'
    });
    fadeThis($('a.remote-loading:first').attr('href'));
    $('a.remote-loading').click(function(){
    
        $('#product-section-view-image img').fadeOut(400);
        var functionName = 'fadeThis(\'' + $(this).attr('href') + '\')';
        
        setTimeout(functionName, 400);
        
        return false;
        
    });
    $('#home-right-content').hide();
    
    $('.toValidate').validate();
    
});


$(window).load(function(){
	$('div.scrollable').scrollable({size:4});
    $('#bookmark').hide();
    $('.xt-multimediacontents-wrapper').fadeIn();
    $('.xt-multimediacontents-wrapper').cycle({});
    $('#home-right-content').fadeIn();
    $('.right-phade').cycle({
        timeout: 2200,
        speed: 600
    });
    $('.news-phade').cycle({});
    $('#FadeWrapper .xt-multimediacontents-wrapper').cycle({});
    var h = $('#product-section-view-image').height();
    $('#product-section-view-image').css({
        height: h,
        overflow: 'hidden'
    });
	

 
	// $('#ticker-01').animate({paddingRight: "6000px"}, 30000, "linear", function(){$('#ticker-wrapper').fadeOut('slow')});
	
    $('#ticker-wrapper').fadeIn(); 
    $("ul#ticker").liScroll({travelocity: 0.15});
	setTimeout(function(){ $('#ticker-wrapper').fadeOut('slow'); }, 45000); 
	
	
	$(".items img").click(function() { 
 
    // calclulate large image's URL based on the thumbnail URL (flickr specific) 
    var url = $(this).attr("src").replace('thumb', ''); 
 
    // get handle to element that wraps the image and make it semitransparent 
    var wrap = $("#image_wrap").fadeTo("medium", 0.5); 
 
    // the large image from flickr 
    var img = new Image(); 
 
    // call this function after it's loaded 
    img.onload = function() { 
 
        // make wrapper fully visible 
        wrap.fadeTo("fast", 1); 
 
        // change the image 
        wrap.find("img").attr("src", url); 
 
    }; 
 
    // begin loading the image from flickr 
    img.src = url; 
 
// when page loads simulate a "click" on the first image 
}).filter(":first").click();


	
    
});


function fadeThis(href){
    var imgElement = '<img src="' + href + '" alt="Full Size" style="display:none;" />';
    $('#product-section-view-image').html(imgElement);
    $('#product-section-view-image img').fadeIn();
    $('a.remote-loading').addClass('selected');
}
