/********************************************************************************************
* PageEar advertising CornerAd by Webpicasso Media
* Leave copyright notice.  
*
* Lizenzvereinbarung / License agreement
* http://www.webpicasso.de/blog/lizenzvereinbarungen-license-agreements/
*
* @copyright www.webpicasso.de
* @author    christian harz <pagepeel-at-webpicasso.de>
* modifications mineures par PMEtool pour propre usage
*********************************************************************************************/
  

/*
 *  Configuration des fichiers
 */ 

	//nombre au hasard entre 1 et 8
	var nb = Math.floor((8)*Math.random()+1);
	var urlPub = 'http://clk.tradedoubler.com/click?';

	//selon nb
	switch(nb)
	{
	case 1 :
		urlPub = urlPub + 'p=704&a=1577316&g=17176668';
		break;
	case 2 :
		urlPub = urlPub + 'p=59422&a=1577316&g=17175382';
		break;
	case 3 :
		urlPub = urlPub + 'p=72890&a=1577316&g=17721888';
		break;
	case 4 :
		urlPub = urlPub + 'p=57466&a=1577316&g=17645064';
		break;
	case 5 :
		urlPub = urlPub + 'p=20596&a=1577316&g=16533574';
		break;
	case 6 :
		urlPub = urlPub + 'p=20395&a=1577316&g=17493196';
		break;
	case 7 :
		urlPub = urlPub + 'p=25700&a=1577316&g=17406322';
		break;
	case 8 :
		urlPub = urlPub + 'p=44380&a=1577316&g=17279150';
		break;
	default :
		urlPub = 'http://pmetool.com';
		break;
	}
	

	//emplacement de pagegear (scrpits, images et SWF)
	var pathf = 'http://www.pmetool.com/biz/';
	var pathf2 = 'http://www.pmetool.com/biz/' + nb;

	// URL petite image 
	var pagearSmallImg = pathf2 + '/100.jpg'; 
	// URL petit swf
	var pagearSmallSwf = pathf + 'pageear_s.swf'; 

	// URL grande image
	var pagearBigImg = pathf2 + '/500.jpg'; 
	// URL grand SWF
	var pagearBigSwf = pathf + 'pageear_b.swf'; 

// Vitesse d'apparition petit SWF 1-4 (2=Standard)
var speedSmall = 2;
 
// Miroir image ( true | false )
var mirror = 'true'; 

// Couleur du coin is miroir est false
var pageearColor = 'ffffff';  

// URL à ouvrir au click sur pageear
var jumpTo = urlPub; 

// Ouverture dans une nouvelle fenêtre  (new) ou la même (self)
var openLink = 'new';
 
// Ouverture automatique (false:désactivé | 0.1 - X secondes avant ouverture) 
var openOnLoad = false; 

// Fermeture en secondes de pageear si openOnLoad <> False
var closeOnLoad = 3;
 
// Coin de pageear à gauche ou droite (en haut)  (lt: gauche | rt: droite)
var setDirection = 'rt'; 

// Fade in pageear if image completly loaded (0-5: 0=off, 1=slow, 5=fast )
var softFadeIn = 1; 
 
 
/*
 *  Ne rien changer après cette ligne
 */ 

// Flash check vars
var requiredMajorVersion = 6;
var requiredMinorVersion = 0;
var requiredRevision = 0;

// Copyright
var copyright = 'Webpicasso Media, www.webpicasso.de';

// Size small peel 
var thumbWidth  = 200;
var thumbHeight = 200;

// Size big peel
var bigWidth  = 500;
var bigHeight = 500;

// Css style default x-position
var xPos = 'right';

// GET - Params
var queryParams = 'pagearSmallImg='+escape(pagearSmallImg); 
queryParams += '&pagearBigImg='+escape(pagearBigImg); 
queryParams += '&pageearColor='+pageearColor; 
queryParams += '&jumpTo='+escape(jumpTo); 
queryParams += '&openLink='+escape(openLink); 
queryParams += '&mirror='+escape(mirror); 
queryParams += '&copyright='+escape(copyright); 
queryParams += '&speedSmall='+escape(speedSmall); 
queryParams += '&openOnLoad='+escape(openOnLoad); 
queryParams += '&closeOnLoad='+escape(closeOnLoad); 
queryParams += '&setDirection='+escape(setDirection); 
queryParams += '&softFadeIn='+escape(softFadeIn); 


function openPeel(){
	document.getElementById('bigDiv').style.top = '0px'; 
	document.getElementById('bigDiv').style[xPos] = '0px';
	document.getElementById('thumbDiv').style.top = '-1000px';
}

function closePeel(){
	document.getElementById("thumbDiv").style.top = "0px";
	document.getElementById("bigDiv").style.top = "-1000px";
}

function writeObjects () { 
    
    // Get installed flashversion
    var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
    
    // Check direction 
    if(setDirection == 'lt') {
        xPosBig = 'left:-1000px';  
        xPos = 'left';   
    } else {
        xPosBig = 'right:1000px';
        xPos = 'right';              
    }
    
    // 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+'?'+ queryParams,
    				"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+'?'+ queryParams,
    				"width", thumbWidth,
    				"height", thumbHeight,
    				"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 ' + pagearSmallImg);  // non-flash content
    } 
    document.write('</div>');  
    setTimeout('document.getElementById("bigDiv").style.top = "-1000px";',100);
}



