// data loaded via flashvars

var flashvars = {
	dataSource:'js', 
	bgStart:"", 
	bgHover:"",
	cornerWiggle:"yes",
	diagnalText:"",
	diagnalTextColor:"",
	diagnalTextBgColor:"",
	linkUrl:"http://www.oralhealthia.com/dentist-by-1/",
	smallImg:"http://www.oralhealthia.com/wp-content/themes/Monthly-Mouthful/pageear/pageear_s2.jpg",
	largeImg:"http://www.oralhealthia.com/wp-content/themes/Monthly-Mouthful/pageear/pageear_b2.jpg",
	bottomImg:"",
	HTMLtxt1:""
};

/********* 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 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");
	swf_script_tag.onload = pMain; // Run pMain() once jQuery has loaded
	swf_script_tag.onreadystatechange = function () { // IE
		if (this.readyState == 'complete' || this.readyState == 'loaded') pMain();
	}
	document.getElementsByTagName("head")[0].appendChild(swf_script_tag);
} else {
	pMain();	
}

function pMain() {
	
	// on page load...
	$.noConflict();
	jQuery(document).ready(function() {
		
		// add mask container for peel
		var pMask = jQuery('<div></div>');
		pMask.attr('id','pMask');
		pMask.css({
			'position':'absolute',
			'top':'0',
			'right':'0',
			'z-index':'9999',
			'height':'300px',
			'width':'300px',
			'overflow':'hidden'
		});
		
		// add container for peel swf embed
		var pagePeel = jQuery('<div></div>');
		pagePeel.attr('id','pagePeel');
		
		// add style for pagePeel to head since swfobject rewrites the div to an object
		jQuery('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
		jQuery('body').append(pMask);
		
		// swfobject vars
		var params = {wmode:"transparent",allowscriptaccess:"always"};
		var attributes = {};
		
		// embed the peel via swfobject
		swfobject.embedSWF("http://deltadental.tmg33.com/oralhealth/wp-content/themes/Monthly-Mouthful/peel_CS5_modified.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() {
	jQuery("#pMask").stop().animate({"width": "700px", "height": "650px"}, 0);
	jQuery('p.banner').toggle('fast');
}

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