//Initiating jQuery to work with Prototype;
//var $j = jQuery.noConflict(); located inside jquery-1.2.min.js file

$j(document).ready(function() { onDocumentLoad(); });
$j(window).load(function() { onWindowLoad(); });

//Global Variables

/*
 * Standard page loading functions for prototype / jQuery
 */
function onDocumentLoad(){
	
}

//Stuff put into this function doesnt run until the entire document is loaded flash and all
function onWindowLoad(){
	if($j('#mainContentRight').height()>$j('#mainContentLeft').height()) {
		setTimeout("$j('#mainContentLeft').height($j('#mainContentRight').height()-10);",1000);
		setTimeout("$j('#mainContentLeftTop').height($j('#mainContentRight').height()-10);",1000);
	}

	$j("#reloadCaptcha").click(function(){
		$j('#contactForm').children().find('img').replaceWith('<img alt="verification code" src="/datasafe_ca/manager/includes/veriword.php?rand='+Math.random()+'"/>');
	});

	//add shadow to the homepage image
	$j('#mainImage').wrap($j('<div />').addClass("img-shadow"));
	
	var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;

	if(IE6){
		fixIE6();
	}
}

function fixIE6(){
	$j('#mainContentLeft li').hover (function () {
		$j(this).addClass('hover');
	}, function () {
		$j(this).removeClass('hover');
	});

	setTimeout("$j('#blackWrap').height($j('#whiteWrap').height());",1000);
}

/*sIfr doesnt like being loaded by jQuery in IE so must be loaded on own outside */

var machine = {
	src: 'assets/templates/datasafe_ca/flash/machine.swf'
	,ratios: [8, 1.43, 11, 1.38, 13, 1.33, 17, 1.32, 21, 1.3, 29, 1.29, 30, 1.28, 43, 1.27, 46, 1.26, 47, 1.27, 60, 1.26, 63, 1.25, 64, 1.26, 101, 1.25, 102, 1.24, 105, 1.25, 106, 1.24, 109, 1.25, 110, 1.24, 117, 1.25, 119, 1.24, 120, 1.25, 123, 1.24, 124, 1.25, 1.24]
};

var machineshadow = {
	src: 'assets/templates/datasafe_ca/flash/machineshadow.swf'
	,ratios: [8, 1.43, 11, 1.38, 13, 1.33, 17, 1.32, 21, 1.3, 29, 1.29, 30, 1.28, 43, 1.27, 46, 1.26, 47, 1.27, 60, 1.26, 63, 1.25, 64, 1.26, 101, 1.25, 102, 1.24, 105, 1.25, 106, 1.24, 109, 1.25, 110, 1.24, 117, 1.25, 119, 1.24, 120, 1.25, 123, 1.24, 124, 1.25, 1.24]
};

// sIFR.domains = ['novemberborn.net'] // Don't check for domains in this demo
sIFR.useStyleCheck = true;
sIFR.activate(machine);
sIFR.activate(machineshadow);

sIFR.replace(machineshadow, {
	selector: '#mainContentRightTitleHome h1'
	,css: [
		'.sIFR-root { color: #C09930; font-weight: normal; font-size: 32px; text-transform: none; }'
	]
	,wmode: 'transparent'
});

sIFR.replace(machine, {
	selector: '#mainContentRightTitle h1'
	,css: [
		'.sIFR-root { color: #000000; font-weight: normal; font-size: 22px; text-transform: uppercase; }'
	]
	,fitExactly: 'false'
	,wmode: 'transparent'
});

sIFR.replace(machine, {
	selector: 'h2'
	,css: [
		'.sIFR-root { color: #000000; font-weight: normal; text-transform: none; }'
	]
	,wmode: 'transparent'
});

sIFR.replace(machine, {
	selector: 'h3'
	,css: [
		'.sIFR-root { color: #C09930; font-weight: normal; font-size:18px; text-transform: none; }'
	]
	,wmode: 'transparent'
});