
// load data via external xml
var flashvars = {
	dataSource:'xml',
	dataFile:'data.xml'
};

// to instead set data here comment out lines 3-6 above and uncomment the following
/*
var flashvars = {
	dataSource:'js',
	bgStart:"#0000CC", 
	bgHover:"#EE0000",
	cornerWiggle:"yes",
	diagnalText:"COLORS IMAGES TEXT AND LINK SET IN XML",
	diagnalTextColor:"#FFFFFF",
	diagnalTextBgColor:"#CC0000",
	linkUrl:"http://activeden.net/user/klovera",
	smallImg:"corner.png",
	largeImg:"product.png",
	bottomImg:"bottom.png",
	HTMLtxt1:"<font color=\"#e7cd78\">Custom Text!</font><br><font color=\"#aaaaaa\">Supports HTML</font>"
};*/

/********* DO NOT EDIT BELOW *********/

// load jQuery & swfobject if not already loaded
if (typeof jQuery === "undefined" || jQuery.fn.jquery !== '1.5.2') {
	// check for swfobject
	if (typeof swfobject === "undefined") {
		var swf_script_tag = document.createElement('script');
		swf_script_tag.setAttribute("type","text/javascript");
		swf_script_tag.setAttribute("src","http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js");
		document.getElementsByTagName("head")[0].appendChild(swf_script_tag);
	}
	var script_tag = document.createElement('script');
	script_tag.setAttribute("type","text/javascript");
	script_tag.setAttribute("src","http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js");
	script_tag.onload = pMain; // Run pMain() once jQuery has loaded
	script_tag.onreadystatechange = function () { // IE
		if (this.readyState == 'complete' || this.readyState == 'loaded') pMain();
	}
	document.getElementsByTagName("head")[0].appendChild(script_tag);
} else {
	pMain();	
}

function pMain() {
	
	// on page load...
	$(document).ready(function() {
		
		// add mask container for peel
		var pMask = $('<div />');
		pMask.attr('id','pMask');
		pMask.css({
			'position':'absolute',
			'top':'0',
			'right':'0',
			'z-index':'9999',
			'height':'100px',
			'width':'100px',
			'overflow':'hidden'
		});
		
		// add container for peel swf embed
		var pagePeel = $('<div />');
		pagePeel.attr('id','pagePeel');
		
		// add style for pagePeel to head since swfobject rewrites the div to an object
		$('head').append('<style type="text/css">#pagePeel{position:absolute;height:650px;width:700px;top:0;right:0;z-index:9998}');
		
		// alternative content before loading swf
		pagePeel.html('<h1>Alternative content</h1><p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>');
		
		// nest the pagePeel div inside the pMask div
		pMask.append(pagePeel);
		
		// add divs to the page body
		$('body').append(pMask);
		
		// swfobject vars
		var params = {wmode:"transparent",allowscriptaccess:"always"};
		var attributes = {};
		
		// embed the peel via swfobject
		swfobject.embedSWF("peel.swf", "pagePeel", "700", "650", "10.0.0", "expressinstall.swf", flashvars, params, attributes);
	});
	
}

// function to 'open' the containing div for the peel - called from AS3 in swf
function openPeel() {
	$("#pMask").stop().animate({"width": "700px", "height": "650px"}, 0);
	$('p.banner').toggle('fast');
}

// function to 'close' the containing div for the peel - called from AS3 in swf
function closePeel() {
	$("#pMask").stop().delay(1000).animate({"width": "100px", "height": "100px"}, 0);
	$('p.banner').toggle('fast');
}
