/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
		  
var tb_pathToImage = "../images/loadingAnimation.gif";

/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/

//on page load call tb_init
jQuery(document).ready(function(){   
	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;
});

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk){
	jQuery(domChunk).click(function(){
	var t = this.title || this.name || null;
	var a = this.href || this.alt;
	var g = this.rel || false;
	tb_show(t,a,g);
	this.blur();
	return false;
	});
}

function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link

	try {
		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
			jQuery("body","html").css({height: "100%", width: "100%"});
			jQuery("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
				jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay' onclick='tb_remove();'></div><div id='TB_window'></div>");
				jQuery("#TB_overlay").click(tb_remove);
			}
		}else{//all others
			if(document.getElementById("TB_overlay") === null){
				jQuery("body").append("<div id='TB_overlay' onclick='tb_remove();'></div><div id='TB_window'></div>");
				jQuery("#TB_overlay").click(tb_remove);
			}
		}
		
		if(tb_detectMacXFF()){
			jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
		}else{
			jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		}
		
		if(caption===null){caption="";}
		jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
		jQuery('#TB_load').show();//show loader
		
		var baseURL;
	   if(url.indexOf("?")!==-1){ //ff there is a query string involved
			baseURL = url.substr(0, url.indexOf("?"));
	   }else{ 
	   		baseURL = url;
	   }
	   
	   var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
	   var urlType = baseURL.toLowerCase().match(urlString);

		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
				
			TB_PrevCaption = "";
			TB_PrevURL = "";
			TB_PrevHTML = "";
			TB_NextCaption = "";
			TB_NextURL = "";
			TB_NextHTML = "";
			TB_imageCount = "";
			TB_FoundURL = false;
			if(imageGroup){
				TB_TempArray = jQuery("a[@rel="+imageGroup+"]").get();
				for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
					var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
						if (!(TB_TempArray[TB_Counter].href == url)) {						
							if (TB_FoundURL) {
								TB_NextCaption = TB_TempArray[TB_Counter].title;
								TB_NextURL = TB_TempArray[TB_Counter].href;
								TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
							} else {
								TB_PrevCaption = TB_TempArray[TB_Counter].title;
								TB_PrevURL = TB_TempArray[TB_Counter].href;
								TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
							}
						} else {
							TB_FoundURL = true;
							TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);											
						}
				}
			}

			imgPreloader = new Image();
			imgPreloader.onload = function(){		
			imgPreloader.onload = null;
				
			// Resizing large images - orginal by Christian Montoya edited by me.
			var pagesize = tb_getPageSize();
			var x = pagesize[0] - 150;
			var y = pagesize[1] - 150;
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (imageWidth > x) {
				imageHeight = imageHeight * (x / imageWidth); 
				imageWidth = x; 
				if (imageHeight > y) { 
					imageWidth = imageWidth * (y / imageHeight); 
					imageHeight = y; 
				}
			} else if (imageHeight > y) { 
				imageWidth = imageWidth * (y / imageHeight); 
				imageHeight = y; 
				if (imageWidth > x) { 
					imageHeight = imageHeight * (x / imageWidth); 
					imageWidth = x;
				}
			}
			// End Resizing
			
			TB_WIDTH = imageWidth + 30;
			TB_HEIGHT = imageHeight + 60;
			jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div>"); 		
			
			jQuery("#TB_closeWindowButton").click(tb_remove);
			
			if (!(TB_PrevHTML === "")) {
				function goPrev(){
					if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);}
					jQuery("#TB_window").remove();
					jQuery("body").append("<div id='TB_window'></div>");
					tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
					return false;	
				}
				jQuery("#TB_prev").click(goPrev);
			}
			
			if (!(TB_NextHTML === "")) {		
				function goNext(){
					jQuery("#TB_window").remove();
					jQuery("body").append("<div id='TB_window'></div>");
					tb_show(TB_NextCaption, TB_NextURL, imageGroup);				
					return false;	
				}
				jQuery("#TB_next").click(goNext);
				
			}

			document.onkeydown = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				} else if(keycode == 190){ // display previous image
					if(!(TB_NextHTML == "")){
						document.onkeydown = "";
						goNext();
					}
				} else if(keycode == 188){ // display next image
					if(!(TB_PrevHTML == "")){
						document.onkeydown = "";
						goPrev();
					}
				}	
			};
			
			tb_position();
			jQuery("#TB_load").remove();
			jQuery("#TB_ImageOff").click(tb_remove);
			jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show
			};
			
			imgPreloader.src = url;
		}else{//code to show html
			
			var queryString = url.replace(/^[^\?]+\??/,'');
			var params = tb_parseQuery( queryString );

			TB_WIDTH = (params['width']*1) + 30 || 200; //defaults to 200 if no paramaters were added to URL
			TB_HEIGHT = (params['height']*1) + 40 || 130; //defaults to 130 if no paramaters were added to URL
			ajaxContentW = TB_WIDTH - 30;
			ajaxContentH = TB_HEIGHT - 45;
			
			if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window		
					urlNoQuery = url.split('TB_');
					jQuery("#TB_iframeContent").remove();
					if(params['modal'] != "true"){//iframe no modal
						jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
					}else{//iframe modal
					jQuery("#TB_overlay").unbind();
						jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
					}
			}else{// not an iframe, ajax
					if(jQuery("#TB_window").css("display") != "block"){
						if(params['modal'] != "true"){//ajax no modal
						jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a> or Esc Key</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
						}else{//ajax modal
						jQuery("#TB_overlay").unbind();
						jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");	
						}
					}else{//this means the window is already up, we are just loading new content via ajax
						jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
						jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
						jQuery("#TB_ajaxContent")[0].scrollTop = 0;
						jQuery("#TB_ajaxWindowTitle").html(caption);
					}
			}
					
			jQuery("#TB_closeWindowButton").click(tb_remove);
			
				if(url.indexOf('TB_inline') != -1){	
					jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children());
					jQuery("#TB_window").unload(function () {
						jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished
					});
					tb_position();
					jQuery("#TB_load").remove();
					jQuery("#TB_window").css({display:"block"}); 
				}else if(url.indexOf('TB_iframe') != -1){
					tb_position();
					if($.browser.safari){//safari needs help because it will not fire iframe onload
						jQuery("#TB_load").remove();
						jQuery("#TB_window").css({display:"block"});
					}
				}else{
					jQuery("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
						tb_position();
						jQuery("#TB_load").remove();
						tb_init("#TB_ajaxContent a.thickbox");
						jQuery("#TB_window").css({display:"block"});
					});
				}
			
		}

		if(!params['modal']){
			document.onkeyup = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				}	
			};
		}
		
	} catch(e) {
		//nothing here
	}
	
	jQuery("div#TB_overlay").bind("onclick", function() {
		tb_remove();
	});
}

//helper functions below
function tb_showIframe(){
	jQuery("#TB_load").remove();
	jQuery("#TB_window").css({display:"block"});
}

function tb_remove() {
 	jQuery("#TB_imageOff").unbind("click");
	jQuery("#TB_closeWindowButton").unbind("click");
	jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
	jQuery("#TB_load").remove();
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		jQuery("body","html").css({height: "auto", width: "auto"});
		jQuery("html").css("overflow","");
	}
	document.onkeydown = "";
	document.onkeyup = "";
	return false;
}

function tb_position() {
jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE
		jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	}
}

function tb_parseQuery ( query ) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}

function tb_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}

function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}﻿//
nTimeout = null;
QueryString = [];

jQuery.fn.replaceWithClassId = function(replacement) 
{
	return this.each(function(){		
		var element = jQuery(this);
		jQuery(replacement).attr('class', element.attr('class')).attr('id',element.attr('id')).attr('alt',element.attr('alt')).attr('accesskey',element.attr('accesskey')).attr('name',element.attr('name')) ;
		jQuery(this).replaceWith(replacement);
	});

};

jQuery(document).ready(function ()
{
	/* BEGIN: Barras de alerta */

	// Pega dominio aberto no browser.
	var domain_cookie = GetDomainBrowser();

	var uma_barra_estah_aberta = false;

	// Se veio do site EN, exibimos a barra de idiomas.
	if (gup("redirect") == 1){
		jQuery('#barra_alerta_idioma').slideDown();
		uma_barra_estah_aberta = true;
	}

	// Se clicar em 'Continuar no site em portugues' seta um cookie que dura uma sessao de browser, para permitir continuar no site BR sem barra de idiomas.
	jQuery('#abre_site_idioma_portugues').click(function() {
		jQuery('#barra_alerta_idioma').slideUp();
		uma_barra_estah_aberta = false;
		CheckBrowserVersion(uma_barra_estah_aberta);
	});

	CheckBrowserVersion(uma_barra_estah_aberta);

	jQuery('.barra_alerta_conteudo_fechar').click(function(){
		// Fecha a barra.
		var parent_div = jQuery(this).parent().parent();
		jQuery(parent_div).slideUp();
		uma_barra_estah_aberta = false;

		// Trata o fechar barra de idiomas, como 'continuar no site em portugues' durando uma sessao de browser.
		if (parent_div.attr('id') == 'barra_alerta_idioma') {
			// jQuery.cookie("LW_idiom", "pt_BR_this_once", { domain: 'locaweb.com.br', path: '/' });
			CheckBrowserVersion(uma_barra_estah_aberta);
		}
		else if (parent_div.attr('id') == 'barra_alerta_browsers' || parent_div.attr('id') == 'barra_alerta_browsers_expandida') {
			jQuery.cookie("LW_browser", "closed_browser_bar_this_once", { domain: domain_cookie, path: '/' });
		}
	});

	jQuery('#navegar_mesmo_assim').click(function(){
		// Fecha a barra de browsers.
		jQuery('#barra_alerta_browsers_expandida').slideUp();
		jQuery.cookie("LW_browser", "closed_browser_bar_this_once", { domain: domain_cookie, path: '/' });
	});

	jQuery('#barra_alerta_expandir').mouseover(function(){
		jQuery(this).parent().parent().slideUp();
		jQuery('#barra_alerta_browsers_expandida').slideDown();
	});
	jQuery('#barra_alerta_expandir').click(function(){
		jQuery(this).parent().parent().slideUp();
		jQuery('#barra_alerta_browsers_expandida').slideDown();
	});

	/* END: Barras de alerta */

	/* BEGIN Barra de Feedback */
	jQuery("#feedback_site_tab_close")
		.mouseover(function () {
			jQuery(this).addClass("hover");
		})
		.mouseout(function () {
			jQuery(this).removeClass("hover");
		})
		.click(function ()
		{
			jQuery.cookie("LW_feedback", "closed_feedback_bar", { domain: domain_cookie, path: '/' });
			jQuery("#feedback_site_tab").fadeOut("slow");
		});
	/* END Barra de Feedback */
	
	//Criando QueryString
	jQuery.each(window.location.search.replace(/(.)*\?/gi,"").split("&"), function (i, el)
	{
		var arrQS = el.split("=");
		QueryString[unescape(arrQS[0])] = unescape(arrQS[1]);
	});

	//Links Painel e Webmail
	jQuery(".links_wrapper a.links").click(function ()
	{
		ToogleLogin(this);
		return false;
	});
	
	////Menu Topo
//	ResetMenu();
//	jQuery("#menu > li").mouseover(function ()
//	{
//		if(nTimeout)
//		{
//			clearTimeout(nTimeout);
//			ResetMenu();
//		}
//		ShowMenu(this);
//	}).mouseout(function ()
//	{
//		nTimeout = setTimeout('ResetMenu()', 400);
//	})
//	.find("a").focus(function ()
//	{
//		jQuery(this).parents("li.menu_raiz").mouseover();
//	}).blur(function ()
//	{
//		jQuery(this).parents("li.menu_raiz").mouseout();
//	})
//	.filter(".menu_item")
//	.click(function (e)
//	{
//		e.preventDefault();
//	});
	
	//Busca
	jQuery("strong.seta a").toggle(function (e)
	{
		jQuery(this).addClass("active").parent().parent().find("ul").fadeIn()
		.click(function (e)
		{
			e.stopPropagation();
		});
		jQuery("body").bind("click.HideBuscaDetalhada", HideBuscaDetalhada);
		e.preventDefault(); 
	}, function (e)
	{
		jQuery(this).removeClass("active").parent().parent().find("ul").hide();
		jQuery("body").unbind("click.HideBuscaDetalhada");
		e.preventDefault();
	});
	jQuery(".busca_outros a").click(function (e)
	{
		BuscaDetalhada(jQuery(this).attr("id"));
		e.preventDefault();
	});
	BuscaDetalhada();
	jQuery("#frm_busca").submit(ValidaBusca);
	
	//Resize
	//jQuery(window).resize(ChangeResolution); 
	//ChangeResolution();
	
	//Tira o valor do input e deixa vazio
	jQuery(".input_vazio").bind("focus", function ()
	{
		if(jQuery(this).hasClass("input_vazio"))
		{
			jQuery(this)
			.removeClass("input_vazio")
			.val("");
		}
	}).keypress(function ()
	{
		jQuery(this).focus();
	});
	
	//Transformar input text para password
	jQuery(".input_password").bind("focus", function ()
	{
		if(jQuery(this).hasClass("input_password"))
		{
			var obj = jQuery('<input type="password"  onblur="VerificaTextoInput(\'senha\', this);" onfocus="SomeTextoInput(\'senha\', this);"/>');
			jQuery(this)
			.removeClass("input_password")
			.replaceWithClassId(obj);
			obj.focus();
		}
	}).keypress(function ()
	{
		$(this).focus();
	});
	
	//Tooltip
	jQuery("a.tooltip")
	.mouseover(function ()
	{
		//var id = jQuery(this).attr("href").replace(/^\#/gi, "");
		var id = jQuery(this).attr("id").replace(/^\#/gi, "");
		TagToTip(id, WIDTH, 400);
	});
	
	//Hover das tabelas comparativas
	OnLoadCaracteristicas(".comparativo_2 tbody tr");	
	
	//Adiciona a validação no submit do webmail
	jQuery("#frm_webmail").submit(AbreWebmail);
	jQuery("#frm_webmail2").submit(AbreWebmail2);
	jQuery("#frm_webmail2").bind('keydown',function(e){
        if (e && e.keyCode==13) {
            e.preventDefault();
            jQuery("#frm_webmail2").submit();
        }
    });
	jQuery("#frm_webmail").bind('keydown',function(e){
        if (e && e.keyCode==13) {
            e.preventDefault();
            jQuery("#frm_webmail").submit();
        }
    });

	//tabs login
    jQuery(".links_login").click(function(){
		jQuery(".links_login").removeClass("active");						 
		jQuery(".box_form_estrutura").hide();
		jQuery("#"+this.id).addClass("active").parent().parent().find(".box_form_estrutura").show();;
	});

	// Formulario de Feedback.
	scripts_feedback ();
});

function checkFeedbackBar()
{
	if (jQuery.cookie("LW_feedback") != 'closed_feedback_bar') {

		// Se não for browser de celular/movel, exibimos a barra de browsers.
		if (!IsItMobile()) {
			jQuery('#feedback_site_tab').show();
		}
	}
}

function scripts_feedback ()
{
	checkFeedbackBar();
	
	jQuery("#feedback_site_tab").click(function() {
		jQuery("#feedback_site").show();
		jQuery("#feedback_site_thanks").hide();
	});
	jQuery("#feedback_outro textarea").focus(function() {
		if (jQuery(this).val() == 'Deixe aqui seu comentário') {
			jQuery(this).val("");
		}
	});
	jQuery("#feedback_outro textarea").blur(function() {
		if (jQuery(this).val() == '') {
			jQuery(this).val("Deixe aqui seu comentário");
		}
	});
	jQuery(".smileys").click(function(e) {
		jQuery("ul.smileys > li").removeClass("selected");
		jQuery(e.target).addClass("selected");

		var v = "";
		switch(e.target.id) {
			case 'smiley_1': v = "Muito Feliz"; break;
			case 'smiley_2': v = "Feliz"; break;
			case 'smiley_3': v = "Normal"; break;
			case 'smiley_4': v = "Triste"; break;
			case 'smiley_5': v = "Raiva"; break;
		}
		jQuery("#impressao").val(v);
	});
	jQuery(".feedback_cancelar").click(function() {
		tb_remove();
		return false;
	});
	jQuery("#feedback_site_submit").click(function() {

		// Validação.
		jQuery("#feedback_site_error_messages").html("").hide();
		if (jQuery("#feedback_site :checked").length == 0) {
			jQuery("#feedback_site_error_messages").html("Selecione uma opção abaixo.").show();
			return false;
		}
		else if (jQuery("#feedback_site #entry_2").val() == '' || jQuery("#feedback_site #entry_2").val() == 'Deixe aqui seu comentário') {
			jQuery("#feedback_site_error_messages").html("Deixe seu comentário.").show();
			return false;
		}

		// Envia form.
		dados  = "entry.0.group=" + jQuery("#feedback_site #impressao").val();
		dados += "&entry.1.group="+jQuery("#feedback_site :checked").val();
		dados += "&entry.2.single=" + jQuery("#feedback_site #entry_2").val();
		dados += "&resolution=" + screen.width + "x" + screen.height;
		dados += "&pageNumber=0";
		dados += "&backupCache=";
		xhr = jQuery.post("/feedback.php?form=feedback_site", dados, function(){}, "html");

		jQuery("#feedback_site").hide();
		jQuery("#feedback_site_thanks").show();
		jQuery("#TB_ajaxContent").css("height", "142px");

		// Reseta o form, e desliga o modal.
		clear_form (jQuery("#feedback_site_form_id"));
		jQuery("#feedback_site #impressao").val("");
		jQuery("#feedback_site #feedback_outro textarea").val("Deixe aqui seu comentário");
		jQuery("#feedback_site ul.smileys > li").removeClass("selected");
	});
	jQuery(".feedback_close").click(function() {
	// Desliga o modal.
		tb_remove();
		setTimeout("jQuery('#feedback_site').show()",500);
		setTimeout("jQuery('#feedback_site_thanks').hide()", 500);
	});
	jQuery(".feedback_finalizar").click(function() {
		// Desliga o modal.
		tb_remove();
		setTimeout("jQuery('#feedback_site').show()",500);
		setTimeout("jQuery('#feedback_site_thanks').hide()", 500);
	});
	
	posiciona_aba_feedback ();
	jQuery(window).resize(function() {
		posiciona_aba_feedback ();
	});
	
}

function characters_counter (where_to_show, limit)
{
	txt = jQuery("#entry_2")[0].value;
	count = txt.length;
	if (count > limit) {
		jQuery("#entry_2").val( txt.substring(0, limit) );
	}
	else if (count == 0) {
		jQuery("#"+where_to_show).html("0");
	}
	else {
		jQuery("#"+where_to_show).html(count);
	}
}

function clear_form (form)
{
	jQuery(':input', form).each(function() {
		var type = this.type;
		var tag = this.tagName.toLowerCase();
		if (type == 'text' || type == 'password' || tag == 'textarea') this.value = "";
		else if (type == 'checkbox' || type == 'radio') this.checked = false;
		else if (tag == 'select') this.selectedIndex = -1;
	});
}

function posiciona_aba_feedback ()
{
	var w_height = jQuery(window).height();
	
	if (w_height <= 521 || w_height >= 1200) {
		altura = Math.ceil((jQuery(window).height()/2) - (jQuery('#feedback_site_tab').height() / 2));
		if (altura < 0) { altura = 0; }
	}
	else {
		altura = 370;
	}
	//alert(altura +"\n altura: "+ w_height);
	jQuery("#feedback_site_tab").animate({
		top: altura+"px"
	});
}

function GetDomainBrowser()
{
	var domain_cookie = window.top.location.href;
	domain_cookie = domain_cookie.replace( /https?:\/\//, "" );
	if (domain_cookie.indexOf("/") < 0) { domain_cookie = domain_cookie+"/"; }
	var items = domain_cookie.split('/');
	if (items.length>0){
		domain_cookie = items[0];
	}
	return domain_cookie;
}

function CheckBrowserVersion(uma_barra_estah_aberta)
{
	// Se tem IE6/etc, exibimos a barra de recomendacao de browsers.
	if (jQuery.cookie("LW_browser") != 'closed_browser_bar_this_once' && uma_barra_estah_aberta == false) {

		// Se for browser antigo, e nao for browser de celular/movel, exibimos a barra de browsers.
		if (IsOldBrowser() && !IsItMobile()) {
			jQuery('#barra_alerta_browsers').slideDown();
		}
	}
}

function IsOldBrowser()
{
	// Obs.: <= Firefox 2.0, Safari < 3.
	if (
		(jQuery.browser.mozilla && jQuery.browser.version.substr(0,5) <= 1.8) ||
		(jQuery.browser.msie && jQuery.browser.version.substr(0,3) < 7.0) ||
		(jQuery.browser.safari && jQuery.browser.version.substr(0,5) < 419.3) ||
		(jQuery.browser.opera && jQuery.browser.version.substr(0,3) < 8.0)
		){
		return true;
	}
	else {
		return false;
	}
}

function IsItMobile()
{
	var browser = navigator.userAgent;
	var os = navigator.appVersion;
	var mobile_browsers = /android|black|HTC|iphone|ipod|lg|nokia|palm|samsung|sony|symbian|vodafone|treo|xda|netfront/i;

	if (browser.match(mobile_browsers) || os.match(mobile_browsers)) { return true; }
	else { return false; }
}

function HideBuscaDetalhada()
{
	jQuery("strong.seta a").click();
}

function ValidaBusca()
{
	var obj = jQuery("#zoom_query");
	
	if(jQuery.trim(obj.val()) == "")
	{
		alert("Digite o que deseja encontrar");
		obj.focus();
		return false;
	}
	return true;
}

function BuscaDetalhada(sBuscaId)
{
	var sMsg = "Geral";
	var nTamanho = "";
	
	sBuscaId = sBuscaId || "";
	
	switch(sBuscaId.replace(/^busca_/gi, "").toLowerCase())
	{
		case 'todos':
			jQuery("#busca_tipo").val("todos");
			nTamanho = "70px";
			sMsg = " Geral";
			break;
		case 'site':
			jQuery("#busca_tipo").val("site");
			sMsg = " no Site";
			nTamanho = "90px";
			break;
		case 'wiki':
			jQuery("#busca_tipo").val("wiki");
			nTamanho = "90px";
			sMsg = " no Wiki";
			break;
		case 'forum':
			jQuery("#busca_tipo").val("forum");
			nTamanho = "90px";
			sMsg = " no Fórum";
			break;
		case 'blogs':
			jQuery("#busca_tipo").val("blog");
			nTamanho = "90px";
			sMsg = " nos Blogs";
			break;
		default:
			jQuery("#busca_tipo").val("");
			break;
	}
	
	//jQuery("#frm_busca input[name='enviar']").val(sMsg).width(nTamanho);
	jQuery("#lb_busca").html(sMsg);
	
	if(sBuscaId)
	{		
		var obj = jQuery("#zoom_query");
		obj.focus();		
		jQuery("strong.seta a").click();	
		return false;
	}
}

function ChangeResolution()
{
	var obj  = jQuery("#geral");
	var objW = obj.width();
	var winW = jQuery(window).width();
	obj.width("100%");
	jQuery("#subheader_wrapper").css("width", "");
	if(winW < 999)
	{
		obj.width("999px");
		jQuery("#subheader_wrapper").css("width", "551px");
	}
}

function ToogleLogin(obj)
{
	//HideAllLogin();
	var obj = jQuery(obj);
	if(!obj.hasClass("active"))
	{
		ShowLogin(obj.attr("id"));
	}
	if(obj.attr("id") == "link_painel")
	{
		HideOverlay("link_webmail");
		HideOverlay("link_idioma");
	}
	else if(obj.attr("id") == "link_webmail")
	{
		HideOverlay("link_painel");
		HideOverlay("link_idioma");
	}
	else
	{
		HideOverlay("link_painel");
		HideOverlay("link_webmail");
	}
}

function HideAllLogin()
{
	jQuery(".links.active").removeClass("active").parent().parent().find(".link_estrutura").hide();
	jQuery("body").unbind("click.HideAllLogin");
}

function HideOverlay(objId)
{
	jQuery("#"+objId).removeClass("active").parent().parent().find(".link_estrutura").hide();
}
function ShowLogin(objId)
{
	jQuery("#"+objId).addClass("active").parent().parent().find(".link_estrutura").fadeIn();	
	jQuery("body").bind("click.HideAllLogin", HideAllLogin);
	jQuery("#"+objId).parent().parent().find(".link_estrutura").click(function(event)
	{
    	event.stopPropagation();
	});
}

function ResetMenu()
{
	jQuery("#iframe_div_ie6").remove();
	jQuery("#menu > li > a").removeClass("active_menu").parent().find(".submenu").css("left", "-9999em").show();
}

function ShowMenu(obj)
{
	
//	var obj = jQuery(obj);

//	obj.find("> a").addClass("active_menu");
//	
//	objSubMenu = obj.find(".submenu");
//	
//	objSubMenu.css("left", "");

	var obj = jQuery("#"+obj);
	
	obj.find("> a").addClass("active_menu");
	obj.find(".submenu").css("left","");
	
	objSubMenu = obj.find(".submenu");
	
	//Verifica se é IE 6 ou inferior e cria um iframe atras do menu para ficar em cima dos combos
	if(jQuery.browser.version <= 6 && jQuery.browser.msie)
	{
		var objIframe = jQuery("<iframe id=\"iframe_div_ie6\" src=\"\" scrolling=\"no\" frameborder=\"0\" style=\"position:absolute;border:none;display:block;\"></iframe>");

		var objPosition = objSubMenu.position();
		
		objIframe
		.width(objSubMenu.outerWidth(true))
		.height(objSubMenu.outerHeight(true))
		.css("top", objPosition.top + "px")
		.css("left", objPosition.left + "px")
		.css("z-index", objSubMenu.css("z-index"));
		
		objSubMenu.before(objIframe);
	}
}
function OnLoadCaracteristicas(element)
{
	jQuery(document).ready(function ()
	{
		jQuery(element)
		.mouseover(function ()
		{
			jQuery(this)
			.addClass("hover");
		})
		.mouseout(function ()
		{
			jQuery(this)
			.removeClass("hover");
		})
		.filter(":nth-child(even)")
		.addClass("zebrado");
	});
}

function AlertModal(sTextoTitulo, sTextoConteudo, callback)
{
	jQuery("#modal_alert .title_modal h3").html(sTextoTitulo);
	jQuery("#modal_alert .conteudo_modal p").html(sTextoConteudo);
	jQuery("#openModal_alert").click();
	jQuery(".modal_ok.alert").focus();
	
	if(callback)
	{
		jQuery(".modal_ok.alert").one("click", callback);
	}
}

function ErroModal(sTextoTitulo, sTextoConteudo)
{
	jQuery("#modal_error .title_modal h3").text(sTextoTitulo);
	jQuery("#modal_error .conteudo_modal p").text(sTextoConteudo);
	jQuery(".modal_ok.error").click();
	jQuery(".modal_content .buttons button.button_modal").focus();
}

//**************************************************************************************
blnJaBuscou = false; 

function popup(vURL,w,h,scroll)
{
	window.open(vURL,"","toolbar=no,location=no,status=no,menubar=no,width="+ w +",height="+ h +",top=80,left=180,resizable=no,scrollbars="+ scroll +"");
}

function abre_sugestoes()
{
	window.open("http://sugestao.locaweb.com.br/sugestao/", "sugestoes", "width=363,height=424,top=30,left=30,resizable=yes,toolbar=0,location=0,directories=0,status=no,menubar=0");
}

function pop_faq(url) 
{
    var nHeight = window.screen.availHeight;
    var nWidth = window.screen.availWidth;
    var janela = window.open(url, "faq", "width=" + nWidth + ",height=" + nHeight + ",top=0,left=0,scrollbars=no, status=yes,resizable=yes");
    janela.focus();
}

//**************************************************************************************
//Funções para os form de Painel de Webmail
function limpaEmail()
{
	jQuery("#input_userid").val();
	jQuery("#input_webmail_senha").val();
}

function AbreWebmail()
{
	var form = document.getElementById('frm_webmail');	
	
	if (form.input_mail_user.value=='')
	{
		alert('Por favor, informe o E-mail !'); 
		form.user.focus();
		return false;
	}
	if (form.input_mail_user.value.indexOf('@', 0) == -1 || form.input_mail_user.value.indexOf('.', 0) == -1) 
	{
    	alert('Por favor, informe o e-mail completo (email@domínio.com.br).'); 
		form.user.focus();
		return false;
	}
	if (form.input_mail_pwd.value=="" || form.input_mail_pwd.value=="senha")
	{
		alert("Por favor, informe a Senha.");
		form.input_mail_pwd.focus();
		return false;
	}

	//var senha = escape(form.input_mail_pwd.value);
	var senha = form.input_mail_pwd.value;
	var dominio, usuario;
	var user = form.input_mail_user.value;
	var ch = user.indexOf('@');
	
	var usuario = user.substr(0,ch);
	var dominio = user.substr(ch+1,user.length-ch);
	
//	alert (usuario);
//	return false;
	
	form.input_mail_user.value ='';
	form.input_mail_pwd.value ='';

	jQuery("#input_dominio").remove();
	jQuery("#input_hidden_webmail_acao").remove();
	jQuery("#input_webmail_senha").remove(); 
	jQuery("#input_userid").remove(); 
	
	jQuery('<input type="hidden" value="login" id="input_hidden_webmail_acao" name="acao" />').appendTo('#frm_webmail');
	
	jQuery("<input id='input_dominio' type='hidden' name='domain'>").val(escape(dominio)).appendTo('#frm_webmail');
	
	jQuery("<input id='input_webmail_senha' type='hidden' name='password'>").val(senha).appendTo('#frm_webmail');

	jQuery("<input id='input_userid' type='hidden' name='userid'>").val(escape(usuario)).appendTo('#frm_webmail');
		
	form.setAttribute('action','http://app-lw.locaweb.com.br/webmail_acesso.asp');
	form.setAttribute('target', '_blank');
	
	HideAllLogin();
	return true;
}
function AbreWebmail2()
{
	var form = document.getElementById('frm_webmail2');	
	if (form.input_user2.value==''){
		alert('Por favor, informe o E-mail !'); 
		form.user.focus();
		return false;
	}
	if (form.input_user2.value.indexOf('@', 0) == -1 || form.input_user2.value.indexOf('.', 0) == -1){
    	alert('Por favor, informe o e-mail completo (email@domínio.com.br).'); 
		form.user.focus();
		return false;
	}
	if (form.input_mail_pwd2.value=="" || form.input_mail_pwd2.value=="senha"){
		alert("Por favor, informe a Senha.");
		form.input_mail_pwd2.focus();
		return false;
	}

//	var senha = escape(form.input_mail_pwd2.value);
	var senha = form.input_mail_pwd2.value;
	var dominio, usuario;
	var user = form.input_user2.value;
	var ch = user.indexOf('@');
	var usuario = user.substr(0,ch);
	var dominio = user.substr(ch+1,user.length-ch);

	form.input_user2.value ='';
	form.input_mail_pwd2.value ='';
	jQuery("#input_dominio2").remove();
	jQuery("#input_hidden_webmail_acao2").remove();
	jQuery("#input_webmail_senha2").remove(); 
	jQuery("#input_userid2").remove(); 
	jQuery('<input type="hidden" value="login" id="input_hidden_webmail_acao2" name="acao" />').appendTo('#frm_webmail2');
	jQuery("<input id='input_dominio2' type='hidden' name='domain'>").val(escape(dominio)).appendTo('#frm_webmail2');
	jQuery("<input id='input_webmail_senha2' type='hidden' name='password'>").val(senha).appendTo('#frm_webmail2');
	jQuery("<input id='input_userid2' type='hidden' name='userid'>").val(escape(usuario)).appendTo('#frm_webmail2');
	form.setAttribute('action','http://app-lw.locaweb.com.br/webmail_acesso.asp');
	form.setAttribute('target', '_blank');
	//HideAllLogin();
	return true;
	//form.submit();
}

function abre_painel()
{	
	var form = document.getElementById('frm_painel');
	var objInputUsuario = document.getElementById('input_hidden_painel_usuario');
	var objInputSenha = document.getElementById('input_hidden_painel_senha');
	
	if(!objInputUsuario)
	{
		objInputUsuario = document.createElement('input');
		objInputUsuario.setAttribute('id', 'input_hidden_painel_usuario');
		objInputUsuario.setAttribute('name', 'usu_1_01_20_Usuario');
		objInputUsuario.setAttribute('type', 'hidden');
		form.appendChild(objInputUsuario);
	}
		
	if(!objInputSenha)
	{
		objInputSenha = document.createElement('input');
		objInputSenha.setAttribute('id', 'input_hidden_painel_senha');
		objInputSenha.setAttribute('name', 'sen_1_06_14_Senha');
		objInputSenha.setAttribute('type', 'hidden');
		form.appendChild(objInputSenha);
	}
	
	objInputUsuario.setAttribute('value', form.input_usuario.value);
	objInputSenha.setAttribute('value', form.input_painel_senha.value);
	
	if (form.input_hidden_painel_usuario.value=='')
	{
		alert ("Por favor, informe o usuário.");
		jQuery("#input_usuario").focus();
		return false;
	}
	
	if (form.input_hidden_painel_senha.value==''){
		alert ("Por favor, informe a senha.");
		jQuery("#input_painel_senha").focus();
		return false;
	}	
	jQuery("#input_usuario").val('');
	jQuery("#input_painel_senha").val('');
	
	HideAllLogin();
	return true;
}

function abre_painel2()
{	
	var form = document.getElementById('frm_painel2');
	var objInputUsuario = document.getElementById('input_hidden_painel_usuario2');
	var objInputSenha = document.getElementById('input_hidden_painel_senha2');
	
	if(!objInputUsuario)
	{
		objInputUsuario = document.createElement('input');
		objInputUsuario.setAttribute('id', 'input_hidden_painel_usuario2');
		objInputUsuario.setAttribute('name', 'usu_1_01_20_Usuario');
		objInputUsuario.setAttribute('type', 'hidden');
		form.appendChild(objInputUsuario);
	}
		
	if(!objInputSenha)
	{
		objInputSenha = document.createElement('input');
		objInputSenha.setAttribute('id', 'input_hidden_painel_senha2');
		objInputSenha.setAttribute('name', 'sen_1_06_14_Senha');
		objInputSenha.setAttribute('type', 'hidden');
		form.appendChild(objInputSenha);
	}
	
	if ( (form.input_usuario2.value=='')||(form.input_usuario2.value=='login de usuário') )
	{
		alert ("Por favor, informe o usuário.");
		form.input_usuario2.focus();
		return false;
	}
	
	if ( (form.input_painel_senha2.value=='')||(form.input_painel_senha2.value=='senha') ){
		alert ("Por favor, informe a senha.");
		form.input_painel_senha2.focus();
		return false;
	}	
	objInputUsuario.setAttribute('value', form.input_usuario2.value);
	objInputSenha.setAttribute('value', form.input_painel_senha2.value);
	
	form.input_usuario2.value="";
	form.input_painel_senha2.value=""
	//form.submit();
	return true;
}
function abre_painel_mail(){
	if ( (document.painel_webmail.form2_login.value=='') || (document.painel_webmail.form2_login.value=="login de usuário")){
		alert ("Por favor, informe o usuário.");
		document.painel_webmail.form2_login.focus();
		return false;
	}
	if ( (document.painel_webmail.form2_passwd.value=='') || (document.painel_webmail.form2_passwd.value=="senha")){
		alert ("Por favor, informe a senha.");
		document.painel_webmail.form2_passwd.focus();
		return false;
	}
	document.painel_webmail.action = 'https://locamail.locaweb.com.br/locamail/'; 
	var objInputUsuario = document.painel_webmail.form_login;
	var objInputSenha = document.painel_webmail.form_passwd;
	
	if(!objInputUsuario)
	{
		objInputUsuario = document.createElement('input');
		objInputUsuario.setAttribute('id', 'form_login');
		objInputUsuario.setAttribute('name', 'form_login');
		objInputUsuario.setAttribute('type', 'hidden');
		document.painel_webmail.appendChild(objInputUsuario);
	}
		
	if(!objInputSenha)
	{
		objInputSenha = document.createElement('input');
		objInputSenha.setAttribute('id', 'form_passwd');
		objInputSenha.setAttribute('name', 'form_passwd');
		objInputSenha.setAttribute('type', 'hidden');
		document.painel_webmail.appendChild(objInputSenha);
	}
	
	objInputUsuario.setAttribute('value', document.painel_webmail.form2_login.value);
	objInputSenha.setAttribute('value', document.painel_webmail.form2_passwd.value);
	document.painel_webmail.form2_login.value="";
	document.painel_webmail.form2_passwd.value="";
	return true;
}

function SomeTextoInput(sTexto, objInput)
{
	//if(!blnJaBuscou)
	//{
		if (objInput.value.toLowerCase()==sTexto.toLowerCase())
		{
			objInput.value = '';
		}
	//}
}
function alterna_email(objInput){
	if(objInput.value.indexOf('@') > -1){
		jQuery("#links_login_webmail").click();
		jQuery("#input_user2").focus();
		jQuery("#input_user2").val(objInput.value);
		jQuery("#input_usuario2").val("");
	}
}
function VerificaTextoInput(sTexto, objInput){
	if (objInput.value==''||objInput.value.toLowerCase()==sTexto.toLowerCase()){
			objInput.value = sTexto;
			jQuery("#"+objInput.id).addClass("input_vazio");
	}	
}
//function MostraTextoInput(sTexto, objInput)
//{
//	if (objInput.value == '')
//	{
//		objInput.value = sTexto;
//	}
//}

function chat_popup(url){
    popupWin = window.open(url, 'remote',"width=432,height=460,top=0,resizable=no,scrollbars=no");
}

//Retorna valor ao campo apenas se digitou um número
function validaNumeros(e)
{
	reDigitos = /^[\d]/; //Expressão regular para aceitar apenas números
	var code;
	if (!e) var e = window.event;
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;

	var digito;
    digito = String.fromCharCode(code);
	digito = digito.toLowerCase();
	
    if(navigator.userAgent.indexOf("Firefox")!=-1)
    {
    	if(e.keyCode == 13 || e.keyCode == 46 || e.keyCode == 8 || e.keyCode == 37 || e.keyCode == 39 || e.keyCode == 9) return digito;
    }
    else
    {
        if(e.keyCode == 13 || e.keyCode == 0 || e.keyCode == 8 || e.keyCode == 37 || e.keyCode == 39 || e.keyCode == 9) return digito;
    }
	return reDigitos.test(digito);
}

 function validaCPF() 
 {
	 cpf = document.form_principal.cpf.value;
	 erro = new String;
	 
	 if (cpf.length < 11) 
	 {
	 	erro += "Sao necessarios 11 digitos para verificacao do CPF! \n\n";
		alert(erro);
		return false;
	 }
		
		if (cpf == "00000000000" || cpf == "11111111111" || cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" || cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" || cpf == "88888888888" || cpf == "99999999999")
		{
			erro += "Numero de CPF invalido!";
			alert(erro);
			return false;
		}

	   var a = [];
	   var b = new Number;
	   var c = 11;
	   for (i=0; i<11; i++)
	   {
		   a[i] = cpf.charAt(i);
		   if (i < 9) b += (a[i] * --c);
	   }
	   
	   if ((x = b % 11) < 2) 
	   		{ a[9] = 0 } 
	   else
	   		{ a[9] = 11-x }
	   
	   b = 0;
	   c = 11;
	   for (y=0; y<10; y++) 
	   		b += (a[y] * c--);
			
	   if ((x = b % 11) < 2) 
	   		{ a[10] = 0; } 
		else { a[10] = 11-x; }
		
	   if ((cpf.charAt(9) != a[9]) || (cpf.charAt(10) != a[10]))
	   {
	   		erro +="Digito verificador com problema!";
		   	alert(erro);
			return false;
	   }
	   
	   return true;
}


function MudaCampo(f){
	if(f.value.length==f.maxLength){
  	for(var i=0;i<f.form.length;i++){
    	if(f.form[i]==f){f.form[i+1].focus();break}
		}
	}
}

function BarraCaracteres(numbers,letters,others,e){
	if(window.event)key=window.event.keyCode
	else if(e)key=e.which
	else return true
	S=(others)?others:''
	if(numbers)S+='0123456789'
	if(letters)S+='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
	if(key==null||key==0||key==8||key==9||key==13||key==27)return true
	else if(S.indexOf(String.fromCharCode(key))!=-1)return true
	else return false
}

function verificarDados() 
{
	lRet = false;
	
	if(document.form_principal.cpf.value == "")
	{
		alert("Por favor digite o número do seu CPF!")
		return false;
	}
	else
	{
		lRet = validaCPF();
	}
	
	return lRet;
}
function trataBusca(){
	stringBusca = escape(jQuery("#zoom_query").val());
	//stringBusca = jQuery("#zoom_query").val();
	location.href='http://www.locaweb.com.br/busca-site.html?q='+stringBusca+'&tipo='+jQuery("#frm_busca_select").val();
	return false;
}
// Pega o valor do parametro 'name' da URL
function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function showFAQ(id) {
	if (!jQuery("#"+id).hasClass("aberta")) {
		jQuery("#"+id).addClass("aberta");
		jQuery("#"+id+"_resp").slideDown();
	}
	else {
		jQuery(id).removeClass("aberta");
		jQuery("#"+id+"_resp").slideUp();
		jQuery("#"+id).removeClass("aberta");
	}
	
}

﻿function OnLoadHospedagemHome()
{
	jQuery(document).ready(function ()
	{
		jQuery(".div_preco")
		.mouseover(function ()
		{
			 selectRow(this.id);
		})
		.mouseout(function ()
		{
			unselect(this.id);
		})
		.click(function ()
		{
			showhidePlano(this.id)
		});
		
		//Adiciona o efeito de zebra na tabela.
		jQuery('table.comparativo_3 tbody tr:odd').addClass('zebrado');		
		//jQuery('table.comparativo_3 tbody tr:even').addClass('n-zebrado');		
		//
		mostrarPlano('mensal');
		
		//carousel
		jQuery("a.anterior").addClass("disabled");
		//jQuery("a.proximo").addClass("disabled");
		
		jQuery(".jCarouselLite").jCarouselLite({
			btnNext: "a.proximo",
			btnPrev: "a.anterior",
			visible: 3,
			circular:false,
			speed: 500
		});
	});
}

function selectRow(id){
	jQuery('#'+id).addClass("div_preco_hover");
}

function unselect(id){
	jQuery('#'+id).removeClass("div_preco_hover");
}

function showhidePlano(id){ 
	jQuery('.div_preco').removeClass("div_preco_select"); 
	jQuery('#'+id).addClass("div_preco_select"); 
	jQuery('div.precos').hide(); 
	jQuery('div.precos.'+id).show();
}

function mostrarPlano(id){

	jQuery('#periodo_'+id).attr('checked',true);
	
	jQuery('div.radio_abas').addClass("aba_normal");
	
	if(id=='anual'){
		jQuery('div.radio_mensal').removeClass("aba_normal");
	}
	if(id=='semestral'){
		jQuery('div.radio_abas').removeClass("aba_normal");
	}
	if(id=='mensal'){
		jQuery('div.radio_semestral').removeClass("aba_normal");
	}
	
	jQuery('div.div_planos').hide(); 
	jQuery('div.div_planos').hide(); 
	jQuery('div.planos_hosp_'+id).show();
	
	jQuery('div.radio_abas').removeClass("aba_selecionada");
	jQuery('div.radio_'+id).addClass("aba_selecionada");
}
﻿jQuery(document).ready(function(){

	jQuery("#tipo_chat_suporte").click(function(){
		updateOptionChat(this.id);
	});
	jQuery("#tipo_chat_cobranca").click(function(){
		updateOptionChat(this.id);
	});	
	jQuery('#ifr_manut').attr('src','check-popup.asp');	
	
});

function submitBusca(){
	var tipo=0;
	var str=document.getElementById("zoom_query_atd").value;
	str=str.replace(/\'/g,'+');
	str=str.replace(/\´/g,' ');
	str=str.replace(/\`/g,' ');
	str=str.replace(/ /g,'+');
	str=str.replace(/\?/g,'+');
	str=str.replace(/\!/g,'+');
	str=str.replace(/\,/g,'+');
	str=str.replace(/\./g,'+');
	str=str.replace(/\</g,'+');
	str=str.replace(/\>/g,'+');
	str=str.replace(/\:/g,'+');
	str=str.replace(/\;/g,'+');
	str=str.replace(/\~/g,'+');
	str=str.replace(/\n/g,'+');
	str=str.replace(/\t/g,'+');
	
	//str=escape(str.toLowerCase());
	str2=str.replace(/\+/g,'');	
	str2=str2.replace(/\ /g,'');
	
	if (str2 ==''){
		jQuery("#openModal_erro_busca").click();
		document.getElementById("zoom_query_atd").value=""; 
		document.getElementById("zoom_query_atd").focus();
	}else{
		document.getElementById("zoom_query_atd").value=str;
		document.getElementById("frm_busca_atd").submit();
	}
}

function resetChat() {
	jQuery("#cliente").show();
	jQuery("#chat_form").hide();
	jQuery("#resetChat").hide();
	jQuery("#tipo_chat_suporte").attr("checked", false);
	jQuery("#tipo_chat_cobranca").attr("checked", false);
	jQuery("#chat_servico").val("");
	jQuery("#chat_servico").attr("disabled", "disabled");
	jQuery("#btn_chat").attr("disabled", "disabled");
	jQuery("#chat_servico > #hospedagem").remove();
	jQuery("#chat_servico > #hospedagem_linux").remove();
	jQuery("#chat_servico > #hospedagem_windows").remove();
	jQuery("#chat_servico > #windows_streaming").remove();
}
function chatCliente(flagCliente) {
	jQuery("#cliente").hide();
	jQuery("#chat_form").show();
	jQuery("#resetChat").show();
	
	if (flagCliente == "btn_jasoucliente") {
		jQuery("#chat_form > #tipo").show();
		jQuery("#chat_form > #servico-cliente > label").html("Selecione um serviço:");
		//jQuery("#serv_outros").text("Outros Serviços");
		jQuery("#serv_outros").remove();
		
	}
	else {
		jQuery("#chat_form > #tipo").hide();
		jQuery("#chat_form > #servico-naocliente > label").html("Selecione um assunto:");
		jQuery("#chat_servico").attr("disabled",false);
		//jQuery("#serv_outros").text("Outros Assuntos");
		jQuery("#serv_outros").remove();
		updateOptionChat("tipo_chat_cobranca");
	}
}
function updateOptionChat(elem) {
	if (elem == "tipo_chat_cobranca") {
		jQuery("#chat_servico > #hospedagem").remove();
		jQuery("#chat_servico > #hospedagem_linux").remove();
		jQuery("#chat_servico > #hospedagem_windows").remove();
		jQuery("#chat_servico > #windows_streaming").remove();
		jQuery("#chat_servico > #servicos_email").before("<option id='hospedagem' value='hospedagem'>Hospedagem Profissional</option>");
	}
	else if (elem == "tipo_chat_suporte") {
		jQuery("#chat_servico > #hospedagem_linux").remove();
		jQuery("#chat_servico > #hospedagem_windows").remove();
		jQuery("#chat_servico > #windows_streaming").remove();
			
		//
		jQuery("#chat_servico > #servicos_email").before("<option id='hospedagem_linux' value='hospedagem_linux'>Hospedagem Linux</option>");
		jQuery("#chat_servico > #servicos_email").before("<option id='hospedagem_windows' value='hospedagem_windows'>Hospedagem Windows</option>");
		jQuery("#chat_servico > #serv_outros").before("<option id='windows_streaming' value='windows_streaming'>Windows Streaming Media</option>");
		jQuery("#chat_servico > #hospedagem").remove();
	}
	jQuery("#btn_chat").attr("disabled",false);
}

function fnc_chat_w(idd,cliente){
	nomeClienteChat=jQuery('#nome').val();	
	loginClienteChat=jQuery('#loginHidden').val();
	emailClienteChat=jQuery('#email').val();
	idCategoria = idd;
	
	if(cliente==1){
		loginemailClienteChat = loginClienteChat;
	}else{
		loginemailClienteChat = emailClienteChat;
	}
	window.open('http://dt.locaweb.com.br/chat/?idd='+idCategoria+'&nome_usuario='+nomeClienteChat+'&login_email='+loginemailClienteChat+'','chat','width=300, height=400');
}
function chatOpen(s){
	//TIPO DE CHAT
	var tipo_chat_suporte = jQuery("#tipo_chat_suporte").attr("checked");
	var tipo_chat_cobranca = jQuery("#tipo_chat_cobranca").attr("checked");
	
	jQuery("#chat_msg_hospedagem_expressa").hide();
	jQuery("#chat_msg_servicos_gratuitos").hide();
	
	//var cliente = jQuery("#tipo").css("display") == "none" ? '0' : '1';
	var cliente = jQuery("input:radio[name=chk_cliente]:checked").val() == "cliente" ? '1' : '0';
	
	
	//COMERCIO ELETRONICO
	if (s == "comercio_eletronico") {
		if (tipo_chat_suporte == true || cliente=='0'){
			fnc_chat_w('006A00003C583000179B',''+cliente+'');
		}
		if (tipo_chat_cobranca == true){
			fnc_chat_w('D66F000034D30000156D',''+cliente+'');
		}
	}
	//CLOUD COMPUTING
	if (s == "cloud_computing"){
		if (cliente=='1') {
			if (tipo_chat_suporte == true){
				fnc_chat_w('8AEE0000302BC0000441',''+cliente+'');
			}
			if (tipo_chat_cobranca == true){
				fnc_chat_w('6D35000037DE00001350',''+cliente+'');
			}
		}
		else {
			fnc_chat_w('0BE000003959200027F6',''+cliente+'');
		}
	}
	//EMAIL MKT
	if (s == "email_mkt"){
		if (cliente=='1') {		
			if (tipo_chat_suporte == true){
				fnc_chat_w('BCCC000034D680002117',''+cliente+'');
			}
			if (tipo_chat_cobranca == true){
				fnc_chat_w('D66F000034D30000156D',''+cliente+'');
			}
		}
		else {
			fnc_chat_w('BCCC000034D680002117',''+cliente+'');
		}
	}
	//HOSPEDAGEM LINUX	
	if (s == "hospedagem_linux"){
		if (cliente=='1') {
			if (tipo_chat_suporte == true && cliente=='1'){
				fnc_chat_w('53F700003C9A00002980',''+cliente+'');
			}
		}else{
			fnc_chat_w('53F700003C9A00002980',''+cliente+'');
		}
	}
	//HOSPEDAGEM WINDOWS
	if (s == "hospedagem_windows"){
		if (cliente=='1') {		
			if (tipo_chat_suporte == true && cliente=='1'){
				fnc_chat_w('1EB20000308490002868',''+cliente+'');
			}
		}else{
			fnc_chat_w('1EB20000308490002868',''+cliente+'');
		}			
	}
	//HOSPEDAGEM e HOSPEDAGEM OUTROS ASSUNTOS
	if (s == "hospedagem"){
		if (cliente=='1') {
			if (tipo_chat_cobranca == true){
				fnc_chat_w('D66F000034D30000156D',''+cliente+'');
			}
		}
		else {
			fnc_chat_w('3815000036C240002073',''+cliente+'');
		}
	}
	//MOBIMAIL / LOCAMAIL
	if (s == "servicos_email"){
		if (cliente=='1') {
			if (tipo_chat_suporte == true){
				fnc_chat_w('92F900003475F0000511',''+cliente+'');
			}
			if (tipo_chat_cobranca == true){
				fnc_chat_w('D66F000034D30000156D',''+cliente+'');
			}
		}
		else {
			fnc_chat_w('92F900003475F0000511',''+cliente+'');
		}
	}
	//PABX VIRTUAL
	if (s == "pabx_virtual"){
		if (tipo_chat_suporte == true || cliente=='0'){
			fnc_chat_w('949D00003231C000128B',''+cliente+'');
		}
		if (tipo_chat_cobranca == true){
			fnc_chat_w('014A00003DBF5000180D',''+cliente+'');
		}
	}
	//PORTAL DE VOZ
	if (s == "portal_voz"){
		if (tipo_chat_suporte == true || cliente=='0'){
			fnc_chat_w('949D00003231C000128B',''+cliente+'');
		}
		if (tipo_chat_cobranca == true){
			fnc_chat_w('014A00003DBF5000180D',''+cliente+'');
		}		
	}
	//REGISTRO DE DOMÍNIO
	if (s == "registro_dominio"){
		if (cliente=='1') {
			if (tipo_chat_suporte == true){
				fnc_chat_w('A2F100003E0E000009EE',''+cliente+'');
			}
			if (tipo_chat_cobranca == true){
				fnc_chat_w('B35100003D1DB00014DB',''+cliente+'');
			}
		}
		else {
			fnc_chat_w('A2F100003E0E000009EE',''+cliente+'');
		}
	}
	//REVENDA
	if (s == "revenda"){
		if (tipo_chat_suporte == true || cliente=='0'){
			fnc_chat_w('B5E800003009F000106F',''+cliente+'');
		}
		if (tipo_chat_cobranca == true){
			fnc_chat_w('D66F000034D30000156D',''+cliente+'');
		}
	}
	//SERVICOS DEDICADOS
	if (s == "servicos_dedicados"){
		if (cliente=='1') {
			if (tipo_chat_suporte == true){
				fnc_chat_w('8AEE0000302BC0000441',''+cliente+'');
			}
			if (tipo_chat_cobranca == true){
				fnc_chat_w('6D35000037DE00001350',''+cliente+'');
			}
		}
		else {
			fnc_chat_w('0BE000003959200027F6',''+cliente+'');
		}
	}
	//WINDOWS STREAMING MEDIA
	if (s == "windows_streaming"){
		if (cliente=='1') {
			if (tipo_chat_suporte == true){
				fnc_chat_w('1EB20000308490002868',''+cliente+'');
			}
		}
	}
	//OUTROS SERVICOS
	if (s == "outros_servicos"){
		if (cliente=='1') {
			if (tipo_chat_suporte == true){
				fnc_chat_w('5078000039DFD0000375',''+cliente+'');
			}
			if (tipo_chat_cobranca == true){
				fnc_chat_w('D66F000034D30000156D',''+cliente+''); 
			}
		}
		else {
			fnc_chat_w('1EB20000308490002868',''+cliente+'');
		}
	}
}

function messageAlert(element,msg){
	var divElement = jQuery(element +'_alert');
	if (msg!=""){
		divElement.addClass('messageAlert').html(msg);
		jQuery(element).addClass('inputAlert').parent().prev().children().addClass('labelAlert');
		jQuery(element).focus();
		jQuery(element).keypress(function(){
			messageAlert(element,"");
		});
	}else{
		divElement.removeClass('messageAlert').html('');
		jQuery(element).removeClass('inputAlert').parent().prev().children().removeClass('labelAlert');
	}
}

function showEmailForm() {
	clearFormFields();
	jQuery(".campo").attr("disabled", "disabled");
	jQuery('#openModal').click();
	
	//Seta o topo como fixo
	//var nTop = parseInt(jQuery('#TB_window').css('margin-top').replace(/-|px/gi,'')) + 15;
	//jQuery('#TB_window').css({top: nTop + 'px'});
	//jQuery('#TB_window').css({height: + '100px'});
}
function selecionaEmail(assunto, assunto2_off){
	jQuery('#mensagemDataCenter').hide();
	
	//Pega o texto do Item selecionado no Combo com o value igual ao assunto
	assunto2 = jQuery("#email_assunto option[value='"+assunto+"'] ").text()

	if (assunto == "info_data_center"){
		jQuery('#mensagemDataCenter').show();
		jQuery('#frm_email_assunto').val(assunto2);
	}
	if (assunto == "info_comercial"){
		jQuery('#frm_email_assunto').val(assunto2);
	}
	if (assunto == "duvidas_gerais"){
		jQuery('#frm_email_assunto').val(assunto2);
	}
	if (assunto != ""){
		jQuery(".campo").removeAttr("disabled");
	}
}

function clearFormFields(){
	jQuery('#mensagemDataCenter').hide();
	jQuery(".labelAlert").each(function(){jQuery(this).removeClass("labelAlert");});
	jQuery(".inputAlert").each(function(){jQuery(this).removeClass("inputAlert");});
	jQuery(".messageAlert").each(function(){jQuery(this).removeClass("messageAlert");jQuery(this).html("");});
	jQuery("#formEmail .input_formulario").each(function(){jQuery(this).val("");});
	jQuery("#formEmail .campo").each(function(){jQuery(this).attr("disabled", "disabled");});
}
function validaFormEmail(){
	var msg = 'Este campo é obrigatório.';
	if (jQuery('#email_assunto').val() == ""){
			messageAlert('#email_assunto',msg);
			return false;
		}
	if (jQuery('#mensagemDataCenter').css('display') != "none"){
		if (jQuery('#frm_nome_empresa').val() == ""){
			messageAlert('#frm_nome_empresa',msg);
			return false;
		}
	}
	if (jQuery('#frm_nome_contato').val() == ""){
		messageAlert('#frm_nome_contato',msg);
		return false;
	}
	var email = jQuery('#frm_email').val();
	if (email == ""){
		messageAlert('#frm_email',msg);
		return false;
	}
	if (email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1){
		messageAlert('#frm_email','Digite um e-mail válido!');
		return false;
	}
	if (jQuery('#frm_telefone').val() == ""){
		messageAlert('#frm_telefone',msg);
		return false;
	}
	if (jQuery('#frm_messagem').val() == ""){
		messageAlert('#frm_messagem',msg);
		return false;
	}
	
	jQuery('#frm_messagem').val(jQuery('#frm_messagem').val().replace(/['´`¨"]+/g, ""));
	document.getElementById("formEmail").submit();
}

function clearFormLogin() {
	if  (jQuery("#frm_login").val() =="" || jQuery("#frm_senha").val() =="") {
		jQuery("#openModal_erro").click();
		return false;
	}
	else {
		jQuery("#login_hd").submit();
		jQuery("#frm_login").val("");
		jQuery("#frm_senha").val("");
	}
}

function envia() {
	window.open('https://helpdesk.locaweb.com.br/envia_senha.asp?login='+document.login_hd.usu_1_01_20_Usuario.value,'esqueceu','width=400,height=230,top=0,left=0,scrollbars=no');
}

function abre_sugestoes()
{
	window.open("http://sugestao.locaweb.com.br/sugestao/index2.asp?origem=","sugestoes","width=363,height=424,top=30,left=30,resizable=yes,toolbar=0,location=0,directories=0,status=no,menubar=0");
}
function OpenModalMsgEmail(cod) {
	if(cod=='1'){
		jQuery("#openModal_msg_email").click();	
	}else{
		jQuery("#openModal_msg_email_erro").click();	
	}
}
function AbreFone() {
	jQuery("#pabx_fone").html("0800 726 7780");
	jQuery("#pabx_fone").removeClass();
	jQuery("#pabx_fone").addClass("disclaimer_off");
}
function MostraGeioIpFone (telefone, s_linkfones) {
	jQuery("#tel_numero").html(telefone);
	jQuery("#tel_cidade").html(s_linkfones);
	jQuery("#tel_cidade").attr("title", s_linkfones);
	jQuery("#telefone_cidade").val('');
}/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
		  
var tb_pathToImage = "../images/loadingAnimation.gif";

/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/

//on page load call tb_init
jQuery(document).ready(function(){   
	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;
});

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk){
	jQuery(domChunk).click(function(){
	var t = this.title || this.name || null;
	var a = this.href || this.alt;
	var g = this.rel || false;
	tb_show(t,a,g);
	this.blur();
	return false;
	});
}

function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link

	try {
		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
			jQuery("body","html").css({height: "100%", width: "100%"});
			jQuery("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
				jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay' onclick='tb_remove();'></div><div id='TB_window'></div>");
				jQuery("#TB_overlay").click(tb_remove);
			}
		}else{//all others
			if(document.getElementById("TB_overlay") === null){
				jQuery("body").append("<div id='TB_overlay' onclick='tb_remove();'></div><div id='TB_window'></div>");
				jQuery("#TB_overlay").click(tb_remove);
			}
		}
		
		if(tb_detectMacXFF()){
			jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
		}else{
			jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		}
		
		if(caption===null){caption="";}
		jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
		jQuery('#TB_load').show();//show loader
		
		var baseURL;
	   if(url.indexOf("?")!==-1){ //ff there is a query string involved
			baseURL = url.substr(0, url.indexOf("?"));
	   }else{ 
	   		baseURL = url;
	   }
	   
	   var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
	   var urlType = baseURL.toLowerCase().match(urlString);

		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
				
			TB_PrevCaption = "";
			TB_PrevURL = "";
			TB_PrevHTML = "";
			TB_NextCaption = "";
			TB_NextURL = "";
			TB_NextHTML = "";
			TB_imageCount = "";
			TB_FoundURL = false;
			if(imageGroup){
				TB_TempArray = jQuery("a[@rel="+imageGroup+"]").get();
				for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
					var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
						if (!(TB_TempArray[TB_Counter].href == url)) {						
							if (TB_FoundURL) {
								TB_NextCaption = TB_TempArray[TB_Counter].title;
								TB_NextURL = TB_TempArray[TB_Counter].href;
								TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
							} else {
								TB_PrevCaption = TB_TempArray[TB_Counter].title;
								TB_PrevURL = TB_TempArray[TB_Counter].href;
								TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
							}
						} else {
							TB_FoundURL = true;
							TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);											
						}
				}
			}

			imgPreloader = new Image();
			imgPreloader.onload = function(){		
			imgPreloader.onload = null;
				
			// Resizing large images - orginal by Christian Montoya edited by me.
			var pagesize = tb_getPageSize();
			var x = pagesize[0] - 150;
			var y = pagesize[1] - 150;
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (imageWidth > x) {
				imageHeight = imageHeight * (x / imageWidth); 
				imageWidth = x; 
				if (imageHeight > y) { 
					imageWidth = imageWidth * (y / imageHeight); 
					imageHeight = y; 
				}
			} else if (imageHeight > y) { 
				imageWidth = imageWidth * (y / imageHeight); 
				imageHeight = y; 
				if (imageWidth > x) { 
					imageHeight = imageHeight * (x / imageWidth); 
					imageWidth = x;
				}
			}
			// End Resizing
			
			TB_WIDTH = imageWidth + 30;
			TB_HEIGHT = imageHeight + 60;
			jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div>"); 		
			
			jQuery("#TB_closeWindowButton").click(tb_remove);
			
			if (!(TB_PrevHTML === "")) {
				function goPrev(){
					if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);}
					jQuery("#TB_window").remove();
					jQuery("body").append("<div id='TB_window'></div>");
					tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
					return false;	
				}
				jQuery("#TB_prev").click(goPrev);
			}
			
			if (!(TB_NextHTML === "")) {		
				function goNext(){
					jQuery("#TB_window").remove();
					jQuery("body").append("<div id='TB_window'></div>");
					tb_show(TB_NextCaption, TB_NextURL, imageGroup);				
					return false;	
				}
				jQuery("#TB_next").click(goNext);
				
			}

			document.onkeydown = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				} else if(keycode == 190){ // display previous image
					if(!(TB_NextHTML == "")){
						document.onkeydown = "";
						goNext();
					}
				} else if(keycode == 188){ // display next image
					if(!(TB_PrevHTML == "")){
						document.onkeydown = "";
						goPrev();
					}
				}	
			};
			
			tb_position();
			jQuery("#TB_load").remove();
			jQuery("#TB_ImageOff").click(tb_remove);
			jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show
			};
			
			imgPreloader.src = url;
		}else{//code to show html
			
			var queryString = url.replace(/^[^\?]+\??/,'');
			var params = tb_parseQuery( queryString );

			TB_WIDTH = (params['width']*1) + 30 || 200; //defaults to 200 if no paramaters were added to URL
			TB_HEIGHT = (params['height']*1) + 40 || 130; //defaults to 130 if no paramaters were added to URL
			ajaxContentW = TB_WIDTH - 30;
			ajaxContentH = TB_HEIGHT - 45;
			
			if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window		
					urlNoQuery = url.split('TB_');
					jQuery("#TB_iframeContent").remove();
					if(params['modal'] != "true"){//iframe no modal
						jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
					}else{//iframe modal
					jQuery("#TB_overlay").unbind();
						jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
					}
			}else{// not an iframe, ajax
					if(jQuery("#TB_window").css("display") != "block"){
						if(params['modal'] != "true"){//ajax no modal
						jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a> or Esc Key</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
						}else{//ajax modal
						jQuery("#TB_overlay").unbind();
						jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");	
						}
					}else{//this means the window is already up, we are just loading new content via ajax
						jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
						jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
						jQuery("#TB_ajaxContent")[0].scrollTop = 0;
						jQuery("#TB_ajaxWindowTitle").html(caption);
					}
			}
					
			jQuery("#TB_closeWindowButton").click(tb_remove);
			
				if(url.indexOf('TB_inline') != -1){	
					jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children());
					jQuery("#TB_window").unload(function () {
						jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished
					});
					tb_position();
					jQuery("#TB_load").remove();
					jQuery("#TB_window").css({display:"block"}); 
				}else if(url.indexOf('TB_iframe') != -1){
					tb_position();
					if($.browser.safari){//safari needs help because it will not fire iframe onload
						jQuery("#TB_load").remove();
						jQuery("#TB_window").css({display:"block"});
					}
				}else{
					jQuery("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
						tb_position();
						jQuery("#TB_load").remove();
						tb_init("#TB_ajaxContent a.thickbox");
						jQuery("#TB_window").css({display:"block"});
					});
				}
			
		}

		if(!params['modal']){
			document.onkeyup = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				}	
			};
		}
		
	} catch(e) {
		//nothing here
	}
	
	jQuery("div#TB_overlay").bind("onclick", function() {
		tb_remove();
	});
}

//helper functions below
function tb_showIframe(){
	jQuery("#TB_load").remove();
	jQuery("#TB_window").css({display:"block"});
}

function tb_remove() {
 	jQuery("#TB_imageOff").unbind("click");
	jQuery("#TB_closeWindowButton").unbind("click");
	jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
	jQuery("#TB_load").remove();
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		jQuery("body","html").css({height: "auto", width: "auto"});
		jQuery("html").css("overflow","");
	}
	document.onkeydown = "";
	document.onkeyup = "";
	return false;
}

function tb_position() {
jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE
		jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	}
}

function tb_parseQuery ( query ) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}

function tb_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}

function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}/**
 * --------------------------------------------------------------------
 * jQuery-Plugin "pngFix"
 * Version: 1.2, 09.03.2009
 * by Andreas Eberhard, andreas.eberhard@gmail.com
 *                      http://jquery.andreaseberhard.de/
 *
 * Copyright (c) 2007 Andreas Eberhard
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * Changelog:
 *    09.03.2009 Version 1.2
 *    - Update for jQuery 1.3.x, removed @ from selectors
 *    11.09.2007 Version 1.1
 *    - removed noConflict
 *    - added png-support for input type=image
 *    - 01.08.2007 CSS background-image support extension added by Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com
 *    31.05.2007 initial Version 1.0
 * --------------------------------------------------------------------
 * @example $(function(){$(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready
 *
 * jQuery(function(){jQuery(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready when using noConflict
 *
 * @example $(function(){$('div.examples').pngFix();});
 * @desc Fixes all PNG's within div with class examples
 *
 * @example $(function(){$('div.examples').pngFix( { blankgif:'ext.gif' } );});
 * @desc Fixes all PNG's within div with class examples, provides blank gif for input with png
 * --------------------------------------------------------------------
 */

(function($) {

jQuery.fn.pngFix = function(settings) {

	// Settings
	settings = jQuery.extend({
		blankgif: 'blank.gif'
	}, settings);

	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (jQuery.browser.msie && (ie55 || ie6)) {

		//fix images with png-source
		jQuery(this).find("img[src$=.png]").each(function() {

			jQuery(this).attr('width',jQuery(this).width());
			jQuery(this).attr('height',jQuery(this).height());

			var prevStyle = '';
			var strNewHTML = '';
			var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : '';
			var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : '';
			var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : '';
			var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : '';
			var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : '';
			var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : '';
			if (this.style.border) {
				prevStyle += 'border:'+this.style.border+';';
				this.style.border = '';
			}
			if (this.style.padding) {
				prevStyle += 'padding:'+this.style.padding+';';
				this.style.padding = '';
			}
			if (this.style.margin) {
				prevStyle += 'margin:'+this.style.margin+';';
				this.style.margin = '';
			}
			var imgStyle = (this.style.cssText);

			strNewHTML += '<span '+imgId+imgClass+imgTitle+imgAlt;
			strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;
			strNewHTML += 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;';
			strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + jQuery(this).attr('src') + '\', sizingMethod=\'scale\');';
			strNewHTML += imgStyle+'"></span>';
			if (prevStyle != ''){
				strNewHTML = '<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;'+'">' + strNewHTML + '</span>';
			}

			jQuery(this).hide();
			jQuery(this).after(strNewHTML);

		});

		// fix css background pngs
		jQuery(this).find("*").each(function(){
			var bgIMG = jQuery(this).css('background-image');
			if(bgIMG.indexOf(".png")!=-1){
				var iebg = bgIMG.split('url("')[1].split('")')[0];
				jQuery(this).css('background-image', 'none');
				jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
			}
		});
		
		//fix input with png-source
		jQuery(this).find("input[src$=.png]").each(function() {
			var bgIMG = jQuery(this).attr('src');
			jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');';
   		jQuery(this).attr('src', settings.blankgif)
		});
	
	}
	
	return jQuery;

};

})(jQuery);
/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};/**
 * SWFObject v1.4.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){if(!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){_16.push(key+"="+_18[key]);}
return _16;},getSWFHTML:function(){var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";
}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();return true;
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}
catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return _23;};
deconcept.PlayerVersion=function(_27){
this.major=_27[0]!=null?parseInt(_27[0]):0;
this.minor=_27[1]!=null?parseInt(_27[1]):0;
this.rev=_27[2]!=null?parseInt(_27[2]):0;
};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){
return false;
}return true;};
deconcept.util={getRequestParameter:function(_29){
var q=document.location.search||document.location.hash;
if(q){var _2b=q.substring(1).split("&");
for(var i=0;i<_2b.length;i++){
if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
return "";}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){if(window.opera||!document.all){return;}
var _2d=document.getElementsByTagName("OBJECT");
for(var i=0;i<_2d.length;i++){_2d[i].style.display="none";for(var x in _2d[i]){
if(typeof _2d[i][x]=="function"){_2d[i][x]=function(){};}}}};
deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};
__flash_savedUnloadHandler=function(){};
if(typeof window.onunload=="function"){
var _30=window.onunload;
window.onunload=function(){
deconcept.SWFObjectUtil.cleanupSWFs();_30();};
}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}};
if(typeof window.onbeforeunload=="function"){
var oldBeforeUnload=window.onbeforeunload;
window.onbeforeunload=function(){
deconcept.SWFObjectUtil.prepUnload();
oldBeforeUnload();};
}else{window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload;}
if(Array.prototype.push==null){
Array.prototype.push=function(_31){
this[this.length]=_31;
return this.length;};}
var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject;
var SWFObject=deconcept.SWFObject;
//-- Urchin Tracking Module 6.1 (UTM 6.1) $Revision: 1.24 $
//-- Copyright 2004 Urchin Software Corporation, All Rights Reserved.

//-- Urchin On Demand Settings ONLY
var _uacct="";			// set up the Urchin Account
var _userv=0;			// service mode (0=local,1=remote,2=both)

//-- UTM User Settings
var _ufsc=1;			// set client info flag (1=on|0=off)
var _udn="auto";		// (auto|none|domain) set the domain name for cookies
var _uhash="on";		// (on|off) unique domain hash for cookies
var _utimeout="1800";   	// set the inactive session timeout in seconds
var _ugifpath="/__utm.gif";	// set the web path to the __utm.gif file
var _utsp="|";			// transaction field separator
var _uflash=1;			// set flash version detect option (1=on|0=off)
var _utitle=1;			// set the document title detect option (1=on|0=off)

//-- UTM Campaign Tracking Settings
var _uctm=1;			// set campaign tracking module (1=on|0=off)
var _ucto="15768000";		// set timeout in seconds (6 month default)
var _uccn="utm_campaign";	// name
var _ucmd="utm_medium";		// medium (cpc|cpm|link|email|organic)
var _ucsr="utm_source";		// source
var _uctr="utm_term";		// term/keyword
var _ucct="utm_content";	// content
var _ucid="utm_id";		// id number
var _ucno="utm_nooverride";	// don't override

//-- Auto/Organic Sources and Keywords
var _uOsr=new Array();
var _uOkw=new Array();
_uOsr[0]="google";	_uOkw[0]="q";
_uOsr[1]="yahoo";	_uOkw[1]="p";
_uOsr[2]="msn";		_uOkw[2]="q";
_uOsr[3]="aol";		_uOkw[3]="query";
_uOsr[4]="lycos";	_uOkw[4]="query";
_uOsr[5]="ask";		_uOkw[5]="q";
_uOsr[6]="altavista";	_uOkw[6]="q";
_uOsr[7]="search";	_uOkw[7]="q";
_uOsr[8]="netscape";	_uOkw[8]="query";
_uOsr[9]="earthlink";	_uOkw[9]="q";
_uOsr[10]="cnn";	_uOkw[10]="query";
_uOsr[11]="looksmart";	_uOkw[11]="key";
_uOsr[12]="about";	_uOkw[12]="terms";
_uOsr[13]="excite";	_uOkw[13]="qkw";
_uOsr[14]="mamma";	_uOkw[14]="query";
_uOsr[15]="alltheweb";	_uOkw[15]="q";
_uOsr[16]="gigablast";	_uOkw[16]="q";
_uOsr[17]="voila";	_uOkw[17]="kw";
_uOsr[18]="virgilio";	_uOkw[18]="qs";
_uOsr[19]="teoma";	_uOkw[19]="q";

//-- Auto/Organic Keywords to Ignore
var _uOno=new Array();
//_uOno[0]="urchin";
//_uOno[1]="urchin.com";
//_uOno[2]="www.urchin.com";

//-- Referral domains to Ignore
var _uRno=new Array();
//_uRno[0]=".urchin.com";

//-- **** Don't modify below this point ***
var _uff,_udh,_udt,_udo="",_uu,_ufns=0,_uns=0,_ur="-",_ufno=0,_ust=0,_ujv="-",_ubd=document,_udl=_ubd.location,_uwv="6.1";
var _ugifpath2="http://service.urchin.com/__utm.gif";
if (_udl.protocol=="https:") _ugifpath2="https://service.urchin.com/__utm.gif";
function urchinTracker(page) {
 if (_udl.protocol=="file:") return;
 if (_uff && (!page || page=="")) return;
 var a,b,c,v,x="",s="",f=0;
 var nx=" expires=Sun, 18 Jan 2038 00:00:00 GMT;";
 var dc=_ubd.cookie;
 _udh=_uDomain();
 _uu=Math.round(Math.random()*2147483647);
 _udt=new Date();
 _ust=Math.round(_udt.getTime()/1000);
 a=dc.indexOf("__utma="+_udh);
 b=dc.indexOf("__utmb="+_udh);
 c=dc.indexOf("__utmc="+_udh);
 if (_udn && _udn!="") { _udo=" domain="+_udn+";"; }
 if (_utimeout && _utimeout!="") {
  x=new Date(_udt.getTime()+(_utimeout*1000));
  x=" expires="+x.toGMTString()+";";
 }
 s=_udl.search;
 if(s && s!="" && s.indexOf("__utma=")>=0) {
  a=_uGC(s,"__utma=","&");
  b=_uGC(s,"__utmb=","&");
  c=_uGC(s,"__utmc=","&");
  if (a!="-" && b!="-" && c!="-") f=1;
  else if(a!="-") f=2;
 }
 if(f==1) {
  _ubd.cookie="__utma="+a+"; path=/;"+nx;
  _ubd.cookie="__utmb="+b+"; path=/;"+x;
  _ubd.cookie="__utmc="+c+"; path=/;";
 } else if (f==2) {
  a=_uFixA(s,"&",_ust);
  _ubd.cookie="__utma="+a+"; path=/;"+nx;
  _ubd.cookie="__utmb="+_udh+"; path=/;"+x;
  _ubd.cookie="__utmc="+_udh+"; path=/;";
  _ufns=1;
 } else if (a>=0 && b>=0 && c>=0) {
  _ubd.cookie="__utmb="+_udh+"; path=/;"+x+_udo;
 } else {
  if (a>=0) a=_uFixA(_ubd.cookie,";",_ust);
  else a=_udh+"."+_uu+"."+_ust+"."+_ust+"."+_ust+".1";
  _ubd.cookie="__utma="+a+"; path=/;"+nx+_udo;
  _ubd.cookie="__utmb="+_udh+"; path=/;"+x+_udo;
  _ubd.cookie="__utmc="+_udh+"; path=/;"+_udo;
  _ufns=1;
 }
 if (s && s!="" && s.indexOf("__utmv=")>=0) {
  if ((v=_uGC(s,"__utmv=","&"))!="-") {
   _ubd.cookie="__utmv="+unescape(v)+"; path=/;"+nx+_udo;
  }
 }
 _uInfo(page);
 _ufns=0;
 _ufno=0;
 _uff=1;
}
urchinTracker();
function _uInfo(page) {
 var p,s="",pg=_udl.pathname+_udl.search;
 if (page && page!="") pg=escape(page);
 _ur=_ubd.referrer;
 if (!_ur || _ur=="") { _ur="-"; }
 else {
  p=_ur.indexOf(_ubd.domain);
  if ((p>=0) && (p<=8)) { _ur="0"; }
  if (_ur.indexOf("[")==0 && _ur.lastIndexOf("]")==(_ur.length-1)) { _ur="-"; }
 }
 s+="&utmn="+_uu;
 if (_ufsc) s+=_uBInfo(page);
 if (_uctm && (!page || page=="")) s+=_uCInfo();
 if (_utitle && _ubd.title && _ubd.title!="") s+="&utmdt="+escape(_ubd.title);
 if (_udl.hostname && _udl.hostname!="") s+="&utmhn="+escape(_udl.hostname);
 if (!page || page=="") s+="&utmr="+_ur;
 s+="&utmp="+pg;
 if (_userv==0 || _userv==2) {
  var i=new Image(1,1);
  i.src=_ugifpath+"?"+"utmwv="+_uwv+s;
  i.onload=function() {_uVoid();}
 }
 if (_userv==1 || _userv==2) {
  var i2=new Image(1,1);
  i2.src=_ugifpath2+"?"+"utmwv="+_uwv+s+"&utmac="+_uacct+"&utmcc="+_uGCS();
  i2.onload=function() { _uVoid(); }
 }
 return;
}
function _uVoid() { return; }
function _uCInfo() {
 if (!_ucto || _ucto=="") { _ucto="15768000"; }
 var c="",t="-",t2="-",o=0,cs=0,cn=0;i=0;
 var s=_udl.search;
 var z=_uGC(s,"__utmz=","&");
 var x=new Date(_udt.getTime()+(_ucto*1000));
 var dc=_ubd.cookie;
 x=" expires="+x.toGMTString()+";";
 if (z!="-") { _ubd.cookie="__utmz="+unescape(z)+"; path=/;"+x+_udo; return ""; }
 z=dc.indexOf("__utmz="+_udh);
 if (z>-1) { z=_uGC(dc,"__utmz="+_udh,";"); }
 else { z="-"; }
 t=_uGC(s,_ucid+"=","&");
 t2=_uGC(s,_ucsr+"=","&");
 if ((t!="-" && t!="") || (t2!="-" && t2!="")) {
  if (t!="-" && t!="") { c+="utmcid="+_uEC(t); if (t2!="-" && t2!="") c+="|utmcsr="+_uEC(t2);
  } else { if (t2!="-" && t2!="") c+="utmcsr="+_uEC(t2); }
  t=_uGC(s,_uccn+"=","&");
  if (t!="-" && t!="") c+="|utmccn="+_uEC(t);
  else c+="|utmccn=(not+set)";
  t=_uGC(s,_ucmd+"=","&");
  if (t!="-" && t!="") c+="|utmcmd="+_uEC(t);
  else  c+="|utmcmd=(not+set)";
  t=_uGC(s,_uctr+"=","&");
  if (t!="-" && t!="") c+="|utmctr="+_uEC(t);
  else { t=_uOrg(1); if (t!="-" && t!="") c+="|utmctr="+_uEC(t); }
  t=_uGC(s,_ucct+"=","&");
  if (t!="-" && t!="") c+="|utmcct="+_uEC(t);
  t=_uGC(s,_ucno+"=","&");
  if (t=="1") o=1;
  if (z!="-" && o==1) return "";
 }
 if (c=="-" || c=="") { c=_uOrg(); if (z!="-" && _ufno==1)  return ""; }
 if (c=="-" || c=="") { if (_ufns==1)  c=_uRef(); if (z!="-" && _ufno==1)  return ""; }
 if (c=="-" || c=="") {
  if (z=="-" && _ufns==1) { c="utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)"; }
  if (c=="-" || c=="") return "";
 }
 if (z!="-") {
  i=z.indexOf(".");
  if (i>-1) i=z.indexOf(".",i+1);
  if (i>-1) i=z.indexOf(".",i+1);
  if (i>-1) i=z.indexOf(".",i+1);
  t=z.substring(i+1,z.length);
  if (t.toLowerCase()==c.toLowerCase()) cs=1;
  t=z.substring(0,i);
  if ((i=t.lastIndexOf(".")) > -1) {
   t=t.substring(i+1,t.length);
   cn=(t*1);
  }
 }
 if (cs==0 || _ufns==1) {
  t=_uGC(dc,"__utma="+_udh,";");
  if ((i=t.lastIndexOf(".")) > 9) {
   _uns=t.substring(i+1,t.length);
   _uns=(_uns*1);
  }
  cn++;
  if (_uns==0) _uns=1;
  _ubd.cookie="__utmz="+_udh+"."+_ust+"."+_uns+"."+cn+"."+c+"; path=/; "+x+_udo;
 }
 if (cs==0 || _ufns==1) return "&utmcn=1";
 else return "&utmcr=1";
}
function _uRef() {
 if (_ur=="0" || _ur=="" || _ur=="-") return "";
 var i=0,h,k,n;
 if ((i=_ur.indexOf("://"))<0) return "";
 h=_ur.substring(i+3,_ur.length);
 if (h.indexOf("/") > -1) {
  k=h.substring(h.indexOf("/"),h.length);
  if (k.indexOf("?") > -1) k=k.substring(0,k.indexOf("?"));
  h=h.substring(0,h.indexOf("/"));
 }
 h=h.toLowerCase();
 n=h;
 if ((i=n.indexOf(":")) > -1) n=n.substring(0,i);
 for (var ii=0;ii<_uRno.length;ii++) {
  if ((i=n.indexOf(_uRno[ii].toLowerCase())) > -1 && n.length==(i+_uRno[ii].length)) { _ufno=1; break; }
 }
 if (h.indexOf("www.")==0) h=h.substring(4,h.length);
 return "utmccn=(referral)|utmcsr="+_uEC(h)+"|"+"utmcct="+_uEC(k)+"|utmcmd=referral";
}
function _uOrg(t) {
 if (_ur=="0" || _ur=="" || _ur=="-") return "";
 var i=0,h,k;
 if ((i=_ur.indexOf("://")) < 0) return "";
 h=_ur.substring(i+3,_ur.length);
 if (h.indexOf("/") > -1) {
  h=h.substring(0,h.indexOf("/"));
 }
 for (var ii=0;ii<_uOsr.length;ii++) {
  if (h.indexOf(_uOsr[ii]) > -1) {
   if ((i=_ur.indexOf("?"+_uOkw[ii]+"=")) > -1 || (i=_ur.indexOf("&"+_uOkw[ii]+"=")) > -1) {
    k=_ur.substring(i+_uOkw[ii].length+2,_ur.length);
    if ((i=k.indexOf("&")) > -1) k=k.substring(0,i);
    for (var yy=0;yy<_uOno.length;yy++) {
     if (_uOno[yy].toLowerCase()==k.toLowerCase()) { _ufno=1; break; }
    }
    if (t) return _uEC(k);
    else return "utmccn=(organic)|utmcsr="+_uEC(_uOsr[ii])+"|"+"utmctr="+_uEC(k)+"|utmcmd=organic";
   }
  }
 }
 return "";
}
function _uBInfo(page) {
 var sr="-",sc="-",ul="-",fl="-",je=1;
 var n=navigator;
 if (self.screen) {
  sr=screen.width+"x"+screen.height;
  sc=screen.colorDepth+"-bit";
 } else if (self.java) {
  var j=java.awt.Toolkit.getDefaultToolkit();
  var s=j.getScreenSize();
  sr=s.width+"x"+s.height;
 }
 if (_ujv=="-" && (!page || page=="")) {
  for (var i=5;i>=0;i--) {
   var t="<script language='JavaScript1."+i+"'>_ujv='1."+i+"';</script>";
   _ubd.write(t);
   if (_ujv!="-") break;
  }
 }
 if (n.language) { ul=n.language.toLowerCase(); }
 else if (n.browserLanguage) { ul=n.browserLanguage.toLowerCase(); }
 je=n.javaEnabled()?1:0;
 if (_uflash) fl=_uFlash();
 return "&utmsr="+sr+"&utmsc="+sc+"&utmul="+ul+"&utmje="+je+"&utmjv="+_ujv+"&utmfl="+fl;
}
function __utmSetTrans() {
 var e;
 if (_ubd.getElementById) e=_ubd.getElementById("utmtrans");
 else if (_ubd.utmform && _ubd.utmform.utmtrans) e=_ubd.utmform.utmtrans;
 if (!e) return;
 var l=e.value.split("UTM:");
 var i,i2,c;
 if (_userv==0 || _userv==2) i=new Array();
 if (_userv==1 || _userv==2) { i2=new Array(); c=_uGCS(); }

 for (var ii=0;ii<l.length;ii++) {
  l[ii]=_uTrim(l[ii]);
  if (l[ii].charAt(0)!='T' && l[ii].charAt(0)!='I') continue;
  var r=Math.round(Math.random()*2147483647);
  if (!_utsp || _utsp=="") _utsp="|";
  var f=l[ii].split(_utsp),s="";
  if (f[0].charAt(0)=='T') {
   s="&utmt=tran"+"&utmn="+r;
   f[1]=_uTrim(f[1]); if(f[1]&&f[1]!="") s+="&utmtid="+escape(f[1]);
   f[2]=_uTrim(f[2]); if(f[2]&&f[2]!="") s+="&utmtst="+escape(f[2]);
   f[3]=_uTrim(f[3]); if(f[3]&&f[3]!="") s+="&utmtto="+escape(f[3]);
   f[4]=_uTrim(f[4]); if(f[4]&&f[4]!="") s+="&utmttx="+escape(f[4]);
   f[5]=_uTrim(f[5]); if(f[5]&&f[5]!="") s+="&utmtsp="+escape(f[5]);
   f[6]=_uTrim(f[6]); if(f[6]&&f[6]!="") s+="&utmtci="+escape(f[6]);
   f[7]=_uTrim(f[7]); if(f[7]&&f[7]!="") s+="&utmtrg="+escape(f[7]);
   f[8]=_uTrim(f[8]); if(f[8]&&f[8]!="") s+="&utmtco="+escape(f[8]);
  } else {
   s="&utmt=item"+"&utmn="+r;
   f[1]=_uTrim(f[1]); if(f[1]&&f[1]!="") s+="&utmtid="+escape(f[1]);
   f[2]=_uTrim(f[2]); if(f[2]&&f[2]!="") s+="&utmipc="+escape(f[2]);
   f[3]=_uTrim(f[3]); if(f[3]&&f[3]!="") s+="&utmipn="+escape(f[3]);
   f[4]=_uTrim(f[4]); if(f[4]&&f[4]!="") s+="&utmiva="+escape(f[4]);
   f[5]=_uTrim(f[5]); if(f[5]&&f[5]!="") s+="&utmipr="+escape(f[5]);
   f[6]=_uTrim(f[6]); if(f[6]&&f[6]!="") s+="&utmiqt="+escape(f[6]);
  }
  if (_userv==0 || _userv==2) {
   i[ii]=new Image(1,1);
   i[ii].src=_ugifpath+"?"+"utmwv="+_uwv+s;
   i[ii].onload=function() { _uVoid(); }
  }
  if (_userv==1 || _userv==2) {
   i2[ii]=new Image(1,1);
   i2[ii].src=_ugifpath2+"?"+"utmwv="+_uwv+s+"&utmac="+_uacct+"&utmcc="+c;
   i2[ii].onload=function() { _uVoid(); }
  }
 }
 return;
}
function _uFlash() {
 var f="-",n=navigator;
 if (n.plugins && n.plugins.length) {
  for (var ii=0;ii<n.plugins.length;ii++) {
   if (n.plugins[ii].name.indexOf('Shockwave Flash')!=-1) {
    f=n.plugins[ii].description.split('Shockwave Flash ')[1];
    break;
   }
  }
 } else if (window.ActiveXObject) {
  for (var ii=10;ii>=2;ii--) {
   try {
    var fl=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+ii+"');");
    if (fl) { f=ii + '.0'; break; }
   }
   catch(e) {}
  }
 }
 return f;
}
function __utmLinker(l) {
 var p,a="-",b="-",c="-",z="-",v="-";
 var dc=_ubd.cookie;
 if (l && l!="") {
  if (dc) {
   a=_uGC(dc,"__utma="+_udh,";");
   b=_uGC(dc,"__utmb="+_udh,";");
   c=_uGC(dc,"__utmc="+_udh,";");
   z=_uGC(dc,"__utmz="+_udh,";");
   v=_uGC(dc,"__utmv="+_udh,";");
   p="__utma="+a+"&__utmb="+b+"&__utmc="+c+"&__utmz="+escape(z)+"&__utmv="+escape(v);
  }
  if (p) {
   if (l.indexOf("?")<=-1) { document.location=l+"?"+p; }
   else { document.location=l+"&"+p; }
  } else { document.location=l; }
 }
}
function __utmLinkPost(f) {
 var p,a="-",b="-",c="-",z="-",v="-";
 var dc=_ubd.cookie;
 if (!f || !f.action) return;
 if (dc) {
  a=_uGC(dc,"__utma="+_udh,";");
  b=_uGC(dc,"__utmb="+_udh,";");
  c=_uGC(dc,"__utmc="+_udh,";");
  z=_uGC(dc,"__utmz="+_udh,";");
  v=_uGC(dc,"__utmv="+_udh,";");
  p="__utma="+a+"&__utmb="+b+"&__utmc="+c+"&__utmz="+escape(z)+"&__utmv="+escape(v);
 }
 if (p) {
  if (f.action.indexOf("?")<=-1) f.action+="?"+p;
  else f.action+="&"+p;
 }
 return;
}
function __utmSetVar(v) {
 if (!v || v=="") return;
 var r=Math.round(Math.random() * 2147483647);
 _ubd.cookie="__utmv="+_udh+"."+escape(v)+"; path=/; expires=Sun, 18 Jan 2038 00:00:00 GMT;"+_udo;
 var s="&utmt=var&utmn="+r;
 if (_userv==0 || _userv==2) {
  var i=new Image(1,1);
  i.src=_ugifpath+"?"+"utmwv="+_uwv+s;
  i.onload=function() { _uVoid(); }
 }
 if (_userv==1 || _userv==2) {
  var i2=new Image(1,1);
  i2.src=_ugifpath2+"?"+"utmwv="+_uwv+s+"&utmac="+_uacct+"&utmcc="+_uGCS();
  i2.onload=function() { _uVoid(); }
 }
}
function _uGCS() {
 var t,c="",dc=_ubd.cookie;
 if ((t=_uGC(dc,"__utma="+_udh,";"))!="-") c+=escape("__utma="+t+";+");
 if ((t=_uGC(dc,"__utmb="+_udh,";"))!="-") c+=escape("__utmb="+t+";+");
 if ((t=_uGC(dc,"__utmc="+_udh,";"))!="-") c+=escape("__utmc="+t+";+");
 if ((t=_uGC(dc,"__utmz="+_udh,";"))!="-") c+=escape("__utmz="+t+";+");
 if ((t=_uGC(dc,"__utmv="+_udh,";"))!="-") c+=escape("__utmv="+t+";");
 if (c.charAt(c.length-1)=="+") c=c.substring(0,c.length-1);
 return c;
}
function _uGC(l,n,s) {
 if (!l || l=="" || !n || n=="" || !s || s=="") return "-";
 var i,i2,i3,c="-";
 i=l.indexOf(n);
 i3=n.indexOf("=")+1;
 if (i > -1) {
  i2=l.indexOf(s,i); if (i2 < 0) { i2=l.length; }
  c=l.substring((i+i3),i2);
 }
 return c;
}
function _uDomain() {
 if (!_udn || _udn=="" || _udn=="none") { _udn=""; return 1; }
 if (_udn=="auto") {
  var d=_ubd.domain;
  if (d.substring(0,4)=="www.") {
   d=d.substring(4,d.length);
  }
  _udn=d;
 }
 if (_uhash=="off") return 1;
 return _uHash(_udn);
}
function _uHash(d) {
 if (!d || d=="") return 1;
 var h=0,g=0;
 for (var i=d.length-1;i>=0;i--) {
  var c=parseInt(d.charCodeAt(i));
  h=((h << 6) & 0xfffffff) + c + (c << 14);
  if ((g=h & 0xfe00000)!=0) h=(h ^ (g >> 21));
 }
 return h;
}
function _uFixA(c,s,t) {
 if (!c || c=="" || !s || s=="" || !t || t=="") return "-";
 var a=_uGC(c,"__utma="+_udh,s);
 var lt=0,i=0;
 if ((i=a.lastIndexOf(".")) > 9) {
  _uns=a.substring(i+1,a.length);
  _uns=(_uns*1)+1;
  a=a.substring(0,i);
  if ((i=a.lastIndexOf(".")) > 7) {
   lt=a.substring(i+1,a.length);
   a=a.substring(0,i);
  }
  if ((i=a.lastIndexOf(".")) > 5) {
   a=a.substring(0,i);
  }
  a+="."+lt+"."+t+"."+_uns;
 }
 return a;
}
function _uTrim(s) {
  if (!s || s=="") return "";
  while ((s.charAt(0)==' ') || (s.charAt(0)=='\n') || (s.charAt(0,1)=='\r')) s=s.substring(1,s.length);
  while ((s.charAt(s.length-1)==' ') || (s.charAt(s.length-1)=='\n') || (s.charAt(s.length-1)=='\r')) s=s.substring(0,s.length-1);
  return s;
}

function _uEC(s) {
  var n="";
  if (!s || s=="") return "";
  for (var i=0;i<s.length;i++) {if (s.charAt(i)==" ") n+="+"; else n+=s.charAt(i);}
  return n;
}

function __utmVisitorCode() {
 var r=0,t=0,i=0,i2=0,m=31;
 var a=_uGC(_ubd.cookie,"__utma="+_udh,";");
 if ((i=a.indexOf(".",0))<0) return;
 if ((i2=a.indexOf(".",i+1))>0) r=a.substring(i+1,i2); else return "";  
 if ((i=a.indexOf(".",i2+1))>0) t=a.substring(i2+1,i); else return "";  
 var c=new Array('A','B','C','D','E','F','G','H','J','K','L','M','N','P','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9');
 return c[r>>28&m]+c[r>>23&m]+c[r>>18&m]+c[r>>13&m]+"-"+c[r>>8&m]+c[r>>3&m]+c[((r&7)<<2)+(t>>30&3)]+c[t>>25&m]+c[t>>20&m]+"-"+c[t>>15&m]+c[t>>10&m]+c[t>>5&m]+c[t&m];
}

