
//---------------------------------------------------------------------------------------------------
// MOZILLA ACTIVE-X CONROL
//---------------------------------------------------------------------------------------------------

var dependentPages = new Array( 
	'demo-hips-stretch-exercise.php',
	'demo-neck-stretch-exercise.php'							   
);

var pageIsDependent = false;

for( var i=0; i<dependentPages.length; i++ )
{
	var page = dependentPages[i];
	
	if( location.href.indexOf( page ) != -1 )
	{
		pageIsDependent = true;
		break;
	}
}

function ffaxinstall()
{
	if( confirm("To view the movie on this page with Firefox, you need the Firefox ActiveX Plugin.\n\nPlease do the following:\n\n1. Click the OK button.\n\n2. Click Edit Options on the Firefox Safety Bar.\n\n3. Add the DeskTherapy.com site to your list of trusted sites.\n\n4. Refresh this page and install the Mozilla ActiveX Plugin.\n\n") )
	{
		installAxFF15();
	}
	else
	{
		parent.location.href = "/demo-exercise-video-library.php";
	}
}

function installAxFF15()
{ 
	xpi = { 'Mozilla Firefox 1.5 ActiveX Plug-in' : 'mozactivex-ff-15.xpi' }; 
	InstallTrigger.install(xpi); 
} 

if( pageIsDependent )
{
	//detect Firefox ActiveX plugin
	var geckoax = false;
	
	if ( navigator.userAgent.indexOf("Firefox") != -1 && navigator.userAgent.indexOf("Mac") == -1 )
	{
		if ( navigator.plugins && navigator.plugins.length )
		{
			for ( var x=0; x<navigator.plugins.length; x++ )
			{
				if( navigator.plugins[x].filename.toLowerCase() == 'npmozax.dll' )
				{
					geckoax = true;
					break;		
				}	
			}
		}
		if( !geckoax )
		{
			ffaxinstall();
		}
	}
}


//---------------------------------------------------------------------------------------------------
// SAMPLE VIDEOS
//---------------------------------------------------------------------------------------------------

var previewWindow = 0;

function showVideo( flv )
{
	if(previewWindow)
	{
		if(!previewWindow.closed) previewWindow.close();
	}
	
	previewWindow = open( 
		'swf/video_preview.php?flv='+flv,
		'previewWindow',
		'toolbar=no, location=no, directories=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=512, height=384');
}

//---------------------------------------------------------------------------------------------------
// PROMO BOX ROUND CORNERS
//---------------------------------------------------------------------------------------------------

var roundCorners = Rico.Corner.round.bind(Rico.Corner);

var RicoCorners = Class.create();
RicoCorners.prototype = {
	initialize: function( className, propsObj ) 
	{		
		var elemArray = $$( '.' + className );
		
		for( var i=0; i<elemArray.length; i++ )
		{
			roundCorners(elemArray[i], propsObj );
		}
	}
};

function initCornerRules(){
	var cornersRule1 = new RicoCorners( 'promo-dark-green', {bgColor:'#ffffff',color: '#024A3C'} );
	var cornersRule2 = new RicoCorners( 'promo-light-green', {bgColor:'#ffffff',color: '#6EBB1F'} );
	var cornersRule2 = new RicoCorners( 'promo-light-grey', {bgColor:'#ffffff',color: '#eeeeee', border: '#cccccc'} );
}

Event.observe(window, 'load', initCornerRules, true);

//---------------------------------------------------------------------------------------------------


function dtpopup(urlstr)
{
	w = 640;
	h = 680;
	window.open( urlstr, "DTpopup", "menubar=no,toolbar=no,directories=no,scrollbars=yes,x=0,y=0,width="+w+",height="+h+"");
}