/*========================================================*/
/* Funções Javascript não revisadas            			  */				
/*========================================================*/

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

var browser = navigator.appName
var isNav, isIE
isIE = true	
if (browser == "Netscape") { 
      isNav = true	
}
else { 
if (browser == "Microsoft Internet Explorer") { 
      isIE = true	
}
}


var cm=null;
document.onclick = new Function("show(null)")

function show(el,m) {

if (cm)
	cm.style.visibility='hidden';

	
if (isNav) {
	if (m) {
		m.visibility='show';
//		alert(m.style.visibility);		
			}
	if ((m!=cm) && (cm)) cm.visibility='hidden'
	cm=m
} 
if(isIE) {
	if (m) {
		m.style.visibility='';
			}
	if ((m!=cm) && (cm)) cm.style.visibility='hidden'
	cm=m
}

}

function hide()
{
	show(null);
}
	 
function MM_HideLayers() { //v3.0
  var i,p,v,obj,args=MM_HideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function check_date(field) 
  {
     var checkstr = "0123456789"; 
     var DateField = field; 
     var Datevalue = ""; 
     var DateTemp = ""; 
     var seperator = "/"; 
     var day; 
     var month; 
     var year; 
     var leap = 0; 
     var err = 0; 
     var i; 
     err = 0; 
     DateValue = DateField.value; 
     /* Deletando todos os caracteres exceto o 0..9 */ 
     for (i = 0; i < DateValue.length; i++) 
     { 
        if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) 
           { 
               DateTemp = DateTemp + DateValue.substr(i,1); 
           } 
     } 
     DateValue = DateTemp; 
     /* Exectutando a data para 8 digitos - string*/ 
     /* if entrada do ano com 2-digitos / exemplo 20xx */ 
     if (DateValue.length == 6) 
        { 
           DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); 
        } 
     if (DateValue.length != 8) 
        { 
           err = 19; 
        } 
     /* Se o ano for errado = 0000 */ 
     year = DateValue.substr(4,4); 
     if (year == 0) 
        { 
           err = 20; 
        } 
     /* Validando o mês*/ 
     month = DateValue.substr(2,2); 
     if ((month < 1) || (month > 12)) 
        { 
           err = 21; 
        } 
     /* Validando o dia*/ 
     day = DateValue.substr(0,2); 
     if (day < 1) 
        { 
           err = 22; 
        } 
     /* Validando ano Bissexto / fevereiro / dia */ 
     if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) 
        { 
           leap = 1; 
        } 
     if ((month == 2) && (leap == 1) && (day > 29)) 
        { 
           err = 23; 
        } 
     if ((month == 2) && (leap != 1) && (day > 28)) 
        { 
           err = 24; 
        } 
     /* Validando o mês */ 
     if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) 
        { 
           err = 25; 
        } 
     if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) 
        { 
           err = 26; 
        } 
     /* if 00 houvendo entrada, sem erros */ 
     if ((day == 0) && (month == 0) && (year == 00)) 
        { 
           err = 0; day = ""; month = ""; year = ""; seperator = ""; 
        } 
     /* if sem erros, escrevo a data completa no Input-Field (e.x. 13/12/2001) */ 
     if (err == 0) 
        { 
           DateField.value = day + seperator + month + seperator + year; 
        } 
     /* Mensagem de erro if err != 0 */ 
     else 
        { 
           return(false);
        } 
     return(true);
}


var response = null 
	

function prompt2(promptpicture, prompttitle, message, sendto) { 

	promptbox = document.createElement('div'); 

	promptbox.setAttribute ('id' , 'prompt') 

	document.getElementsByTagName('body')[0].appendChild(promptbox) 

	promptbox = eval("document.getElementById('prompt').style") 

	promptbox.position = 'absolute' 

	promptbox.top = 190 

	promptbox.left = 250 

	promptbox.width = 300 

	promptbox.border = 'outset 1 #bbbbbb' 

//	document.getElementById('prompt').innerHTML = "<table cellspacing='0' cellpadding='0' border='0' width='100%'><tr valign='middle'><td width='22' height='22' style='text-indent:2;' class='titlebar'><img src='" + promptpicture + "' height='18' width='18'></td><td class='titlebar'>" + prompttitle + "</td></tr></table>"

	document.getElementById('prompt').innerHTML = "<table cellspacing='0' cellpadding='0' border='0' width='100%'><tr valign='middle'><td width='22' height='22' style='text-indent:2;' class='titlebar'></td><td class='titlebar'>" + prompttitle + "</td></tr></table>"  

	document.getElementById('prompt').innerHTML = document.getElementById('prompt').innerHTML + "<table cellspacing='0' cellpadding='0' border='0' width='100%' class='promptbox'><tr><td>" + message + "</td></tr><tr><td><input type='text' id='promptbox' onblur='this.focus()' class='promptbox'></td></tr><tr><td align='right'><br><input type='button' class='prompt' value='OK' onMouseOver='this.style.border=\"1 outset #dddddd\"' onMouseOut='this.style.border=\"1 solid transparent\"' onClick='" + sendto + "(document.getElementById(\"promptbox\").value); document.getElementsByTagName(\"body\")[0].removeChild(document.getElementById(\"prompt\"))'> <input type='button' class='prompt' value='Cancel' onMouseOver='this.style.border=\"1 outset transparent\"' onMouseOut='this.style.border=\"1 solid transparent\"' onClick='" + sendto + "(\"\"); document.getElementsByTagName(\"body\")[0].removeChild(document.getElementById(\"prompt\"))'></td></tr></table>" 

	document.getElementById("promptbox").focus() 

	} 

function myfunction(value) { 

	if(value.length<=0)

		return false;

	else

		document.getElementById('output').innerHTML="<b>"+value+"</b>";


} 

function mostraMenu(obj, catid)
{

	var item;
//	alert(eval('document.getElementById(m' + catid + ').style'));
	item = eval('m' + catid + '.style');
	if (screen.width > 800)
		if (screen.width > 1100)	
			item.left = obj.offsetLeft + 170;
		else
			item.left = obj.offsetLeft + 110;		
	else
		item.left = obj.offsetLeft;	
	show(obj, eval('m' + catid));

}

function mostraMenu2(obj, catid)
{
	var item;
	item = eval('m' + catid + '.style');
	item.top = window.event.y+document.body.scrollTop - 20 + 'px';
	if (isNav)
		show(obj, eval('s' + catid));
	if (isIE)
		show(obj, eval('m' + catid));
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  popup=open(theURL,winName,features);
//  popup.moveTo(screen.width/2 - 250, screen.height/2-250); 
}
