var debug = true;
var t = null;
function InitializePicSlider()
{
    try
    {
        InitPicSlider('picpreview');   
        
 
        t = setTimeout("SetTimer();",4000);
    }
    catch (e)
    {
        alert(e.message);
    }
}

function SetTimer()
{
    window.setInterval("slideSwitch();", 5000);
    //setInterval( "slideSwitch();", 4000, 0 ); 
}
function InitPicSlider(divid)
{    
 //   var elem = window.document.getElementById("ft"); 
 //   var pg = window.document.getElementById("pg"); 
	
	var offset, x, y, w;
    
    var xofs = 240;
    var yofs;
    var footheight;
    var newleft, newtop, newwidth;
    
	try
	{	    	    
	    offset = $('#ft').offset();
        x = offset.left;
        y = offset.top;
        w = $('#pg').width();
    	
    		
	    //w = document.getElementById("pg").offsetWidth;
	    yofs = $('#' + divid).height();// getIdProperty( picpreview, "height");
        footheight = $('#ft').height();
                       
         // document.getElementById("ft").offsetHeight;
        
        newwidth = w - xofs - 50;
        
        $('#' + divid).width(newwidth);
        $('#' + divid).show();
           
	    newleft = x + xofs + 30;
	    newtop = y + footheight - yofs - 13;
	    $('#' + divid).css({ left : newleft, top: newtop});
	    
	    $('#' + divid).show();
       // $('#' + divid).css('top', newtop);
	}
	catch (e)
	{
	    if (debug) alert(e.message);
	}
}

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    $active.addClass('last-active');
    $active.animate({opacity: 0.0});
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}


$(function() {
    
});
