
// Standard Flash Version 2.0


//----------------------------------------------- Browser Check ----------------------------------------------------------------------

  var agent = navigator.userAgent.toLowerCase();
  var name = navigator.appName.toLowerCase();
	
function ScaladoBrowserCHK() {
  

  this.major = parseInt(navigator.appVersion);
  this.minor = parseFloat(navigator.appVersion);


  this.ns  = ((agent.indexOf('mozilla')!=-1) && (agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1) && (agent.indexOf('opera')==-1) && (agent.indexOf('webtv')==-1) && (agent.indexOf('hotjava')==-1));
  this.ns4 = (this.ns && (this.major==4));
  this.ns6up = (this.ns && (this.major >= 5));
  this.ns7 = (this.ns6up && (agent.indexOf("7") !=-1));
  
  this.ie = ((agent.indexOf('msie') != -1) && (agent.indexOf('opera') ==-1));
  this.ie4 = (this.ie && (this.major == 4) && (agent.indexOf("msie 4")!=-1));
  this.ie4up = (this.ie  && (this.major >= 4));
  
  this.opera = (agent.indexOf('opera') != -1);
  
  this.win = ( (agent.indexOf('win')!=-1) || (agent.indexOf('16bit')!=-1));
  this.mac = (agent.indexOf('mac')!=-1); //if (this.mac && this.ie5up) this.js = 1.4;
  
  this.explorer = (this.win && this.ie4up != this.ie4);
  this.netscape = (this.ns4 || this.ns6up);

  this.java = (navigator.javaEnabled());	
  
}


browser = new ScaladoBrowserCHK();



// -------------------------------------- find Object -----------------------------------------------------------------------

function ScaladoObjects(layerName, textString){					// Finds all the object on the html page 

	var p,i,x;

  	if(!textString){ 
  		textString = document;
  	}
  	if((p = layerName.indexOf("?"))> 0 && parent.frames.length){

    		textString = parent.frames[layerName.substring(p+1)].document; layerName = layerName.substring(0,p);
  	}

  	if(!(x = textString[layerName]) && textString.all)			// netscape 4
  	
  		x = textString.all[layerName]; 
  	
  	for (i = 0; !x && i < textString.forms.length; i++) 
  	
  		x = textString.forms[i][layerName];
  		
  	for(i = 0; !x && textString.layers && i < textString.layers.length; i++) 
  	
  		x = ScaladoObjects(layerName,textString.layers[i].document);
	
  	if(!x && document.getElementById)					// netscape 6, explorer
  	
  		x = document.getElementById(layerName); return x;
	}
	

// ----------------------------------- Set TextToLayer -----------------------------------------------------------------


function setTextToLayer(layerName,x,text) {					// write text to layers
	
	var newText = '' + text + '';

  	if ((obj=ScaladoObjects(layerName))!=null) with (obj){
	    	if (document.layers){
	    	
	   		document.write(unescape(newText)); document.close();
		}
		
	    	else{ 
	    		innerHTML = unescape(newText);
		}
	}
}


// ----------------------------------- Set Text ----------------------------------------------------------------------

function setText(layer, text){											


if (browser.ns4){

	setTextToLayer(layer + '_ns4','',text);					// if Netscape 4
	
}else{

	setTextToLayer(layer,'',text);
	
}	
}



// ----------------------------------- Declare the zoomviewer object --------------------------------------------------------------------------



var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var zoomviewerObj=InternetExplorer ? document.getElementById("zoomviewer") : document.zoomviewer;




// ----------------- Flash version check. Only needed by netscape and only working with netscape ----------------------------------------------


function verCaps(id) {
	
	if (typeof(caps) != "undefined" && typeof(caps.id) != "undefined" && typeof(caps.getComponentVersion) != "undefined")
	
		return caps.getComponentVersion(id, "ComponentID");
	else
	
		return false;
	}

	var FlashPlugIn = verCaps("{D27CDB6E-AE6D-11CF-96B8-444553540000}");

	if (FlashPlugIn) 										// Flash PlugIn false
	
		NoFlash = FlashPlugIn;
		IsFlash = false;
		IsShockwave = false;
		NoShockwave = FlashPlugIn;

	if (navigator.plugins) { 									// Flash PlugIn true
	
		for (var i=0; i < navigator.plugins.length; i++){
    		
    			if (navigator.plugins[i].name.toLowerCase().indexOf("shockwave flash") >= 0){
      			
      				IsFlash = true;
      				FlashVersion = navigator.plugins[i].description.substring(navigator.plugins[i].description.toLowerCase().lastIndexOf("flash ") + 6, navigator.plugins[i].description.length);
    		}
    		
  	}
}

	if(!InternetExplorer&&IsFlash){
		
  	if(parseInt(FlashVersion.charAt(0))<6){
    
    	var ok=confirm("You need Flash Movie Player version 6 or greater to be able to view this page. Your version is "+FlashVersion+". Download latest Flash Player?");
    
    	if(ok){
      
      	window.open("http://www.macromedia.com/go/getflashplayer");
    	}
  	}
	}



// ---------------------------- Handle all the the FSCommand messages in a Flash movie -----------------------------------------------

function zoomviewer_DoFSCommand(command, args) {
	
  var start=0;
  var newString="";
  var currentString=unescape(command);
  
  //alert(currentString);
  
  var stop=currentString.indexOf("|||");
  
  	while(stop!=-1){
  		
		newString=currentString.slice(stop+3);
		
		//alert(currentString.substring(start,stop));
		
		eval(currentString.substring(start,stop));
		start=0;
	        currentString=newString;
		stop=currentString.indexOf("|||",start);
	}
	
  	eval(currentString);

}


// --------------------------------------------- Hook for Internet Explorer --------------------------------------------------------------


if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('Sub zoomviewer_FSCommand(ByVal command, ByVal args)\n');
	document.write('  call zoomviewer_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
}





// ------------------------------------------------- ImageZoom Flash API ------------------------------------------------------------------


   function setStatusText(text){
      window.status=text;
   }


 

// ----------------------------------------- set Viewer ------------------------------------------------------------

var javaViewer = false;						// note only for function template
var flashViewer = true;

