function createRequestObject() {
	var ro;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		ro = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else{
		ro = new XMLHttpRequest();
	}
	return ro;
}

var browser = navigator.appName;
var http = createRequestObject();

if(browser == "Microsoft Internet Explorer"){
	var meth = "POST";
}
else{
	var meth = "GET";
}

window.onload = function(){
	setTimeout("correctPNG('')",10);
	setTimeout("youtube('')",50);
}

function youtube(){

	if(document.getElementById('tube').value != "0"){
		var so = new SWFObject("http://www.youtube.com/v/"+document.getElementById('tube').value+"&autoplay=1", "", "341", "261", "8", "#000000");
		so.addParam("wmode", "transparent");
		so.write("youtube");
	
	}
}

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');

    	$next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
        $active.removeClass('active last-active');
        });
}

$(function() {
	var sec = parseInt(document.getElementById('sec').value *1000);
    setInterval( "slideSwitch()", sec );
});