/*
Title:      Main JavaScript	
Author:     Cristian Deschamps, cristian.deschamps@rocler.com

*/

// ------[ IE6 Cache Control (remove flicker on mouseover) ]------------------------------------------------- //	
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

// ------[ Master Onload for all page. ]------------------------------------------------- //	
window.SPA = window.SPA || {};

SPA = {	
	Init : function() {													
		YAHOO.util.Dom.addClass(document.body,'isCSS');
	}
};
YAHOO.util.Event.onDOMReady(SPA.Init, SPA, true);

// ------[ Video ]------------------------------------------------- //
SPA.Video = {
	video : null,

	Init : function() {
		this.video = document.getElementById('video');
				
		YAHOO.util.Event.addListener("video-link-open", "click", this.Open, this, true);	
		YAHOO.util.Event.addListener("video-link-close", "click", this.Close, this, true);	
	},
	
	Open : function(ev) {		
		YAHOO.util.Dom.addClass(this.video, 'open');		
		YAHOO.util.Event.stopEvent(ev);		
		return false;
	},
	
	Close : function(ev) {	
		YAHOO.util.Dom.removeClass(this.video, 'open');
		YAHOO.util.Event.stopEvent(ev);		
		return false;		
	}
}

// ------[ Popup Window ]------------------------------------------------- //
SPA.PopWindow = function(url,w,h,scroll,tools,name,center) {
	var str = "height=" + h + ",innerHeight=" + h;
	str += ",width=" + w + ",innerWidth=" + w;
	if(!center) var center = false;
	if(!scroll) scroll = 0;
	if(!tools) tools = 0;
	if(!name) name = "pop";
	if((window.screen) && (center)) {
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10;
		var xc = (aw - w) / 2;
		var yc = (ah - h) / 2;
		str += ",left=" + xc + ",screenX=" + xc;
		str += ",top=" + yc + ",screenY=" + yc;
		}
	pop = window.open(url,name,'toolbar=' + tools + ',location=0,directories=0,status=0,menubar=0,scrollbars=' + scroll + ',resizable=1,' + str).focus();
};

// ------[ Yahoo Collapse ]------------------------------------------------- //
/*
if(YAHOO && YAHOO.otorg && YAHOO.otorg.DomCollapse){
	YAHOO.otorg.DomCollapse.css = {
		triggerClass:'trigger',
		hideClass:'hide',
		parentClass:'parent',
		openClass:'open'
	}
	YAHOO.util.Event.onDOMReady(YAHOO.otorg.DomCollapse.init);
}
*/