var BaseSite ={};

BaseSite.limpaDropDown = function(idSelect)
{
	var qtd_dados = jQuery("#" + idSelect).length;

	for (i = 0; i < qtd_dados; i++)
	{
		jQuery("#" + idSelect).remove(i);
		qtd_dados--;
		i = 0;
	}

	jQuery("#" + idSelect).options[0] = new Option(":: Selecione ::", "");
}
BaseSite.addOptions = function(arrayOptions, formId)
{
	selectTarget = document.getElementById(formId);

	for (i = 1; i <= arrayOptions.length; i++)
	{
		selectTarget.options[i] = new Option(arrayOptions[i - 1]['txt'], arrayOptions[i - 1]['valor']);
	}
}
BaseSite.execOptions = function(idSelect, arrayOptions)
{
	//this.limpaDropDown(idSelect);
	this.addOptions(arrayOptions, idSelect);
}
BaseSite.scrollTopo = function()
{
	$('body_pagina').scrollTop = 0;
}
BaseSite.getWTopDistance = function()
{
	var top = document.documentElement.scrollTop || document.body.scrollTop || 0;
	return top
}
BaseSite.setWTopPopUp = function(idDiv)
{
	var screenHeight = window.screen.availHeight;
	$(idDiv).style.top = this.getWTopDistance() + (screenHeight / 10) + 'px';
}
BaseSite.getHeightViewPort = function()
{
	var viewportheight = null;

	if (typeof window.innerWidth != 'undefined')
	{
		viewportheight = window.innerHeight
	}

	// IE6 in standards compliant mode (i.e. with a valid doctype as the first
	// line in the document)

	else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
	{
		viewportheight = document.documentElement.clientHeight
	}

	// older versions of IE

	else
	{
		viewportheight = document.getElementsByTagName('body')[0].clientHeight
	}
	
	return viewportheight;
}
BaseSite.lockScreen = function()
{
	//var height = (this.getWTopDistance() == 0) ? this.getHeightViewPort() : document.body.offsetHeight;	
	var height = jQuery("body").height();
	
	$('container_modal').style.width = document.body.offsetWidth + "px";
	$('container_modal').style.height = height + "px";
	$('container_modal').style.display = "block";

	$('container_modal_content').style.width = document.body.offsetWidth + "px";
	$('container_modal_content').style.height = height + "px";
	$('container_modal_content').style.display = "block";
}
BaseSite.freeScreen = function()
{
	$('container_modal').style.display = "none";
	$('container_modal_content').style.display = "none";
	$('container_modal_content').innerHTML = "";
}
BaseSite.setPop = function(html)
{
	this.lockScreen();
	$('container_modal_content').innerHTML = html;
}
BaseSite.clearPop = function()
{
	this.freeScreen();
	$('container_modal_content').innerHTML = '';
}

