/********************************************************************************************
* PageEar advertising CornerAd by Webpicasso Media
* Leave copyright notice.  
*
* @copyright www.webpicasso.de
* @author    christian harz <pagepeel-at-webpicasso.de>
*********************************************************************************************/
/*
 *  Konfiguration / Configuration
 */ 

var getScriptPath = function(){
  var f=function(e){
    var name=e.tagName;
    if(!!name && name.toUpperCase()=='SCRIPT') return e;
    var c=e.lastChild;
    return (!!c)?f(c):null;
  };
  var es=f(document);
  if(!es) return window.location.hostname  ;
  return es.getAttribute('src') || window.location.hostname  ;
};
 

//  URL to small image edit sesuai kebutuhan
var pagearSmallImg = 'http://www.averagecoder.net/wp-content/plugins/pageroller/icon.jpg'; 
// URL to small pageear swf
var pagearSmallSwf = 'http://www.averagecoder.net/wp-content/plugins/pageroller/pageear_s.swf'; 

// URL to big image edit sesuai kebutuhan
var pagearBigImg = 'http://www.averagecoder.net/wp-content/plugins/pageroller/backgroundz.jpg'; 
// URL to big pageear swf
var pagearBigSwf = 'http://www.averagecoder.net/wp-content/plugins/pageroller/pageear_b.swf'; 

// Movement speed of small pageear 1-4 (2=Standard)
var speedSmall = 4; 
// Mirror image ( true | false )
var mirror = 'true'; 

// Color of pagecorner if mirror is false
var pageearColor = 'FFFFFF';  

// URL to open on pageear click
var jumpTo = '' ;

// Browser target  (new) or self (self)
var openLink = 'self'; 

// Opens pageear automaticly (false:deactivated | 0.1 - X seconds to open) 
var openOnLoad = false; 

// Second until pageear close after openOnLoad
var closeOnLoad = 5; 

// Set direction of pageear in left or right top browser corner (lt: left | rt: right )
var setDirection = 'rt'; 

/*
 *  Do not change anything after this line
 */ 

// 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  = 90;
var thumbHeight = 90;

// 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); 


function openPeel(){
	document.getElementById('bigDiv').style.top = '0px'; 
	document.getElementById('bigDiv').style.left = '0px';
	document.getElementById('thumbDiv').style.top = '-1000px';
	document.getElementById("thumbDiv").style.width = "0px";
	document.getElementById("thumbDiv").style.height = "0px";
	document.getElementById('bigDiv').style.height = '0px';
}

function closePeel(){
	document.getElementById("thumbDiv").style.top = "0px";
	document.getElementById("thumbDiv").style.width = "90px";
	document.getElementById("bigDiv").style.top = "-1000px";
	document.getElementById('bigDiv').style.height = '0px';
	document.getElementById("thumbDiv").style.height = "0px";
	
}

function writeObjects () { 
    
    // Get installed flashversion
    var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
    
    // Check direction 
    if(setDirection == 'lt') {
        xPos = 'left';        
    }
    
    // Write div layer for small swf
    document.write('<div id="thumbDiv" style="float:right;position:relative;z-index:7;top:0px;height: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');  // non-flash content
    } 
    document.write('</div>'); 
    
    // Write div layer for big swf
    document.write('<div id="bigDiv" style="float:right;position:relative;z-index:5;top:-1000px;height:0px;">');    	
    
    // 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>'); 
    
     
   
}
