	/***********************************************************************************

	PROTOTYPE

	************************************************************************************/

	// Função para pegar os params da URL

	window.location.get = function (id) {

		if (m = window.location.search.match(new RegExp(id + "=([^&]+)")))

			return unescape(m[1].replace(/\+/g, unescape("%20")));

		return "";

	};



	String.prototype.getNumber = function () {

		return this.replace(/[^0-9]*/g, "");

	};



	String.prototype.trim = function () {

		return this.replace(/^[\W\t\n\r\0\x0B]+|[\W\t\n\r\0\x0B]+$/g, "").toString();

	};



	// faz referencias as funcoes//// somente para o ie

	function __ini_object(ref) {

		//ref.getMethods = Object.prototype.getMethods;

		//ref.getProperty = Object.prototype.getProperty;

		//ref.getEvents = Object.prototype.getEvents;

		//ref.getObjects = Object.prototype.getObjects;



		ref.addEventListener = function(en, func, capture) {

			if (en == "load") {

				if (this.attachEvent)

					this.attachEvent('on' + en, func);

				return;

			}

			var __func = null;



			if (eval("typeof __call_childs_" + en + "== \"undefined\"")) {

				eval("__call_childs_" + en + " = function () {for (var i = 0; i < this[\"_count\" + en]; i++) {try{this[\"_count\" + en + \"_\" + i]()}catch(e){};}}");

			}



			if (typeof this["_count" + en] == "undefined")

				this["_count" + en] = 0;

			var __c = 0;



			__func = eval("this.on" + en);



			if (eval("__call_childs_"+en+" != __func")) {

				eval("this.on" + en + " = __call_childs_" + en);



				__c = this["_count" + en]++;

				this["_count" + en + "_" + __c] =  __func;

			}



			__c = this["_count" + en]++;

			this["_count" + en + "_" + __c] =  func;

		};

	}



	// são Funcões para retornar as propriedades e metodos dos objetos

	/*

	Object.prototype.getMethods = function () {

		var s = "";

		for (var i in this)

			if (typeof this[i] == "function")

				s += i + " = " + this[i] + "\n";



		return s;

	};



	Object.prototype.getProperty = function () {

		var s = "";

		for (var i in this)

			if (typeof this[i] != "function" && typeof this[i] != "object")

				s += i + " = " + this[i] + "\n";



		return s;

	};



	Object.prototype.getEvents = function () {

		var s = "";

		for (var i in this)

			if (i.match(/^on/))

				s += i + " = " + this[i] + "\n";



		return s;

	};



	Object.prototype.getObjects = function () {

		var s = "";

		for (var i in this)

			if (typeof this[i] == "object")

				s += i + " = " + this[i] + "\n";



		return s;

	};*/



	// no caso do IE, adicionar o addEventListener e as funções de propriedade

	if (!document.addEventListener || document.attachEvent) {

		for (var i = 0; i < document.all.length; i++)

			__ini_object(document.all[i]);



		var originalCreateElement = document.createElement;

		document.createElement = function(tagName) {

			var element = originalCreateElement(tagName);



			if (element.attachEvent)

				__ini_object(element);



			return element;

		};



		__ini_object(window);

		__ini_object(document);

	}



	/***********************************************************************************

	GENERIC FUNCTIONS

	************************************************************************************/

	var __OLD_VALUE = null;

	function setValue(obj) {

		__OLD_VALUE = obj.value;

	}



	function restoreValue(obj) {

		obj.value = __OLD_VALUE;

	}



	function strToFloat(value) {

		value = value.toString();

		value = value.replace(/\./g, "");

		value = (value.replace(/,/g, ".")*1);

		return value;

	}



	function floatToStr(value) {

		value = value.toString();

		return format_float(value.replace(/\./g, ","));

	}



	function verify_char(e, char_pode, obj, length) {

		//var _ignore_code = new Array(8, 13, 46);

		var _ignore_code = new Array(8, 13);

		var _code = null;



		if (navigator.appName.indexOf("Netscape")!= -1)

			_code = e.which;

		else

			_code = e.keyCode;



		if (e.ctrlKey || e.shiftKey || e.altKey)

			return true;



		for (var x = 0; x < _ignore_code.length; x++)

			if (_ignore_code[x] == _code)

				return true;



		var _char = null;

		if ((_code) && (_char = String.fromCharCode(_code)))

			if (typeof obj != "undefined" && typeof length != "undefined" && obj.value.length >= length)

				return false;

			else

				return char_pode.indexOf(_char) != -1;



		return true;

	}



	var XML_OBJECT = null;

	function loadXML(url, __func) {

		var req = null;



		if (window.XMLHttpRequest) // Procura por um objeto nativo (Mozilla/Safari)

			req = new XMLHttpRequest();

		else if (window.ActiveXObject) // Procura por uma versao ActiveX (IE)

			req = new ActiveXObject("Microsoft.XMLHTTP");



		if (req) {

			req.onreadystatechange = function () {

				if (req.readyState == 4) { // apenas quando o estado for "completado"



					if (req.status == 200) {// apenas se o servidor retornar "OK"

						__func(req.responseText);

					}

					else

						alert("Houve um problema ao obter os dados:\n" + req.statusText);

				}

			};



			req.open("GET", url, true); // o true serve caso for usado como threads, ele não ficará travado e terá q ser usado um função para receber o retorno

			req.send(null);

		}

	}



	function setCheckBox(name, value, checked) {

		var c = document.getElementsByName(name);

		checked = (typeof checked == "undefined") ? true : checked;



		if (typeof value != "undefined") {

			for (var x = 0; x < c.length; x++)

				if (c[x].value == value)

					c[x].checked = checked;

		}

		else {

			for (var x = 0; x < c.length; x++)

				c[x].checked = checked;

		}

	}



	function selectAll(obj) {

		if (typeof obj == "string")

			obj = document.getElementById(obj);



		switch (obj.tagName.toLowerCase()) {

			case "select":

				for (var i = 0; i < obj.options.length; i++)

					obj.options[i].selected = true;

			break;

			default:

				alert("Não implementado!!");

		}

	}



	function selectOption(obj, value) {

		switch (obj.tagName.toLowerCase()) {

			case "select":

				for (var i = 0; i < obj.options.length; i++)

					if (obj.options[i].value == value) {

						obj.options[i].selected = true;

						break;

					}

			break;

			default:

				alert("Não implementado!!");

		}

	}



	function __sprintf(match, value, str) {

		//alert(__match + '-'+ value);



		// decimal ou float

		if (__match = match.match(/%d|%f/))

			str = str.replace(__match[0], value);

		else

		// decimal - formata a esquerda

		if (__match = match.match(/%([0-9])([0-9]+)d/)) {

			var value = (value*1).toString();



			if (value.length < __match[2])

				while (value.length < __match[2])

					value = __match[1] + value;



			str = str.replace(__match[0], value);

		}

		else

		// string - formata a esquerda

		if (__match = match.match(/%([0-9])([0-9]+)s/)) {

			var value = value.toString();



			if (value.length < __match[2])

				while (value.length < __match[2])

					value = __match[1] + value;



			str = str.replace(__match[0], value);

		}

		else

		// string somente

		if (__match = match.match(/%s/)) {

			var value = value.toString();



			if (value.length < __match[2])

				while (value.length < __match[2])

					value = __match[1] + value;



			str = str.replace(__match[0], value);

		}

		// float - formatado

		else

		if (__match = match.match(/%([0-9])([0-9]+)\.([0-9]+)f/)) {

			var value = (value*1).toString();

			var iInt = value.substr(0, value.indexOf('.')).toString();

			var iDec = value.substr(value.indexOf('.') + 1).toString();



			if (iDec.length < __match[3]) {

				while (iDec.length < __match[3])

					iDec += '0';

			}

			else

				iDec = iDec.substr(0, __match[3]);



			value = iInt + '.' + iDec;



			while (value.length < __match[2])

				value = __match[1] + value;



			str = str.replace(__match[0], value);

		}



		return str;

	}



	function sprintf() {

		var str = arguments[0];

		var __match = str.match(/%[0-9\.]*[dfs]/g);



		if (__match.length > arguments.length - 1)

			alert('WARNING:\nsprintf(): Too few arguments');

		else

			for (var x = 0; x < __match.length; x++)

				str = __sprintf(__match[x], arguments[x + 1], str);



		return str;

	}



	function serialize(what) {

		this.__string = function(__s) {

			return ('s:'+__s.length+':"'+__s+'";');

		};



		this.__number = function(__s) {

			return ((String(__s).indexOf('.')==-1)?'i:'+__s+';':'d:'+__s+';');

		};



		this.__boolean = function(__s) {

			return ('b:'+(__s?'1':'0')+';');

		};



		this.__undefined = function(__s) {

			return ('N;');

		};



		this.__object = function(__s) {

			var n;

			var a = 0;

			var ser = '';

			for(var b in __s) {

				n = (__s[b] == null);

				if(n || (__s[b].constructor != Function && b != '__class')) {

					ser+=(!isNaN(b))?this.__number(b):this.__string(b);

					ser+=n?this.__undefined(n):this['__'+typeof(__s[b])](__s[b]);

					a++;

				}

			}



			return ('a:'+a+':{'+ser+'}');

		};



		if(what == null)

			var ser = this.__undefined(what);

		else

			var ser = this['__'+typeof(what)](what);

		return ser;

	}



	function $() {

	  	var elements = new Array();



	  	for (var i = 0; i < arguments.length; i++) {

			var element = arguments[i];

			if (typeof element == 'string') {

		  		if (aux = document.getElementById(element))

					element = aux;

				else

					element = document.getElementsByName(element);

			}



			if (arguments.length == 1)

		  		return element;



			elements.push(element);

	  	}



	  	return elements;

	}

	/***********************************************************************************

	FORMATS

	************************************************************************************/

	function format_date(value) {

		if (m = value.match(/([0-9]{2})([0-9]{2})([0-9]{4})/))

			return m[1] + "/" + m[2] + "/" + m[3];

		return value;

	}



	function format_cnpj(value) {

		if (m = value.match(/([0-9]{2})([0-9]{3})([0-9]{3})([0-9]{4})([0-9]{2})/))

			return m[1] + "." + m[2] + "." + m[3] + "/" + m[4] + "-" + m[5];

		return value;

	}



	function format_cep(value) {

		if (m = value.match(/([0-9]{2})([0-9]{3})([0-9]{3})/))

			return m[1] + "." + m[2] + "-" + m[3];

		return value;

	}



	function format_cpf(value) {

		if (m = value.match(/([0-9]{3})([0-9]{3})([0-9]{3})([0-9]{2})/))

			return m[1] + "." + m[2] + "." + m[3] + "-" + m[4];

		return value;

	}



	function format_float(value) {

		if (value == 0)

			return "0,00";

		value = value.toString();



		if (value == parseFloat(value))

			value = value.replace(/\./g, ",");

		else

			value = value.replace(/\./g, "");



		Dec = '00';

		Int = '0';

		if (value.indexOf(',') != -1) {

			Int = value.substring(0, value.indexOf(','));

			Dec = value.substring(value.indexOf(',') + 1);

		}

		else

			Int = value;



		if (Dec.length > 2)

			Dec = Dec.substring(0, 2);

		else

			while (Dec.length < 2)

				Dec += '0';



		Int = (Int*1);

		Int = Int.toString();

		aux = '';

		for (x = 1 ; x <= Int.length; x++) {

			sep = (((x % 3) == 0) && (x != Int.length))?'.':'';

			aux = sep + (Int.substring(Int.length - x, Int.length - x+1)) + aux;

		}

		Int = aux;



		return (Int + ',' + Dec);

	}



	function format_float2( campo, teclapres) {

		var tecla = teclapres.keyCode;

		//var campo = getElementById()nome_campo );

		//var tecla = event.keyCode;



		var valor = campo.value;

		valor = valor.replace( "/", "" );

		valor = valor.replace( ",", "" );

		valor = valor.replace( ",", "" );

		valor = valor.replace( ",", "" );

		valor = valor.replace( ".", "" );

		valor = valor.replace( ".", "" );

		valor = valor.replace( ".", "" );

		valor = valor.replace( ".", "" );



		var tamanho = valor.length;



		// tamanho sem . nem ,

		if (!(maximo = campo.getAttribute("maxlength")))

			maximo = 100;



		var tamanho_maximo 	= maximo;





		if (tamanho < tamanho_maximo && tecla != 8)

			tamanho = tamanho + 1;



		if (tecla == 8 )

			tamanho = tamanho - 1;



		if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ) {

			if ( tamanho <= 2 )

				campo.value = valor;



			if ( (tamanho > 2) && (tamanho <= 5) )

				campo.value = valor.substr( 0, tamanho - 2 ) + ',' + valor.substr( tamanho - 2, tamanho ) ;



			if ( (tamanho >= 6) && (tamanho <= 8) )

				campo.value = valor.substr( 0, tamanho - 5 ) + '.' + valor.substr( tamanho - 5, 3 ) + ',' + valor.substr( tamanho - 2, tamanho ) ;



			if ( (tamanho >= 9) && (tamanho <= 11) )

				campo.value = valor.substr( 0, tamanho - 8 ) + '.' + valor.substr( tamanho - 8, 3 ) + '.' + valor.substr( tamanho - 5, 3 ) + ',' + valor.substr( tamanho - 2, tamanho ) ;

		}

	}



	function format_fone(value) {

		value = value.replace(/[^0-9]*/g, "").toString();



		if (value.match(/^0/)) {// número como 0300 0800 0900 031, deverá ter no mínimo, 10 dig

			if (m = value.match(/([0-9]{4})([0-9]{6,7})/))

				value = m[1] + "-" + m[2];

		}

		else

			if (m = value.match(/([0-9]{2})([0-9]{4})([0-9]{4})/))

				value = "(" + m[1] + ") " + m[2] + "-" + m[3];



		return value;

	}



	function format_time(value) {

		value  = value.replace(/[^0-9]*/g, "").toString();

		if (m = value.match(/([0-9]{2})([0-9]{2})([0-9]{2})/))

			return m[1] + ":" + m[2] + ":" + m[3];

		else

		if (m = value.match(/([0-9]{2})([0-9]{2})/))

			return m[1] + ":" + m[2];

		else

		if (m = value.match(/([0-9]{2})/))

			return m[1] + ":00";



		return value;

	}



	/***********************************************************************************

	VALIDATION

	************************************************************************************/

	function v_date(value) {

		value = value.replace(/[^0-9]*/g, "").toString();



		if (!(m = value.match(/([0-9]{2})([0-9]{2})([0-9]{4})/)))

			return false;



		value = m[3] + "/" + m[2] + "/" + m[1];



		now = new Date(value);

		dia = now.getDate();

		mes = now.getMonth() + 1;

		ano = now.getFullYear();



		if (dia < 10)

			dia = "0" + dia;

		if (mes < 10)

			mes = "0" + mes;

		if (ano < 2000 && ano.toString().length < 4)

			ano = "19" + ano;



		return ((ano+ "/" + mes + "/" + dia) == value);

	}



	function v_cnpj(value) {

		value = value.replace(/[^0-9]*/g, "").toString();



		if (value.length<14 && value.length>0)

			return false;

		else

			sim=true;

		if (sim )  { // verifica se e numero

			for (i=0;((i<=(value.length-1))&& sim); i++)  {

				val = value.charAt(i);

				// alert (val)

				if ((val!="9")&&(val!="0")&&(val!="1")&&(val!="2")&&(val!="3")&&(val!="4") && (val!="5")&&(val!="6")&&(val!="7")&&(val!="8"))

					sim=false;

			}

			if (sim) {// se for numero continua

				m2 = 2;

				soma1 = 0;

				soma2 = 0;

				for (i=11;i>=0;i--) {

					val = eval(value.charAt(i));

					// alert ("Valor do Val: "+val)

					m1 = m2;

					if (m2<9)

						m2 = m2+1;

					else

						m2 = 2;

					soma1 = soma1 + (val * m1);

					soma2 = soma2 + (val * m2);

				}  // fim do for de soma



				soma1 = soma1 % 11;

				if (soma1 < 2)

					d1 = 0;

				else

					d1 = 11- soma1;

				soma2 = (soma2 + (2 * d1)) % 11;

				if (soma2 < 2)

					d2 = 0;

				else

					d2 = 11- soma2;

				if ((d1==value.charAt(12)) && (d2==value.charAt(13)))

					sim=true;

				else

					sim=false;

			}

		}



		return sim;

	}



	function v_cep(value) {

		value = value.replace(/[^0-9]*/g, "").toString();



		if (value.length < 8)

			return false;

		return true;

	}



	function v_cpf(value) {

		value = value.replace(/[^0-9]*/, "").toString();



		var varFirstChr = value.charAt(0);

		var vaCharCPF = false;

		soma=0;

		for ( i=0; i<9; i++ )

			soma += (10-i) * ( eval(value.charAt(i)) );



		digito_verificador = 11-(soma % 11);



		if ((soma % 11) < 2)

			digito_verificador = 0;



		if ( eval(value.charAt(9)) != digito_verificador )

			return false;



		soma=0;

		for ( i=0; i<9; i++ )

			soma += (11-i) * (eval(value.charAt(i)));



		soma += 2 * ( eval(value.charAt(9)));

		digito_verificador = 11-(soma % 11);



		if ((soma % 11) < 2)

			digito_verificador = 0;



		if ( eval(value.charAt(10)) != digito_verificador)

			return false;

		if (value=="11111111111") //vitor

			return false;

		return true;

	}



	function v_email(value) {

		re = new RegExp(/^[a-z0-9._%-]+@[a-z0-9._%-]+\.[a-z]{2,6}$/ig);



		return re.test(value);

	}



	function v_float(value) {

		if (!value)

			return;



		val2 = strToFloat(value);

		val1 = parseFloat(val2);

		if ((val1*1) != (val2*1))

			return false;

		return true;

	}



	function v_fone(value) {

		value = value.replace(/[^0-9]*/g, "").toString();



		if (value.match(/^0/)) { // número como 0300 0800 0900 031, deverá ter no mínimo, 10 dig

			if (value.length < 10)

				return false;

		}

		else { // números comuns

			if (value.length < 10)

				return false;

		}



		return true;

	}



	function v_time(value) { // suporta hora até 23h 23:30:30

		value = value.replace(/[^0-9]*/g, "").toString();



		mSeg = (value.length == 6);



		arTime = Array(value.substr(0,2), value.substr(2,2), value.substr(4,2));



		time = new Date(0, 0, 0, arTime[0], arTime[1], arTime[2]);



		t = (time.getHours() == (arTime[0]*1));

		m = (time.getMinutes() == (arTime[1]*1));

		s = (time.getSeconds() == (arTime[2]*1));



		if (t && m && ((!mSeg && !s) || (mSeg && s) || (!mSeg && s)))

			return true;



		return false;

	}



	function v_time2(value) { // suporta hora maior q 23 30:30:30

		var h = parseInt(value.substr(0,2));

		var m = parseInt(value.substr(2,2));

		var s = parseInt(value.substr(4,2));



		if (!h) // hora

			return false;



		if (m >= 60) // minuto

			return false;



		if (s >= 60) // segundos

			return false;



		return true;

	}



	/***********************************************************************************

	OBJECT VALIDATION

	************************************************************************************/

	function ov_float(obj) {

		if (obj.value && !v_float(obj.value)) {

			restoreValue(obj);

			alert("Valor inválido!");

			return false;

		}



		if (obj.value)

			obj.value = format_float(obj.value);

		return true;

	}



	function ov_date(obj) {

		if (obj.value && !v_date(obj.value)) {

			restoreValue(obj);

			alert("Data inválida!");

			return false;

		}



		if (obj.value)

			obj.value = format_date(obj.value);

		return true;

	}



	function ov_cnpj(obj) {

		if (obj.value && !v_cnpj(obj.value)) {

			restoreValue(obj);

			alert("CNPJ inválido!");

			return false;

		}



		if (obj.value)

			obj.value = format_cnpj(obj.value);

		return true;

	}



	function ov_cep(obj) {

		if (obj.value && !v_cep(obj.value)) {

			restoreValue(obj);

			alert("CEP inválido!\nVoce deve digitar 8 posições!");

			return false;

		}



		if (obj.value) {

			obj.maxLength = 10;

			obj.value = format_cep(obj.value);

		}

		return true;

	}



	function ov_cpf(obj) {

		if (obj.value && !v_cpf(obj.value)) {

			restoreValue(obj);

			alert("CPF inválido!");

			return false;

		}



		if (obj.value)

			obj.value = format_cpf(obj.value);

		return true;

	}



	function ov_cpf_cnpj(obj) {

		obj.value = obj.value.replace(/[^0-9]*/g, "").toString();



		if (obj.value) {

			if (obj.value.length == 11)

				return ov_cpf(obj);

			else

			if (obj.value.length == 14)

				return ov_cnpj(obj);

			else {

				alert("Formato inválido!");

				return false;

			}

		}



		return true;

	}



	function ov_email(obj) {

		if (obj.value && !v_email(obj.value)) {

			restoreValue(obj);

			alert("E-mail inválido!");

			return false;

		}



		return true;

	}



	function ov_fone(obj) {

		if (obj.value) {

			if (!v_fone(obj.value)) {

				var value = obj.value.replace(/[^0-9]*/g, "").toString();

				restoreValue(obj);



				if (value.match(/^0/)) // número como 0300 0800 0900 031, deverá ter no mínimo, 10 dig

					alert("Número inválido!");

				else

					alert("Você deverá acrescentar o código de área!");



				return false;

			}

			else

				obj.value = format_fone(obj.value);

		}



		return true;

	}



	function ov_time(obj, fulltime) {

		var func = v_time;

		if (fulltime)

			func = v_time2;



		if (obj.value && !func(obj.value)) {

			restoreValue(obj);

			alert("Formato de hora inválido!");

			return false;

		}



		if (obj.value)

			obj.value = format_time(obj.value);

		return true;

	}



	function MM_openBrWindow(theURL,winName,features) { //v2.0

		window.open(theURL,winName,features);

	}



	/*

	function getScrollPos(){

		var docElem = document.documentElement;

		this.left = window.pageXOffset || (docElem&&docElem.scrollLeft) || document.body.scrollLeft;

		this.top = window.pageYOffset || (docElem&&docElem.scrollTop) || document.body.scrollTop;

	}

	*/



	//--- the code has been a bit complicated, but should provide more reliable results

	//--- "algorithm" elaborated with the help of the comparison table from:

	//--- http://www.softcomplex.com/docs/get_window_size_and_scrollbar_position.html



/*

function getPageSize(){

		var docElem = document.documentElement;

		var docBody = document.body;

		var val1h,val2h,val3h;

		var val1w,val2w,val3w;

		var w=0,h=0;



		val1h= docElem ? docElem.clientHeight :0;

		val2h= docBody.clientHeight ? docBody.clientHeight :0;

		val3h= window.innerHeight ?  window.innerHeight : 0;



		val1w= docElem ? docElem.clientWidth :0;

		val2w= docBody.clientWidth ? docBody.clientWidth :0;

		val3w= window.innerWidth ?  window.innerWidth : 0;



		if(val1h && val2h && val3h){ //we have three height settings

			if(val1h == val2h){ //safari

				w=val3w;

				h=val3h;

			}

			else { //opera or firefox

				if(val2h<val1h) {

					var tmp=val1h;

					val1h=val2h;

					val2h=tmp;

				}

				if(val2w<val1w) {

					var tmp=val1w;

					val1w=val2w;

					val2w=tmp;

				}

				h= val2h<=val3h ? val2h : val1h;

				w= val2w<=val3w ? val2w : val1w;

			}//end if opera or firefox

		} //end if we have three height settings

		else { //explorer or netscape

			if(val1h){

				w=val1w;

				h=val1h;

			}

			else {

				w=val2w;

				h=val2h;

			}

		}	//end if explorer or netscape



		this.width =w;

		this.height =h;

	}//end of function getPageSize

*/

function selectMove(sbox, dbox) {

	// sbox origem

	// dbox destino



	var arrLookup = new Array();

	var arS = new Array();

	var len = sbox.options.length;



	for (var i = len-1; i >= 0; i--) {

		if (sbox.options[i].selected) {

			arrLookup[arrLookup.length] = new Array(sbox.options[i].value, sbox.options[i].text);

			sbox.remove(i);

		}

	}



	var len3 = arrLookup.length;



	for(var c = 0; c < len3; c++) {

		var no = document.createElement("OPTION");

		no.value = arrLookup[c][0];

		no.text = arrLookup[c][1];



		dbox.options.add(no);

	}

}





function selectDelete(sbox){

	var arrLookup = new Array();

	var arS = new Array();

	var len = sbox.options.length;



	for (var i = len-1; i >= 0; i--) {

		if (sbox.options[i].selected) {

			sbox.remove(i);

		}

	}

}



/*

Written by Jonathan Snook, http://www.snook.ca/jonathan

Add-ons by Robert Nyman, http://www.robertnyman.com

*/



/*

function getElementsByClassName(oElm, strTagName, strClassName){

	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);

	var arrReturnElements = new Array();

	strClassName = strClassName.replace(/\-/g, "\\-");

	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");

	var oElement;

	for(var i=0; i<arrElements.length; i++){

		oElement = arrElements[i];

		if(oRegExp.test(oElement.className)){

			arrReturnElements.push(oElement);

		}

	}

	return (arrReturnElements)

}*/



//adicionado:

function fecha1(){

	document.getElementById("videos").style.display="none";

}

function abre1(){

	document.getElementById("videos").style.display="inherit";

}



function isVisible(el) {

	if (!el.parentNode)

		return true;



	if (el.style.display != 'none' && el.style.visibility != 'hidden')

			return isVisible(el.parentNode);



	return false;

}



function confirmaExclusao() {

	return confirm("Deseja realmente excluir o registro?");

}



function Populate(obj, data, sel) {

	if (typeof obj == "string")

		obj = document.getElementById(obj);



	for (var i = 0; i < data.length; i++) {

		var op = document.createElement("OPTION");

		op.value = data[i].value;

		op.text = data[i].text;



		if (op.value == sel) {

			op.selected = true;

		}



		obj.options.add(op);

	}



	if (sel && obj.onchange)

		obj.onchange();

}



function XHRPopulate(obj, url, sel) {

	if (typeof obj == "string")

		obj = document.getElementById(obj);



	loadXML(url, function (data) {

		data = eval(data);

		Populate(obj, data, sel);

	});

}



function clearSelect(obj, len) {

	if (typeof obj == "string")

		obj = document.getElementById(obj);



	if (typeof len == "undefided")

		len = 0;



	while (obj.options.length > len)

		obj.remove(len);

}
