////////////////// PARAMETERS TO CUSTOMIZE:

var imageSets = 3; // number of small/large image pairs
var imagePath = '/imgs/images/fr/'; // where images live

// image sets should be named:
// smallPeel_0.jpg/largePeel_0.jpg, smallPeel_1.jpg/largePeel_1.jpg, etc...

var small = 400; // small ear/peel size opening, should be less then 400!!!
var large = 500; // large ear/peel size opening, should be less then 800!!!
var delay = 3; // (seconds) to stay open

var linkTo = "http://www.justepourrire.com/home/?peelhahaha=fr"; // click target link
var openLink = '_self'; // _self or _blank 

// load parameters
var parameters = 'linkTo='+escape(linkTo); 
parameters += '&openLink='+escape(openLink); 
parameters += '&small='+escape(small); 
parameters += '&large='+escape(large); 
parameters += '&delay='+escape(delay); 
parameters += '&imageSets='+escape(imageSets); 
parameters += '&imagePath='+escape(imagePath); 

///////////////// FIXED (DO NOT CHANGE!) PARAMETERS:

var pagearSmallSwf = '/imgs/images/PeelSmall'; 
var pagearBigSwf = '/imgs/images/PeelLarge'; 

// Flash check vars
var requiredMajorVersion = 6;
var requiredMinorVersion = 0;
var requiredRevision = 0;

// Size small peel 
var thumbWidth  = 150;
var thumbHeight = 150;

// Size big peel
var bigWidth  = 800;
var bigHeight = 800;

var xPosBig = 'right:2000px';  
var xPos = 'right';      


var jsReady = false;

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 sizeUp(value)
{
	document.getElementById('bigDiv').style.top = '0px'; 
	document.getElementById('bigDiv').style[xPos] = '0px';
	document.getElementById('thumbDiv').style.top = '-1000px';
	// start the large peel...
   thisMovie("bigSwf").sendToLarge(value);
}

function sizeDown(value)
{
	document.getElementById("thumbDiv").style.top = "0px";
	document.getElementById("bigDiv").style.top = "-1000px";
	// start the small peel...
   thisMovie("smallSwf").sendToSmall(value);
}
function writeObjects ()
{ 
    
    // Get installed flashversion
    var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
    
    
    // Write div layer for big swf
    document.write('<div id="bigDiv" style="position:absolute;width:'+ bigWidth +'px;height:'+ bigHeight +'px;z-index:9999;'+xPosBig+';top:-100px;">');    	
    
    // Check if flash exists/ version matched
    if (hasReqestedVersion) {    	
    	AC_FL_RunContent(
    				"src", pagearBigSwf+'?'+ parameters,
    				"width", bigWidth,
    				"height", bigHeight,
    				"align", "middle",
    				"id", "bigSwf",
    				"quality", "high",
    				"bgcolor", "#FFFFFF",
    				"name", "bigSwf",
    				"wmode", "transparent",
    				"allowScriptAccess","always",
    				"type", "application/x-shockwave-flash",
    				'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
    				"pluginspage", "http://www.adobe.com/go/getflashplayer"
    	);
    } else {  // otherwise do nothing or write message ...    	 
    	document.write('no flash installed');  // non-flash content
    } 
    // Close div layer for big swf
    document.write('</div>'); 
    
    // Write div layer for small swf
    document.write('<div id="thumbDiv" style="position:absolute;width:'+ thumbWidth +'px;height:'+ thumbHeight +'px;z-index:9999;'+xPos+':0px;top:0px;">');
    
    // Check if flash exists/ version matched
    if (hasReqestedVersion) {    	
    	AC_FL_RunContent(
    				"src", pagearSmallSwf+'?'+ parameters,
    				"width", thumbWidth,
    				"height", thumbHeight,
    				"align", "middle",
    				"id", "smallSwf",
    				"quality", "high",
    				"bgcolor", "#FFFFFF",
    				"name", "smallSwf",
    				"wmode", "transparent",
    				"allowScriptAccess","always",
    				"type", "application/x-shockwave-flash",
    				'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
    				"pluginspage", "http://www.adobe.com/go/getflashplayer"
    	);
    } else {  // otherwise do nothing or write message ...    	 
    	document.write('no flash installed');  // non-flash content
    } 
    document.write('</div>');  
    setTimeout('document.getElementById("bigDiv").style.top = "-1000px";',100);
}

