$(document).ready(function() {
	
	//busca home
	if ($("#home").length>0) {
		$("#busca").css("cursor","pointer");
		$("#busca").click(function(){
			if (!$(this).hasClass("open")) {
				$("#busca").animate({width:686,marginLeft:0},1000,function(){
					$(this).addClass("open").css("cursor","default").css("width","auto");
				})
			}
		});
	}
	
	//foto da empresa
	$("a.foto-empresa").lightBox();
	
	
	if ($.browser.msie && ($.browser.version=='8.0' || $.browser.version=='7.0')) {
		var pattern = /url\(|\)|"|'/g;
		var img = $("body").css("background-image");
		$("body").css("background","#FFF");
		img = img.replace(pattern,"");
		$("body").prepend('<div id="iebg" />');
		$("#iebg").append('<img src="'+img+'" style="position:absolute;z-index:1;left:0;top:0;" />');
		$("#mainContent").css("position","absolute").css("z-index","2").css("width","100%").css("left","0");
		ie_resize();
		$(window).resize(function(){
			ie_resize();
		});
	}
	
});

function ie_resize() {
	var w = $(window).width();
	var h = $(window).height();
	$("#iebg").width(w).height(h);
	$("#iebg img").css("min-width",w+"px").css("min-height",h+"px");
	if ($("#home").length>0) {
		var top = h-200;
		$("#home #busca").css("position","fixed").css("top",top+"px");
	}
}
