function ge(a)
{
	return document.getElementById(a);	
}

var preloaderImage = new Image();
preloaderImage.src = "/images/loading.gif";

function attachEventToNumbers()
{
    $('.section_options a').click(function(){
       $('.section_options a').removeClass('pageSelected');
       $(this).addClass('pageSelected');
    });
}
function setDefaultSectionContent(a)
{
    $('.preloading-image').attr('src', preloaderImage.src);

    $('.preloading-image').show();
    //alert(0);
    //$('.slideshow').hide();
    $('.slideshow').css('top',600);
    if(window.timer)clearTimeout(timer);
    $(".info-content").hide();
    $('.welcome').hide();
    $('.window').hide();
    $('.paging').hide();
    $('.portfolio-image').hide();
    $('.info-content').stop(true).animate({top:650},'slow');

    //$('#contentarea').hide();

	$.ajax({
		url:"/ajax/createDefaultContent/",
		data:{ 'subsection': a},
		type:"POST",
		success:function(data){
			$("#contentarea").html(data);
	        enableGallery();
	        //$('.preloading-image').hide();
	        $('#contentarea').fadeIn();
	        attachEventToNumbers();
		},
		error:function(){console.log("Problem:Reload");setDefaultSectionContent(a)}
	});
	
	/*
    $.post('/ajax/createDefaultContent/', { 'subsection': a}, function(data){
        
        $('#contentarea').fadeIn("slow", "linear");
        $("#contentarea").html(data);
        //$("#contentarea").load(function(){
            enableGallery();

        //});

        //alert(0);
        //rotateSwitch();
        
        attachEventToNumbers();

    });
    */

}

function setContent(a,b)
{
    
    $('.preloading-image').attr('src', preloaderImage.src);

    $('.preloading-image').show();
    //alert(0);
    //$('.slideshow').hide();
    $('.slideshow').css('top',600);
    if(window.timer)clearTimeout(timer);
    $(".info-content").hide();
    $('.welcome').hide();
    $('.window').hide();
    $('.paging').hide();
    $('.portfolio-image').hide();
    $('.info-content').stop(true).animate({top:650},'slow');
    //$('#contentarea').css('left',1200);
    //$('.info-content').stop(true).animate({right:650},'fast');
    
    //$('#contentarea').hide();

	$.ajax({
		url:"/ajax/createContent/",
		data:{ 'listid': a, 'type': b },
		type:"POST",
		success:function(data){
			$("#contentarea").html(data);
	        enableGallery();
	        //$('.preloading-image').hide();
	        $('#contentarea').fadeIn();
	        attachEventToNumbers();
		},
		error:function(){console.log("Problem:Reload");setContent(a,b)}
	});
	/*
    $.post('/ajax/createContent/', { 'listid': a, 'type': b }, function(data){
        //$('.preloading-image').toggle();
        //$('.preloading-image').attr('src','none.jpg');
       
        

        
        $("#contentarea").html(data);
        
        //$('#galleryimage > a > img').imagesLoaded( function( $images ) {
        	//alert(0);
		  // callback provides one argument, the jQuery object of child images
		  //console.log( $images.length + ' images have been loaded in ' + this );
		  
          //$('#contentarea').fadeIn("slow", "linear");
          //$('#contentarea').show();
          //$('#galleryimage > a > img').each(function(){
          	//$(this).show();
          //});
          enableGallery();
          $('.preloading-image').hide();
          $('#contentarea').fadeIn();
          attachEventToNumbers();

        
		//});
		
		            
        //$('#contentarea').stop(true).animate({left:0},'slow');
        //alert(0);
        //rotateSwitch();
        
        
    });
	*/
	
}

function setTextContent(a)
{
    //$('.slideshow').hide();
    $('.slideshow').css('top',600);
    if(window.timer)clearTimeout(timer);
    $('.window').hide();
    $('.paging').hide();
    $('.welcome').hide();

    $.post('/ajax/createTextContent/', { 'listid': a }, function(data){
    	$('.preloading-image').hide();
        $(".info-content").html(data);
        

        $('.info-content').css({'top':10});
        $('.info-content').css({'left':800});
        $('.info-content').stop(true).animate({left:0},'slow');
        $(".info-content").show();
        current = '.info-content';

        $('.info-content').scrollbar();


    });

}
