/**** [Begin : QueryString Access ****/
function Querystring(qs) { // optionally pass a querystring to parse
	this.params = {};
	
	if (qs == null) qs = location.search.substring(1, location.search.length);
	if (qs.length == 0) return;

	// Turn <plus> back to <space>
	// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ');
	var args = qs.split('&'); // parse out name/value pairs separated via &
	
	// split out each name=value pair
	for (var i = 0; i < args.length; i++) {
		var pair = args[i].split('=');
		var name = decodeURIComponent(pair[0]);
		
		var value = (pair.length==2)
			? decodeURIComponent(pair[1])
			: name;
		
		this.params[name] = value;
	}
}

Querystring.prototype.get = function(key, default_) {
	var value = this.params[key];
	return (value != null) ? value : default_;
}

Querystring.prototype.contains = function(key) {
	var value = this.params[key];
	return (value != null);
}
/**** [Finish: QueryString Access] ****/

/**** [Begin : Status Bar Message] ****	
function HideStatus()
{
	window.status='Fidelidade Mundial Seguros';
	return true;
}
	if (document.layers)document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
	document.onmouseover=HideStatus;document.onmouseout=HideStatus;
*** [Finish: Status Bar Message] ****/	

/**** [Begin : Show Formated Date] ****/		
var m_names 	= new Array("Janeiro", "Fevereiro", "Mar&ccedil;o", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro");
var d 			= new Date();
var curr_date 	= d.getDate();
var curr_month 	= d.getMonth();
var curr_year 	= d.getFullYear();
var formateddate= curr_date + " de " + m_names[curr_month] + " de " + curr_year
/**** [Finish: Show Formated Date] ****/	
		
/**** [Begin : Shows One Specific DIV & Hide All Others] ****/	
function hideAllExcept(elm) 
{ 
	for (var i = 0; i < FAQItems .length; i++) 
	{ 
		var layer = document.getElementById("div_" + FAQItems [i]); 
		if (elm!= "div_" + FAQItems [i]) 
		{ 
			layer.style.display = "none"; 
		} 
		else
		{ 
			layer.style.display = "block"; 
		} 
	} 
} 
/**** [Finish: Shows One Specific DIV & Hides All Other DIV's] ****/	

/**** [Begin : Shows All DIV's & Hides One Specific DIV] ****/	
function ShowAllExcept(elm) 
{ 
	for (var i = 0; i < FAQItems .length; i++) 
	{ 
		var layer = document.getElementById("div_" + FAQItems [i]); 

		if (elm!= "div_" + FAQItems [i]) 
		{ 
			layer.style.display = "block"; 
		} 
		else
		{ 
			layer.style.display = "none"; 
		} 
	} 
}
/**** [Finish: Shows All DIV's & Hides One Specific DIV] ****/	

/**** [Begin : Show All / Hide All Button Behavior] ****/	
function ShowAll() 
{ 
	document.getElementById("ShowALL").style.display = "none";
	document.getElementById("HideALL").style.display = "block"; 
}
function HideAll() 
{ 
	document.getElementById("HideALL").style.display = "none";
	document.getElementById("ShowALL").style.display = "block"; 
}
/**** [Finish: Show All / Hide All Button Behavior] ****/	

/**** [Begin : Scroll To Page Top] ****/
function GoToTop()
{ 
	location.href = "#PageTop"; 
}
/**** [Finish: Scroll To Page Top] ****/

/**** [Begin : Show / Hide DIV's For Site Map] ****/
function HideDiv(divId)
{
    divToHide 	= document.getElementById(divId);
    imgToChange = document.getElementById("IMG"+divId);
    if(divToHide.style.display == "none")
    {
    	divToHide.style.display = "block";
        imgToChange.src = "/Style Library/Images/FMImages/img_esconder.gif";
    }
    else
    {
    	divToHide.style.display = "none";
    	imgToChange.src = "/Style Library/Images/FMImages/img_expandir.gif";
    }
}
/**** [Finish: Show / Hide DIV's For Site Map] ****/

/**** [Begin : Redirect] ****/

function RedireccionarUrl(url, redirectUrl, descricao, target) {
	if(redirectUrl == "")
		return;
	
	if(target == 'Sml')	{
		NewWindow(url + "?Url=" + redirectUrl + "&Dc=" + descricao , 'Redireccionar', 790, 490, 'yes', 0, 0, 'no', 'no', 'yes', 'no', 'no');
	}
	else {
		document.frmPost.action = url + "?Url=" + redirectUrl + "&Dc=" + descricao;
		document.frmPost.target = "_blank";
		document.frmPost.submit();
	}
}

function NewWindow(mypage, myname, w, h, scroll, posX, posY, toolbar, menubar, resizable, location, status) {
	var win = null;

	LeftPosition = posX;
	TopPosition = posY;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',toolbar='+toolbar+',menubar='+menubar+',resizable='+resizable+',location='+location+',status='+status;

	win = window.open(mypage,myname,settings);
	return win;
}

/**** [Finish: Redirect] ****/

/**** [Begin : Product Details] ****/

var itemsHidden = true;

function ShowAllDivs(n) {
	for(j = 0; j < n; j ++) {
		if(itemsHidden) {
			ShowItem(j);
		}
		else {
			HideItem(j);
		}
	}

 	if(itemsHidden) {
		document.getElementById("btShowAll").style.display = "none";
		document.getElementById("btHideAll").style.display = "inline";
		document.getElementById("txShowAll").innerHTML = "Ocultar Todos";
 	}
	else {
		document.getElementById("btShowAll").style.display = "inline";
		document.getElementById("btHideAll").style.display = "none";
		document.getElementById("txShowAll").innerHTML = "Ver Todos";
	}

	itemsHidden = !itemsHidden;
}

function ShowDiv(i, n) {
	for(j = 0; j < n; j ++) {
		HideItem(j);
	}

	ShowItem(i);
}

function HideItem(i) {
	document.getElementById("div_" + i).style.display = "none";
}

function ShowItem(i) {
	document.getElementById("div_" + i).style.display = "block";
}

/**** [Finish: Product Details] ****/

function titleDDLChange(ddl) {
    for(i = 0; i < ddl.length; i ++) {
        if (i > 1) {
            if (ddl[i].selected) {
                // window.location = ddl[i].value;
                window.open(ddl[i].value, "_blank",
                    "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes");
            }
        }
    }
}