/* VARIAVEIS DE SCROLL UP e DOWN */
var speed=50;
var speed2=30;
var loop, timer; 

/* VARIAVEIS DE AUTO-SCROLL */
var lstart=60; 
var ASloop=true;
var ASspeed=100; 
var pr_step=1;

var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1); 

var bg;
var url;
var offsetX;
var offsetY;
var bw;

// preload das imagens
bg = new Image; 
bg.scr = "img/btn_mais.jpg";

// (C) 2001 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this  header

// set the page to go to...
url = "https://ssl221.locaweb.com.br/tudosobreplantas/default.asp";

// set how fast to expand horizontally
// lower is slower
var speedX = 12;

// set how fast to expand vertically
// lower is slower
var speedY = 7; 

// set background color of "Loading..." screen
var bgColor = "#000000";

// set text color of "Loading..." screen
var txtColor = "#FFFFFF";


// do not edit below this line
// ---------------------------

if (document.all){
var wide = window.screen.availWidth;
var high = window.screen.availHeight;
}

function andBoom(){
  if (document.all){
    var Boomer = window.open("","TSP","fullscreen");
	 
	 Boomer.document.write('<HTML><BODY BGCOLOR=\''+bgColor+'\' SCROLL=\'NO\'><FONT FACE=ARIAL COLOR='+txtColor+'>Carregando TSP v 3.0.. Aguarde...<BR><BR>:: conexão 100% segura - SSL<BR>:: acesso gratuito<BR>:: banco de plantas<BR>:: banco de imagens<br><br><br>Problemas ("bugs") conhecidos:<br><br>:: pop em layer; funciona somente no Internet Explorer;<br>:: ASP / MS Access ;o)<br><br><br>Estamos providanciando a migração do sistema para PHP/MySQL, com a ajuda de colaboradores. Necessitamos de ajuda.</FONT></BODY></HTML>');
    Boomer.focus();
    for (H=1; H<high; H+= speedY){
         Boomer.resizeTo(1,H);
    }
    for (W=1; W<wide; W+= speedX){
         Boomer.resizeTo(W,H);
    }
    Boomer.location = url;
  }  
  else {
    window.open(url,"TSP","");
  }
}

var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = 0;
offsetY = 20;
var toolTipSTYLE="";

function initToolTips(){

  if(ns4||ns6||ie4){

    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
    }
    document.onmousemove = moveToMouseLoc;
  }
}

function toolTip(msg, fg, bg) {
	// if(toolTip.arguments.length < 1)
	if(toolTip.arguments.length < 1) // hide
  {
    if(ns4) 
			toolTipSTYLE.visibility = "hidden";
    else 
			toolTipSTYLE.display = "none";
  }
  else // show
  {
    if(!fg) fg = "#777777";
    if(!bg) bg = "#FFFFFF";
    var content =
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + fg + '"><td>' +
    '<table border="0" cellspacing="1" cellpadding="1" bgcolor="' + bg + 
    '"><td align="center"><font face="sans-serif" color="' + fg +
    '" size="-2">&nbsp\;' + msg +
    '&nbsp\;</font></td></table></td></table>';

		if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
		if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'
    }
  }
}

function moveToMouseLoc(e) {
	var x,y;

  if(ns4||ns6)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else
  {
    x = event.x + document.body.scrollLeft;
    y = event.y + document.body.scrollTop;
  }
  toolTipSTYLE.left = x + offsetX;
  toolTipSTYLE.top = y + offsetY;
  return true;
}

function printPage(frame, arg) {
  if (frame == window) {
    printThis();
  } else {
    link = arg; // a global variable 
    printFrame(frame);
  }
  return false;
}

function printThis() {
  if (pr) { // NS4, IE5
    window.print();
  } else if (da && !mac) { // IE4 (Windows)
    vbPrintPage();
  } else { // other browsers
    alert("Sorry, your browser doesn't support this feature.");
  }
}

function printFrame(frame) {
  if (pr && da) { // IE5
    frame.focus();
    window.print();
    link.focus();
  } else if (pr) { // NS4
    frame.print();
  } else if (da && !mac) { // IE4 (Windows)
    frame.focus();
    setTimeout("vbPrintPage(); link.focus();", 100);
  } else { // other browsers
    alert("Sorry, your browser doesn't support this feature.");
  }
}

if (da && !pr && !mac) with (document) {
  writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
  writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
  writeln('Sub window_onunload');
  writeln('  On Error Resume Next');
  writeln('  Set WB = nothing');
  writeln('End Sub');
  writeln('Sub vbPrintPage');
  writeln('  OLECMDID_PRINT = 6');
  writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
  writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
  writeln('  On Error Resume Next');
  writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
  writeln('End Sub');
  writeln('<' + '/SCRIPT>');
}

function verifyCompatibleBrowser(){ 
	this.ver=navigator.appVersion;
	this.dom=document.getElementById?1:0;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
	this.ie4=(document.all && !this.dom)?1:0; 
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0; 
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5);
	return this 
} 
bw=new verifyCompatibleBrowser() 

/* Construtor de objeto janela */
function ConstructObject(obj,nest){ 
	nest=(!nest) ? '':'document.'+nest+'.';
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight;
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight;
	this.up=MoveAreaUp;this.down=MoveAreaDown;
	this.MoveArea=MoveArea; 
	// this.x; this.y;
	this.obj = obj + "Object";
	eval(this.obj + "=this");
	return this 
} 

/* Construtor de objeto janela AS */
function ConstructASObject(obj,nest){ 
	nest=(!nest) ? '':'document.'+nest+'.'; 
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight;
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight;
	this.newsScroll=newsScroll; 
	this.moveIt=b_moveIt;
	// this.x; this.y; 
	this.obj = obj + "Object";
	eval(this.obj + "=this");
	return this 
}

/* Construtor de objeto janela AS2 */
function ConstructAS2Object(obj,nest){ 
	nest=(!nest) ? '':'document.'+nest+'.'; 
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight;
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight;
	this.newsScroll=newsScroll; 
	this.moveIt=b_moveIt; 
	// this.x; this.y; 
	this.obj = obj + "Object";
	eval(this.obj + "=this");
	return this 
}

function b_moveIt(x,y){ 
		this.x=x;this.y=y;
		this.css.left=this.x;
		this.css.top=this.y 
} 

function MoveArea(x,y){ 
    this.x=x;this.y=y;
    this.css.left=this.x;
    this.css.top=this.y
} 

/* Makes the AS object scroll up*/
function newsScroll(ASspeed){ 
	if(this.y>-this.scrollHeight){ 
		this.moveIt(0,this.y-pr_step);
		setTimeout(this.obj+".newsScroll("+ASspeed+")",ASspeed) 
	}else if(ASloop) { 
		this.moveIt(0,lstart);
		eval(this.obj+".newsScroll("+ASspeed+")") 
	} 
}
 
function MoveAreaDown(move){ 
	if(this.y>-this.scrollHeight+objContainer.clipHeight){ 
    this.MoveArea(0,this.y-move); 
    if(loop) setTimeout(this.obj+".down("+move+")",speed) 
	} 
} 

function MoveAreaUp(move){ 
	if(this.y<0){ 
    this.MoveArea(0,this.y-move); 
    if(loop) setTimeout(this.obj+".up("+move+")",speed) 
	} 
} 
 
function PerformScroll(speed){ 
	if(initialised){ 
		loop=true; 
		if(speed>0) objScroller.down(speed) 
		else objScroller.up(speed) 
	} 
} 
 
function CeaseScroll(){ 
    loop=false;
    if(timer) clearTimeout(timer)
} 
	
/*CRIA O OBJETO JANELA*/
var initialised; 
function InitialiseScrollableArea(){ 
    objContainer=new ConstructObject('divContainer');
    objScroller=new ConstructObject('divContent','divContainer');
    objScroller.MoveArea(0,0);
    objContainer.css.visibility='visible';
    initialised=true; 
} 

/*CRIA O OBJETO AS*/
function InitialiseAutoScrollArea(){ 
		objContainerAS=new ConstructASObject('divASContainer');
		objContentAS=new ConstructASObject('divASContent','divASContainer');
		objContentAS.moveIt(0,lstart);
		objContainerAS.css.visibility='visible';
		objContentAS.newsScroll(speed);
}

/*CRIA O OBJETO AS2*/
function InitialiseAutoScrollArea2(){ 
		objContainerAS2=new ConstructAS2Object('divASContainer2');
		objContentAS2=new ConstructAS2Object('divASContent2','divASContainer2');
		objContentAS2.moveIt(0,lstart);
		objContainerAS2.css.visibility='visible';
		objContentAS2.newsScroll(speed2);
}

/*POP-UP JANELA */
function popUp(URL,pop_width,pop_height) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+pop_width+",height="+pop_height+"');")
}

/*POP-UP JANELA NAVEGACAO */
function popUp2(URL,pop_width,pop_height) {
	var winl = (screen.width - pop_width) / 2;
	var wint = (screen.height - pop_height) / 2;
	win=window.open(URL,"preview","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+pop_width+",height="+pop_height+',top='+wint+',left='+winl);
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

<!-- Begin
function CaricaFoto(img){
  foto1= new Image();
  foto1.src=(img);
  Controlla(img);
}
function Controlla(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
  }
  else{
    funzione="Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewFoto(img){
  largh=foto1.width+20;
  altez=foto1.height+20;
  stringa="width="+largh+",height="+altez;
  finestra=window.open(img,"",stringa);
}
//  End -->

/*VALIDACAO DE FORM */

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.
  selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); 
return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); 
  if (selObj) MM_jumpMenu(targ,selObj,restore);
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+=':: '+nm+' deve conter seu endereço eletrônico (email).\n';
      }
			else if (test!='R') {
        if (isNaN(val)) errors+=':: '+nm+' deve ser preenchido somente com números.\n';
		  if (window.document.cad_sos.estado.selectedIndex < 0) errors+=':: Estado deve ser preenchido.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+=':: '+nm+' deve conter um número entre '+min+' e '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += ':: '+nm+' é necessario.\n'; }
  } if (errors) alert('Os seguintes campos precisam ser preenchidos:\n\n'+errors);
  document.MM_returnValue = (errors == '');
}

function stringToLowercase(inputString) {
  return inputString.toLowerCase();
}

function randomNumber(limit){
	// if(limit <> "") {
		return Math.floor(Math.random()*limit);
	//	} 
}



function findObj(theObj, theDoc) {
	// Example: obj = findObj("image1");
  var p, i, foundObj;

  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length) {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }

  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];

  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];

  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);

  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);

  return foundObj;
}

// * Dependencies * 

// this function requires the following snippets:

// JavaScript/readable_MM_functions/findObj

//

// Accepts a variable number of arguments, in triplets as follows:

// arg 1: simple name of a layer object, such as "Layer1"
// arg 2: ignored (for backward compatibility)
// arg 3: 'hide' or 'show'
// repeat...

//

// Example: showHideLayers(Layer1,'','show',Layer2,'','hide');

function showHideLayers() { 
  var i, visStr, obj, args = showHideLayers.arguments;

  for (i=0; i<(args.length-2); i+=3)
  {
    if ((obj = findObj(args[i])) != null) {
      visStr = args[i+2];
      if (obj.style) {
        obj = obj.style;
        if(visStr == 'show') visStr = 'visible';
        else if(visStr == 'hide') visStr = 'hidden';
      }
      obj.visibility = visStr;
    }
  }
}

// -----------------------------------------------------------------------
// ==================[     VALIDACAO DE FORMULARIOS     ]=================
// -----------------------------------------------------------------------

function validaForm() { // v2.0
	var errors = "";
	
	//if (window.document.cad_sos.cep.indexOf("-") == -1) {
	// errors+=':: CEP com hífen:.\n'; window.document.cad_sos.cep.focus();
	// }
	if (window.document.cad_sos.opc_ass.checked == false) {
		errors+=':: MODALIDADE DE ASSINATURA :.\n'; 
		}

	if (window.document.cad_sos.deacordo.checked == false) {
		errors+=':: DE ACORDO :.\n'; 
		}

	//	if (window.document.cad_sos.senha2.value == "") {
	//	errors+=':: CONFIRMAR SENHA :.\n'; window.document.cad_sos.senha2.focus();
	//		}

	//	if (window.document.cad_sos.senha.value == "") {
	//	errors+=':: SENHA .\n'; window.document.cad_sos.senha.focus();
	//	}
	
	// if (window.document.cad_sos.senha.value != window.document.cad_sos.senha2.value) errors+=':: Senha digitada não confere.\n';
	
	if (window.document.cad_sos.login.value == "") {
		errors+=':: LOGIN :.\n'; window.document.cad_sos.login.focus();
		}

	// if (window.document.cad_sos.telres.value == "") {
	// 	errors+=':: TELEFONE residencial :.\n'; window.document.cad_sos.telres.focus();
	// }

	if (window.document.cad_sos.ddd.value == "") {
		errors+=':: DDD :.\n'; window.document.cad_sos.ddd.focus();
		}

	// if (window.document.cad_sos.cep.value == "") {
	//	errors+=':: CEP :.\n'; window.document.cad_sos.cep.focus();
	//	}
	// else if (TemEspeciais(window.document.cad_sos.cep.value)) {
	//		errors+=':: CEP com caracteres invalidos :.\n'; window.document.cad_sos.cep.focus();
	//	}	

	if (window.document.cad_sos.estado.selectedIndex <= 0) {
		errors+=':: ESTADO :.\n'; window.document.cad_sos.estado.focus();	
		}

	if (window.document.cad_sos.cidade.value == "") {
		errors+=':: CIDADE :.\n'; window.document.cad_sos.cidade.focus();
		}

	if (window.document.cad_sos.numero.value == "") {
		errors+=':: N&Uacute;MERO :.\n'; window.document.cad_sos.numero.focus();
		}

	if (window.document.cad_sos.end.value == "") {
		errors+=':: ENDERE&Ccedil;O :.\n'; window.document.cad_sos.end.focus();
		}

	if (window.document.cad_sos.vcpf.value == "") {
		errors+=':: CPF :.\n'; window.document.cad_sos.vcpf.focus();
		}
	else if (TemEspeciais(window.document.cad_sos.vcpf.value)) {
			errors+=':: CPF com caracteres invalidos :.\n'; window.document.cad_sos.vcpf.focus();
		}	
	else if (!validaCPF(window.document.cad_sos.vcpf.value)) {
			errors+=':: CPF invalido :.\n'; window.document.cad_sos.vcpf.focus();
		}

	if (window.document.cad_sos.dt_nasc.value == "") {
		errors+=':: DATA DE NASCIMENTO (DD/MM/AAAA) :.\n'; window.document.cad_sos.dt_nasc.focus();
	} else if (!validaData(window.document.cad_sos.dt_nasc.value)) {
	 	errors+=':: Data de nascimento com problemas:.\n'; window.document.cad_sos.dt_nasc.focus();
		}

	if (window.document.cad_sos.email.value == "") {
		errors+=':: EMAIL :.\n'; window.document.cad_sos.email.focus();
	} else if (!validaEmail(window.document.cad_sos.email.value)) {
		errors+=':: EMAIL invalido:.\n'; window.document.cad_sos.email.focus();
		}

	if (window.document.cad_sos.nome.value == "") {
	 errors+=':: NOME :.\n'; window.document.cad_sos.nome.focus(); 
	}
	
	if (errors == "") {
		return true;
	} else {
		erros = "Voce deve preencher e corretamente \nos seguintes campos do formulario:\n\n" + errors; alert(erros);
		return false;
	}
}

function validaFormLinks() { //v1.0
	var errors = "";
	
	if (window.document.cad_links.info.value == "") errors+=':: DESCRI&Ccedil;&Atilde;O :.\n'; window.document.cad_links.info.focus();
	
	if (window.document.cad_links.cat1.selectedIndex <= 0) errors+=':: CATEGORIA 1 :.\n'; window.document.cad_links.cat1.focus();
	
	if (window.document.cad_links.tipo_link.selectedIndex <= 0) errors+=':: TIPO DE LINK :.\n'; window.document.cad_links.tipo_link.focus();

	if (window.document.cad_links.url.value == "") errors+=':: URL :.\n'; window.document.cad_links.url.focus();

	if (window.document.cad_links.email.value == "") {
		errors+=':: EMAIL RESP. :.\n'; window.document.cad_links.email.focus();
	} else if (!validaEmail(window.document.cad_links.email.value)) errors+=':: EMAIL invalido:.\n'; window.document.cad_links.email.focus();

	if (window.document.cad_links.nome.value == "") errors+=':: NOME RESP. :.\n'; window.document.cad_links.nome.focus();

	if (window.document.cad_links.titulo.value == "") errors+=':: TITULO :.\n'; window.document.cad_links.titulo.focus();

	if (errors == "") {
		return true;
	} else {
		erros = "Voc&ecirc; deve preencher corretamente \nos seguintes campos do formulario:\n\n" + errors; alert(erros);
		return false;
	}
}

function validaFormEmailU() { //v1.0
	var errors = "";
	
	if (window.document.faleconosco.texto.value == "") errors+=':: TEXTO DA MENSAGEM :.\n'; window.document.faleconosco.texto.focus();
	
	if (window.document.faleconosco.assunto.value == "") errors+=':: ASSUNTO :.\n'; window.document.faleconosco.assunto.focus();

	if (errors == "") {
		return true;
	} else {
		erros = "Voc&ecirc; deve preencher corretamente \nos seguintes campos do formulario:\n\n" + errors; alert(erros);
		return false;
	}
}

function validaFormEmailV() { //v1.0
	var errors = "";

	if (window.document.faleconosco.texto.value == "") errors+=':: TEXTO DA MENSAGEM :.\n'; window.document.faleconosco.texto.focus();
	
	if (window.document.faleconosco.email.value == "") {
		errors+=':: EMAIL :.\n'; window.document.faleconosco.email.focus();
	} else if (!validaEmail(window.document.faleconosco.email.value)) errors+=':: EMAIL invalido:.\n'; window.document.faleconosco.email.focus();

	if (window.document.faleconosco.nome.value == "") errors+=':: NOME :.\n'; window.document.faleconosco.nome.focus();	
	
	if (window.document.faleconosco.assunto.value == "") errors+=':: ASSUNTO :.\n'; window.document.faleconosco.assunto.focus();	

	if (errors == "") {
		return true;
	} else {
		erros = "Voc&ecirc; deve preencher corretamente \nos seguintes campos do formulario:\n\n" + errors; alert(erros);
		return false;
	}
}

function validaFormComentarios() { //v1.0
	var errors = "";

	if (window.document.comentarios.texto.value == "") errors+=':: TEXTO DA MENSAGEM :.\n'; window.document.comentarios.texto.focus();
	
	if (window.document.comentarios.estado.selectedIndex <= 0) {
		errors+=':: ESTADO :.\n'; window.document.comentarios.estado.focus();	
		}

	if (window.document.comentarios.cidade.value == "") errors+=':: CIDADE :.\n'; window.document.comentarios.cidade.focus();

	if (window.document.comentarios.email.value == "") {
		errors+=':: EMAIL :.\n'; window.document.comentarios.email.focus();
	} else if (!validaEmail(window.document.comentarios.email.value)) errors+=':: EMAIL invalido:.\n'; window.document.comentarios.email.focus();

	if (window.document.comentarios.nome.value == "") errors+=':: NOME :.\n'; window.document.comentarios.nome.focus();	
	
	if (window.document.comentarios.assunto.value == "") errors+=':: ASSUNTO :.\n'; window.document.comentarios.assunto.focus();	

	if (errors == "") {
		return true;
	} else {
		erros = "Voce deve preencher corretamente \nos seguintes campos do formulario:\n\n" + errors; alert(erros);
		return false;
	}
}

function validaFormEmp() { //v1.0
	var errors = "";
	
	//if (window.document.cad_emp.cep.indexOf("-") == -1) errors+=':: CEP com hífen:.\n'; window.document.cad_emp.cep.focus();
	
	if (window.document.cad_emp.de_acordo.checked == false) {
		errors+=':: DE ACORDO :.\n'; 
		}

	if (window.document.cad_emp.info.value == "") {
		errors+=':: AN&Uacute;NCIO :.\n'; window.document.cad_emp.info.focus();
		}

	if (window.document.cad_emp.cat1.selectedIndex <= 0) errors+=':: CATEGORIA 1 :.\n'; window.document.cad_emp.cat1.focus();

	//if (window.document.cad_emp.senha2.value == "") {
	//	errors+=':: CONFIRMAR SENHA :.\n'; window.document.cad_emp.senha2.focus();
	//	}

	//if (window.document.cad_emp.senha.value == "") {
	//	errors+=':: SENHA .\n'; window.document.cad_emp.senha.focus();
	//	}
	
	//if (window.document.cad_emp.senha.value != window.document.cad_emp.senha2.value) errors+=':: Senha digitada não confere.\n';
	
	if (window.document.cad_emp.login.value == "") {
		errors+=':: LOGIN :.\n'; window.document.cad_emp.login.focus();
		}

	if (window.document.cad_emp.tel_com1.value == "") {
		errors+=':: TELEFONE COMERCIAL :.\n'; window.document.cad_emp.tel_com1.focus();
		}

	if (window.document.cad_emp.ddd_com.value == "") {
		errors+=':: DDD TEL. COMERCIAL:.\n'; window.document.cad_emp.ddd_com.focus();
		}

	if (window.document.cad_emp.cep.value == "") {
		errors+=':: CEP :.\n'; window.document.cad_emp.cep.focus();
		}

	if (window.document.cad_emp.estado.selectedIndex <= 0) {
		errors+=':: ESTADO :.\n'; window.document.cad_emp.estado.focus();	
		}

	if (window.document.cad_emp.cidade.value == "") {
		errors+=':: CIDADE :.\n'; window.document.cad_emp.cidade.focus();
		}

	if (window.document.cad_emp.end.value == "") {
		errors+=':: ENDERE&Ccedil;O :.\n'; window.document.cad_emp.end.focus();
		}

	if (window.document.cad_emp.nome_fan.value == "") {
		errors+=':: NOME FANTASIA :.\n'; window.document.cad_emp.nome_fan.focus();
		}

	if (window.document.cad_emp.razao_social.value == "") {
		errors+=':: RAZ&Atilde;O SOCIAL :.\n'; window.document.cad_emp.razao_social.focus();
		}

	if (window.document.cad_emp.tel_contato.value == "") {
		errors+=':: TELEFONE CONTATO :.\n'; window.document.cad_emp.tel_contato.focus();
		}

	if (window.document.cad_emp.ddd.value == "") {
		errors+=':: DDD CONTATO :.\n'; window.document.cad_emp.ddd.focus();
		}

	if (window.document.cad_emp.cpf.value == "") {
		errors+=':: CPF :.\n'; window.document.cad_emp.cpf.focus();
		}
	else if (TemEspeciais(window.document.cad_emp.cpf.value)) {
			errors+=':: CPF com caracteres invalidos :.\n'; window.document.cad_emp.cpf.focus();
		}		

	if (window.document.cad_emp.email.value != "") {
		if (!validaEmail(window.document.cad_emp.email.value)) {
		errors+=':: EMAIL invalido:.\n'; window.document.cad_emp.email.focus();
		}
	}

	if (window.document.cad_emp.nome.value == "") {
	 errors+=':: NOME :.\n'; window.document.cad_emp.nome.focus(); 
	}
	
	if (errors == "") {
		return true;
	} else {
		erros = "Voc&ecirc; deve preencher e corretamente \nos seguintes campos do formulario:\n\n" + errors; alert(erros);
		return false;
	}
}

function valida_pedido() { 
	var errors = "";
	
	if (window.document.frm_ped.id_plantas.selectedIndex <= 0) errors+=':: É necessario selecionar ao menos um pacote :.\n'; window.document.frm_ped.id_plantas.focus();

	if (errors == "") {
		return true;
	} else {
		erros = "Voc&ecirc; deve preencher corretamente \nos seguintes campos do formulario:\n\n" + errors; alert(erros);
		return false;
	}
}

function validaPedidosSoftware() { // v1.0
	var errors = "";
	
	//if (window.document.cad_sos.cep.indexOf("-") == -1) errors+=':: CEP com hífen:.\n'; 
	// window.document.cad_sos.cep.focus();
	
	//if (window.document.frm_ped_tsp.senha2.value == "") {
	//	errors+=':: CONFIRMAR SENHA :.\n'; window.document.frm_ped_tsp.senha2.focus();
	//	}

	//if (window.document.frm_ped_tsp.senha.value == "") {
	//	errors+=':: SENHA .\n'; window.document.frm_ped_tsp.senha.focus();
	//	}
	
	//if (window.document.frm_ped_tsp.senha.value != window.document.frm_ped_tsp.senha2.value) errors+=':: Senha digitada não confere.\n';
	
	if (window.document.frm_ped_tsp.login.value == "") {
		errors+=':: LOGIN :.\n'; window.document.frm_ped_tsp.login.focus();
		}

	if (window.document.frm_ped_tsp.telres.value == "") {
		errors+=':: TELEFONE residencial :.\n'; window.document.frm_ped_tsp.telres.focus();
		}

	if (window.document.frm_ped_tsp.ddd.value == "") {
		errors+=':: DDD :.\n'; window.document.frm_ped_tsp.ddd.focus();
		}

	if (window.document.frm_ped_tsp.cep.value == "") {
		errors+=':: CEP :.\n'; window.document.frm_ped_tsp.cep.focus();
		}

	if (window.document.frm_ped_tsp.estado.selectedIndex <= 0) {
		errors+=':: ESTADO :.\n'; window.document.frm_ped_tsp.estado.focus();	
		}

	if (window.document.frm_ped_tsp.cidade.value == "") {
		errors+=':: CIDADE :.\n'; window.document.frm_ped_tsp.cidade.focus();
		}

	if (window.document.frm_ped_tsp.numero.value == "") {
		errors+=':: N&Uacute;MERO :.\n'; window.document.frm_ped_tsp.numero.focus();
		}

	if (window.document.frm_ped_tsp.end.value == "") {
		errors+=':: ENDEREÇO :.\n'; window.document.frm_ped_tsp.end.focus();
		}

	if (window.document.frm_ped_tsp.numcpf.value == "") {
		errors+=':: CPF :.\n'; window.document.frm_ped_tsp.numcpf.focus();
		}

	if (window.document.frm_ped_tsp.dt_nasc.value == "") {
		errors+=':: DATA DE NASCIMENTO (DD/MM/AAAA) :.\n'; window.document.frm_ped_tsp.dt_nasc.focus();
	} else if (!validaData(window.document.frm_ped_tsp.dt_nasc.value)) {
	 	errors+=':: Data de nascimento com problemas:.\n'; window.document.frm_ped_tsp.dt_nasc.focus();
		}
		
	// if (window.document.frm_ped_tsp.email.value == window.document.frm_ped_tsp.email2.value) errors+=':: Emails iguais.\n';

	if (window.document.frm_ped_tsp.email.value == "") {
		errors+=':: EMAIL :.\n'; window.document.frm_ped_tsp.email.focus();
	} else if (!validaEmail(window.document.frm_ped_tsp.email.value)) {
		errors+=':: EMAIL invalido:.\n'; window.document.frm_ped_tsp.email.focus();
		}

	if (window.document.frm_ped_tsp.nome.value == "") {
	 errors+=':: NOME :.\n'; window.document.frm_ped_tsp.nome.focus(); 
	}
	
	if (errors == "") {
		return true;
	} else {
		erros = "Voc&ecirc; deve preencher e corretamente \nos seguintes campos do formulario:\n\n" + errors; alert(erros);
		return false;
	}
}

function validaAssinatura() { //v1.0
	var errors = "";
	
	// ASSINATURAS
	
	if (window.document.cad_ass.nome.value == "") errors+=':: NOME :.\n'; window.document.cad_ass.nome.focus();
	
	if (window.document.cad_ass.cidade.value == "") errors+=':: CIDADE :.\n'; window.document.cad_ass.cidade.focus();
	
	if (window.document.cad_ass.estado.selectedIndex <= 0) errors+=':: UF (ESTADO) :.\n'; window.document.cad_ass.estado.focus();
	
	if (window.document.cad_ass.cpf_cnpj.value == "") {
		errors+=':: CPF ou CNPJ :.\n'; window.document.cad_ass.cpf_cnpj.focus();
		}
	else if (TemEspeciais(window.document.cad_ass.cpf_cnpj.value)) {
			errors+=':: CPF ou CNPJ com caracteres invalidos :.\n'; window.document.cad_ass.cpf_cnpj.focus();
		}
	
	if (window.document.cad_ass.rg.value == "") {
		errors+=':: RG :.\n'; window.document.cad_ass.rg.focus();
		}
	else if (TemEspeciais(window.document.cad_ass.rg.value)) {
			errors+=':: RG com caracteres invalidos :.\n'; window.document.cad_ass.rg.focus();
		}
		
	if (window.document.cad_ass.inst_exp.value == "") errors+=':: Órg. Expedidor :.\n'; window.document.cad_ass.inst_exp.focus();

	if (window.document.cad_ass.email.value == "") { 
		errors+=':: EMAIL :.\n'; window.document.cad_ass.email.focus();
		} 
	else if (!validaEmail(window.document.cad_ass.email.value)) { 
			errors+=':: EMAIL com problemas:.\n'; window.document.cad_ass.email.focus();
		}

	// SEM ERROS ?
	
	if (errors == "") 
	{
		window.document.cad_ass.action.disabled = true;
		//window.document.cad_ass.submit();
		return true;
	} else {
		erros = "Voc&ecirc; deve preencher corretamente \nos seguintes campos do formulario:\n\n" + errors; alert(erros);
		return false
	}
}

function validaFormLogin() { //v1.0
	var errors = "";

	if (window.document.login.PASSWORD.value == "") errors+=':: SENHA :.\n'; window.document.login.PASSWORD.focus();
	
	if (window.document.login.USERNAME.value == "") errors+=':: IDENTIFICA&Ccedil;&Atilde;O DE USUaRIO :.\n'; window.document.login.USERNAME.focus();
	
	if (errors == "") {
		return true;
	} else {
		erros = "Voc&ecirc; deve preencher corretamente \nos seguintes campos do formulario:\n\n" + errors; alert(erros);
		return false;
	}
}

function filtra(texto) {
	var a = 0;
	var ant = -1;
	var msg = "";
	var conta = 0;
	var saida = "";
	for(i=0; i < texto.length; i++)
		{
			if(texto.charAt(i) != "'") 
				saida = saida + texto.charAt(i);
		}		
	return saida;
}

function testaNumero(campo) {
	var i,c;
	for ( var i=0; i<=campo.length-1; i++ ) {  
		var c = campo.charAt(i); 
		if( ! ((c>="0")&&(c<="9")) ) return false; 
		
	}
	return true;
}

function validaEmail(mail) {
	if(mail == ""){
		return false;
	}
	if(mail.indexOf("@")== -1){ 
		return false;
	}
	if(mail.indexOf(".")== -1){
		return false;
	}
	if(mail.length < 10){
		return false;
	}
	if(mail.indexOf("/")!= -1){
		return false;
	}
	if(mail.indexOf(";")!= -1){
		return false;
	}
	if(mail.indexOf(":")!= -1){
		return false;
	}
	return true;
}

function validaReqEmail() { //v1.0
	var errors = "";
	
	if (window.document.frm_senha.email.value == "") {
		errors+=':: EMAIL :.\n'; window.document.frm_senha.email.focus();
	} else if (!validaEmail(window.document.frm_senha.email.value)) errors+=':: EMAIL invalido:.\n'; window.document.frm_senha.email.focus();
	
	if (errors == "") {
		return true;
	} else {
		erros = "Voc&ecirc; deve preencher corretamente \nos seguintes campos do formulario:\n\n" + errors; alert(erros);
		return false;
	}
}

function validaCPF(s) {
	var varFirstChr = s.charAt(0); 
	var vaCharCPF = false;
	var digito_verificador, soma;
	
	for ( var i=0; i<=10; i++ ) {  
		var c = s.charAt(i); 
		if( ! (c>="0")&&(c<="9") ) return false; 
		if( c!=varFirstChr ) vaCharCPF = true;  
	}  
	if( ! vaCharCPF ) return false; 
	soma=0; 
	for ( i=0; i<9; i++ ) soma += (10-i) * ( eval(s.charAt(i)) );  
	digito_verificador = 11-(soma % 11); 
	if ( (soma % 11) < 2 ) digito_verificador = 0; 
	if ( eval(s.charAt(9)) != digito_verificador ) return false;
	soma=0; 
	for ( i=0; i<9; i++ ) soma += (11-i) * ( eval(s.charAt(i)) );
	soma += 2 * ( eval(s.charAt(9)) ); 
	digito_verificador = 11-(soma % 11); 
	if ( (soma % 11) < 2 ) digito_verificador = 0; 
	if ( eval(s.charAt(10)) != digito_verificador ) return false;
	return true; 
}

function validaCPFs() 
{
   cpf = document.validacao.cpfID.value;
   erro = new String;
   if (cpf.length < 11) erro += "S&atildeo necessarios 11 digitos para verifica&ccedil;&atilde;o do CPF! ";
   var nonNumbers = /\D/;
   if (nonNumbers.test(cpf)) erro += "A verifica&ccedil;&atilde;o de CPF suporta apenas n&uacute;meros! ";
   if (cpf == "00000000000" || cpf == "11111111111" || cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" || cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" || cpf == "88888888888" || cpf == "99999999999"){
      erro += "N&uacute;mero de CPF invalido!"
   }
   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 +="D&iacute;gito verificador com problema!";
         }
         if (erro.length > 0){
            alert(erro);
            return false;
         }
            return true;
}

function validaData(data) 
{
	var array_data = data.split( "/");
	if (( array_data.length == 3) && 
		(array_data[0] > 0) && (array_data[0] < 32) &&
		(array_data[1] > 0) && (array_data[1] < 13) &&
		(array_data[2] >= 1900) && (array_data[2] < 2100))
	{	
		return true;
	} else {
		return false;
	}
} 

function validaSenha(campo)
{
	if( this.indexOf("\'") != -1)
		return false;
	if( this.indexOf("\"") != -1)
		return false;
	if(campo.indexOf("<") != -1)
		return false;
	if(campo.length < 4 || campo.length > 15)
		return false;
	if(campo != document.cad_sos.senha.value)
		return false;
	return true;
}

function tirahifem(campo){
	resultado = ""
	if(campo == "")
		return "";
	for(var i=0;i<campo.length;i++){
		if(campo.charAt(i) != "-" && campo.charAt(i) != "."){
			resultado = resultado + campo.charAt(i);
		    }
		}

	return resultado;
		
}

function tiraaspas(campo){
	resultado = ""
	if(campo == "")
		return "";
	for(var i=0;i<campo.length;i++){
		if(campo.charAt(i) == "\""){
			resultado = resultado + "*";
		}
		else{
			if(campo.charAt(i) == "\'"){
				resultado = resultado + "*";
			}
			else{
				if(campo.charAt(i) == "<") {
					resultado = resultado + "[";
				}
				else{
					resultado = resultado + campo.charAt(i);
				}
			}
		    }
		}
	return resultado;
		
}

function TemEspeciais(campo){
	if(campo.indexOf(" ") != -1)
		return true;
	if(campo.indexOf(",") != -1)
		return true;
	if(campo.indexOf(".") != -1)
		return true;
	if(campo.indexOf("-") != -1)
		return true;	
	if(campo.indexOf("_") != -1)
		return true;
	if(campo.indexOf(";") != -1)
		return true;
	if(campo.indexOf("/") != -1)
		return true;
	if(campo.indexOf(":") != -1)
		return true;
	if(campo.indexOf("=") != -1)
		return true;
	// ELSE
	return false;
}

<!--
var currentpage;
function changeIt()
{
	newpage = (currentpage-1) ? 1 : 2;
	return "iframe_page" + newpage + ".html";
}

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
		this.obj = document.all[name];
		this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

// To avoid DOM incompatibilities in IE4.

function init()
{
	contentFRM = new getObj('contentFRM').obj;
}

function init2()
{
	sosverde = new getObj('sosverde').obj;
}

// -->

function loadIframe(theURL) {
	this.document.getElementById("contentFRM").src = theURL;
}

function loadIF(theURL,theFrame) {
	this.document.getElementById(theFrame).src = theURL;
}

function NewWindow(mypage, myname, w, h, scrollb, vresizable) {
	var winl = ((screen.width - w) / 2) -20;
	var wint = ((screen.height - h) / 2) -25;
	var	winprops;
	var win;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scrollb+',resizable='+vresizable;
	win = window.open(mypage, myname, winprops);
	if (parseInt(navigator.appVersion) >= 4) {
		win.window.focus(); 
	}
}

function Pop_link(vlink,wdt,sbars) 
{
	NewWindow(vlink,'Amigos_do_Verde',wdt,'520','yes','no');
}

function Pop_link_nsbars(vlink,wdt,sbars) 
{
	NewWindow(vlink,'Amigos do Verde',wdt,'520','no','no');
}

<!-- 
// The JavaScript Source!! http://javascript.internet.com 
function shake(n) {
if (self.moveBy) {
	for (i = 2; i > 0; i--) {
		for (j = n; j > 0; j--) {
			self.moveBy(0,i);
			self.moveBy(i,0);
			self.moveBy(0,-i);
			self.moveBy(-i,0);
         }
      }
   }
}
// -->

function Checker(fd) {
	(fd.value.length>250) ? fd.value=fd.value.substring(0,250) : document.getElementById('sobra').childNodes[0].data=(250-fd.value.length);
}



// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//       DEALING WITH COOKIES
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



function SetCookie(cookieName,cookieValue,nDays) {
	var today = new Date();
	var expire = new Date();
	if (nDays==null || nDays==0) nDays=1;
	expire.setTime(today.getTime() + 3600000*24*nDays);
	document.cookie = cookieName+"="+escape(cookieValue)
					  + ";expires="+expire.toGMTString();
}


function ReadCookie(cookieName) {
	var theCookie=""+document.cookie;
	var ind=theCookie.indexOf(cookieName);
	if (ind==-1 || cookieName=="") return ""; 
	var ind1=theCookie.indexOf(';',ind);
	if (ind1==-1) ind1=theCookie.length; 
	return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}


function eraseCookie(name) {
	createCookie(name,"",-1);
}



// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//   WEBSERVICE .NET
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	
var NMHOST = "www.tudosobreplantas.com.br";       
var URLWEBSERVICE = "http://" + NMHOST + "tsp2/ws/wstsp.asmx"; 
var objXMLHttpRequest;


function NovoXMLHttpRequest()

{

	if(window.XMLHttpRequest) // Mozilla, Safari...

	{

		 objXMLHttpRequest = new XMLHttpRequest();

	}

	else if(window.ActiveXObject) // IE

	{

		 try

		 {

			  objXMLHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");

		 }

		 catch(e)

		 {

			  try

			  {

					objXMLHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");

			  }

			  catch(e){}

		 }

	}

}



function PlantadoDia()

{

	NovoXMLHttpRequest();



	objXMLHttpRequest.onreadystatechange = ProcessarResposta;

	objXMLHttpRequest.open("POST", URLWEBSERVICE, true);

	objXMLHttpRequest.setRequestHeader("SOAPAction", "http://www.tudosobreplantas.com.br/Planta_do_Dia");

	objXMLHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");

	objXMLHttpRequest.send(ValoresEnvio());

}



function ProcessarResposta()

{

	if(objXMLHttpRequest.readyState == 4)

	{

		 if(objXMLHttpRequest.status == 200)

		 {

			 var XMLDoc = objXMLHttpRequest.responseXML;

var Text = objXMLHttpRequest.responseText;

			 var myXML = XMLDoc.getElementsByTagName("Planta_do_DiaResult")[0].childNodes[0].nodeValue;

var doc = new ActiveXObject("MSXML2.DOMDocument");  
	  doc.loadXML(myXML); 

var xsl = new ActiveXObject("MSXML2.DOMDocument"); 
xsl.load("estilo.xsl");

			 document.getElementById("lblResultado").innerHTML = "<h4><u>Planta do Dia</u></h4>" + doc.transformNode(xsl);

		 }

	}

}



function ValoresEnvio()

{


	// vLogin = document.getElementById("Login").value;
	vLogin = ReadCookie('nome_login');

	// vSenha = document.getElementById("Senha").value;
	vSenha = ReadCookie('senha_login');

	

	return "<?xml version='1.0' encoding='utf-8'?>" +

			 "<soap:Envelope " +

			"xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +

				"xmlns:xsd='http://www.w3.org/2001/XMLSchema' " +

			"xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" +

			 "<soap:Body>" +

			 "<Planta_do_Dia xmlns='http://www.tudosobreplantas.com.br/'>" +

			"<Login>" + vLogin + "</Login>" +

			"<Senha>" + vSenha + "</Senha>" +

			 "</Planta_do_Dia>" +

			 "</soap:Body>" +

			 "</soap:Envelope>";

}

// Browser Window Size and Position
// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
// you may copy these functions but please keep the copyright notice as well
function pageWidth() {return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?       document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;} function pageHeight() {return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;} function posLeft() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;} function posTop() {return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;} function posRight() {return posLeft()+pageWidth();} function posBottom() {return posTop()+pageHeight();}
                    