function trackFromFlash(trackObject) {
	try {
		//console.log([trackObject.category, trackObject.action, trackObject.optionalLabel, trackObject.optionalValue]);
		tracker._trackEvent(trackObject.category, trackObject.action, trackObject.optionalLabel, trackObject.optionalValue);
	} catch(err) {}
}

function globalNavLinkClick(url) {

	var iframe = document.getElementById('iframe_layer');
	var static_header = document.getElementById('static_header');
	var flash = document.getElementById('calico_critters_flash');
	var black_overlay = document.getElementById('black_overlay');
	
	//var obj = getFlashObject();
	//if(obj && typeof(obj.pause) == 'function') obj.pause();	
	if(flash && typeof(flash.pause) == 'function') flash.pause();	
	

	// hide flash
	flash.style.visibility = 'hidden';
	flash.style.height = '0px';
	
	// show fake header
	static_header.style.display = 'block';
	
	// show iframe
	iframe.src = url;
	iframe.style.display = 'block';
	
	// show black_overlay
	black_overlay.style.display = 'block';
}

/*
function getFlashObject(){

	var obj = jQuery('[name=calico_critters_flash]');
	if(!obj || !obj.length) obj = jQuery('#calico_critters_flash');
	return obj[0];
}*/

function closeLayer(){
	var iframe = document.getElementById('iframe_layer');
	var static_header = document.getElementById('static_header');
	var flash = document.getElementById('calico_critters_flash');
	var black_overlay = document.getElementById('black_overlay');

	if(flash && typeof(flash.resume) == 'function') flash.resume();		

	// show flash
	flash.style.visibility = 'visible';
	flash.style.height = '590px';
	
	// hide fake header
	static_header.style.display = 'none';
	
	// hide black_overlay
	black_overlay.style.display = 'none';
	
	// hide iframe
	iframe.style.display = 'none';
	iframe.src = '';
}

//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
