// JavaScript Document



function resize(w, h) {
	$("#flash_replaced").flashResize({
  		//minWidth: '1100px',
  		minHeight: h
	});
}


var status_timer;
var loop_count;
var new_window;

function QuickTimeStatus()
{
    var new_movie;
    
    new_movie = new_window.document.embedded_qtvr;
    
    var movie_status = new_movie.GetPluginStatus();
    
    if( movie_status == "Playable" || movie_status == "Complete" )
    {
        new_movie.Play();
        window.clearInterval( status_timer );        
    }
    else
        loop_count += 1;
        
    if( loop_count > 10 )
    {
        alert( "There seems to have been a problem with Quicktime." );
        window.clearInterval( status_timer );
    }

}

function showQTVR( url, title )
{
	// " + title + " 
    var doc_wrapper = "<html><head><title>Disney Dream : 360s</title><style type=\"text/css\">body { margin: 0; padding: 0; }</style></head><body>" +
                    "<object id=\"embedded_qtvr\" classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" " +
                    "codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\" height=\"600\" width=\"800\">" +
                    "<param name=\"src\" value=\"" + url + "\" /><param name=\"type\" value=\"video/quicktime\" />" +
                    "<param name=\"width\" value=\"800\" /><param name=\"height\" value=\"600\" />" +
                    "<param name=\"autohref\" value=\"true\" /><param name=\"type\" value=\"video/quicktime\" />" +
                    "<param name=\"movieid\" value=\"0\" /><param name=\"qtsrcdontusebrowser\" value=\"true\" />" +
                    "<embed id=\"embedded\" movieid=\"0\" src=\"" + url + "\" height=\"600\" width=\"800\" " +
                    "type=\"video/quicktime\" pluginspage=\"http://www.apple.com/quicktime/download/\" autohref=\"true\">" +
                    "</object></body></html>";
					
	var winl = (screen.width-800)/2;
	var wint = (screen.height-600)/2;
    var settings = "resizable=no,toolbar=no,location=no,status=no,scrollbars=no,width=800,height=600,top=" + wint + ",left=" + winl;
    new_window = window.open( "", "qtvr_popup", settings );
    
    new_window.document.write(doc_wrapper);
    
    new_window.focus();
    
	if(!new_window) alert("Please disable any pop-up blockers to view the 360 Views");
	
    // fire this off once immediately just to check, then check every second
//    QuickTimeStatus();
    
  //  status_timer = window.setInterval("QuickTimeStatus();", 1000 );
//    loop_count = 0;
}

/*
function showQTVR(url) {
		
//		$("#embedded").attr({src : url});
//		$("#src_param").val(url);
//		$("#trigger").trigger("click");
		
		
		
	var appender = '<object id="embedded_qtvr" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="600" width="800"><param name="src" value="' + url + '" /><param name="type" value="video/quicktime"/><param name="width" value="800" /><param name="height" value="600" /><param name="autohref" value="true" /><param name="type" value="video/quicktime" /> <param name="movieid" value="0" /><param name="qtsrcdontusebrowser" value="true" /><embed id="embedded" movieid="0" src="' + url + '" height="600" width="800" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/" autohref="true"></object>';
			
		$('#qtvr').empty();
		$(appender).appendTo('#qtvr');
		
		$('#trigger').trigger('click');
}
*/