//detect browser
var version_major;
var version_minor;
var safari;
var opera;
var msie;
var mozilla;

jQuery.each(jQuery.browser, function(i, val) {
	if(val){
		switch (i) {
			case "safari":
				safari=true;
				break;
			case "opera":
				opera=true;
				break;
			case "msie":
				msie=true;
				break;
			case "mozilla":
				mozilla=true;
				break;
		}
	
	}
}); 

function FlashAutoInstallCallBack(e){
	//if this funciton is being fired, and success=false, it means one of two things:
	//	1. the user cancelled the auto update
	//	2. the auto-updated failed for some reason
	//either way, send them to the update page
	
	
	//Properties of this event object are:

    //* success, Boolean to indicate whether the embedding of a SWF was success or not
    //* id, String indicating the ID used in swfobject.registerObject
    //* ref, HTML object element reference (returns undefined when success=false) 
	
	if(!e.success){
		//redirect to landing page here
		window.location.replace("update.php");

	}
}

//////////////////////////////////////////////////////////////////////////////////////////////////
//
//	Code for External Interface Calls - BEGIN
//
//////////////////////////////////////////////////////////////////////////////////////////////////

var jsReady = false;
var curGalleryIndex=0;

function isReady() {
 return jsReady;
}

function pageInit() {
 jsReady = true;
}

function thisMovie(movieName) {
 if (navigator.appName.indexOf("Microsoft") != -1) {
	 return window[movieName];
 } else {
	 return document[movieName];
 }
}

function playMovie(newIndex) {
	var id="swf"+newIndex;
	if(jsReady){
		if(thisMovie(id)){
			try {
				thisMovie(id).playMovie();
			} catch(e) {
				//alert("SWF does not have playMovie() method");
			}
		}
	}
}

function resetMovie(oldIndex) {
	var id="swf"+oldIndex;
	if(jsReady){
		if(thisMovie(id)){
			try {
				thisMovie(id).resetMovie();
			} catch(e) {
				//alert("SWF does not have resetMovie() method");
			}
		}
	}
}
//////////////////////////////////////////////////////////////////////////////////////////////////
//
//	Code for External Interface Calls - END
//
//////////////////////////////////////////////////////////////////////////////////////////////////