var isW3c = true;
if(typeof(isIE) === 'undefined') var isIE = false;
if(typeof(isIE6) === 'undefined') var isIE6 = false;

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

window.RQOH = window.RQOH || {};
RQOH = {};

// ------[ Flash Header ]------------------------------------------------- //
RQOH.WindowSize = {
	Init : function() {
		width = $(document).width();
						
		if(width > 1180) {
			x = $('#header-bkg').css('left');							
			x = parseInt(x);
			
			width = Math.floor((width-980)/2)-20;
			if(width > 210) width = 210;
	
			x = "-" + width + "px";
			
			$('#header-bkg').css('left', x);										
		} else {
			$('#header-bkg').css('left', '-87');
		}
	}
}

$(document).ready(function() {		
	if(isW3c) {
		RQOH.WindowSize.Init();
		$('select').selectmenu();			
	}
	
	if(isIE) {
		if(!isW3c) {
			DD_roundies.addRule('#header-bkg');	
		}
		
		DD_roundies.addRule('div.bloc', '6px');
		DD_roundies.addRule('a.button', '3px');
		DD_roundies.addRule('button.button', '3px');
		DD_roundies.addRule('p.pages a.selected', '3px');
		DD_roundies.addRule('a.ui-selectmenu', '4px');		
		DD_roundies.addRule('div.row-special', '5px');
		DD_roundies.addRule('#map-browser', '12px');
		DD_roundies.addRule('div.cols-4 div.col', '6px');
		
		
		DD_roundies.addRule('li.nfirst', '4px');											
		DD_roundies.addRule('li.nlast', '4px');	
	
	}
});	

$(window).resize(function() {
  throttle(RQOH.WindowSize.Init, window);
});

function throttle(method, scope) {
	clearTimeout(method._tId);
	method._tId= setTimeout(function(){
		method.call(scope);
	}, 100);
};	

// ------[ Form ]------------------------------------------------- //
RQOH.Navigation = {
	Init : function() {				
		$('#navigation > ul > li').mouseover(function() {								
			$(this).addClass('hover');								
		});		
		$('#navigation > ul > li').mouseout(function() {					
			$(this).removeClass('hover');								
		});	
									
	}	
}
$(document).ready(function() {
	RQOH.Navigation.Init();
});	


// ------[ Form ]------------------------------------------------- //
RQOH.SeachForm = {
	Init : function() {				
		$('input.text').click(function() {					
			if($(this).val() == $(this).attr("label")) 
				$(this).val('');									
		});		
		
		$('input.text').blur(function() { 
			if($(this).val() == '') 
				$(this).val($(this).attr("label"));			
		});					
	}	
}
$(document).ready(function() {
	RQOH.SeachForm.Init();
});	

// ------[ 4 cols layout ]------------------------------------------------- //
RQOH.Cols4 = {
	Init : function() {	
		$('div.cols-4').each(function() {
			var tallest = 0;
			$(this).find('div.col').each(function() {
				h = $(this).height();
				if(h > tallest) 
					tallest = h;
			});
			
			if(isIE6) tallest = tallest+80;
			
			$(this).find('div.col').height(tallest);
					
		});				
	}	
}
$(document).ready(function() {
	RQOH.Cols4.Init();
});	

// ------[ 2 cols layout ]------------------------------------------------- //
RQOH.Cols2 = {
	Init : function() {	
		$('div.cols-2.fixe').each(function() {			
			var tallest = 0;
			$(this).find('div.col div.bloc').each(function() {
				h = $(this).height();
				if(h > tallest) 
					tallest = h;
			});
					
			$(this).find('div.col div.bloc').height(tallest);
					
		});				
	}	
}
$(document).ready(function() {
	RQOH.Cols2.Init();
});	



