//<![CDATA[ 
function check(box, cbi){
    var cb=document.getElementById('v'+box);
    var bold=cb.parentNode.parentNode.previousSibling;
    
    if(cb.checked==false){
        cb.checked=true ; 
        sum(cb);
        
    }
    // 
    var ti=document.getElementById('totalInt'); 
    if(cbi.checked==true)ti.value++; 
    else ti.value--; 
    if(ti.value<0)ti.value=0;
} 
function sum(cb){  
    var tv=document.getElementById('totalVis');
    var bold=cb.parentNode.parentNode.previousSibling; 
    if (document.getElementById('lances'))var bold=cb.parentNode.previousSibling.getElementsByTagName('label')[0];
    if(cb.checked==true){
    		tv.value++; 
    		bold.className='checked';
    }else{
    		bold.className='';
    		tv.value--; 
    		if(tv.value<0)tv.value=0;
    }		
} 
 
function list (n){ 
    var dd=document.getElementById('c'+n); 
    //$toggle('c'+n);
    if (dd.style.display=='block')dd.style.display='none'; 
    else dd.style.display='block'; 
} 
function toggle(is_checked){ 
    var button=document.getElementById('aceito'); 
    if(is_checked)button.style.visibility='visible'; 
    else button.style.visibility='hidden'; 
}
 
var hasFlash = function(){ 
 
	var nRequiredVersion = 6;	 
	 
	if(navigator.appVersion.indexOf("MSIE") != -1 && navigator.appVersion.indexOf("Windows") > -1){ 
		document.write('<script language="VBScript"\> \n'); 
		document.write('on error resume next \n'); 
		document.write('hasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & ' + nRequiredVersion + '))) \n');   
		document.write('<'+'/script\> \n'); 
		/*	If executed, the VBScript above checks for Flash and sets the hasFlash variable.  
			If VBScript is not supported it's value will still be undefined, so we'll run it though another test 
			This will make sure even Opera identified as IE will be tested */ 
		if(window.hasFlash != null){ 
			return window.hasFlash; 
		}; 
	}; 
	 
	if(navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){ 
		var flashDescription = (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description; 
		var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1)); 
		return flashVersion >= nRequiredVersion; 
	}; 
	 
	return false; 
}(); 
 
function swfObject (swf,fv,w,h){ 
	var swfCODE; 
	swfCODE  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/	shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+w+'" height="'+h+'">'; 
	swfCODE += '	<param name="movie" value="'+swf+'" />'; 
	swfCODE += '	<param name="flashvars" value="'+fv+'" /><param name="wmode" value="transparent">'; 
	swfCODE += '	<embed src="'+swf+'" flashvars="'+fv+'" width="'+w+'" height="'+h+'" wmode="transparent" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" />'; 
	swfCODE += '<'+'/object>'; 
	return swfCODE; 
}       
 
function random(n){ 
    var ranNum= Math.round(Math.random()*(n-1)); 
    return ranNum; 
} 
function writeLayer(text,id){ 
    if(document.getElementById){ 
	   x = document.getElementById(id); 
	   x.innerHTML = text; 
	   //	if(window.navigator.appName == 'Netscape') 
	   //  window.sizeToContent();	 
    }else if(document.all){ 
	   x = document.all[id]; 
	   x.innerHTML = text; 
    }else if(document.layers){ 
	   x = document.layers[id]; 
	   x.document.open(); 
	   x.document.write(text); 
	   x.document.close(); 
    } 
} 
function openWin(path,winW,winH) { 
	var iMyWidth; 
	var iMyHeight; 
    iMyWidth = (window.screen.width/2) - ((winW/2)+ 10);  
	iMyHeight = (window.screen.height/2) - ((winH/2) + 50);  
	var win2 = window.open(path,"","status,toolbar=0,height="+winH+",width="+winW+",resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes"); 
    win2.opener=window; 
    win2.focus(); 
    return false;
} 
function isValidEmailAddress(addr) { 
    var re; 
    re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/; 
    if (re.test(addr) == true) 
       return true; 
    else 
      return false; 
} 
function validate(lang){ 
    var f= document.forms[0]; 
    if(isValidEmailAddress(f.email.value)  
    && f.nome.value.length>0   
    && f.cidade.value.length>0   
    && f.pais.value.length>0 ) 
    f.submit(); 
    else {
    	if(lang=='pt')alert('Formulário incompleto.'); 
    	else alert('Form Incomplete.');
    	return false;
    } 
} 
 
function aMod_externalLink(){   
    var as,i,islink; 
    // grab all links, and loop over them 
    as=document.getElementsByTagName('a'); 
    for(i=0;i<as.length;i++){ 
        // take the link's href 
        islink=as[i].href;  
        // and check if it contains the current location  
        var host = new String(window.location.hostname); 
        rExp = /www./gi; 
        domain = host.replace(rExp, ""); 
 	
 	 var hosts = new Array('viajologia.com.br','travelology.net');
 	  
        if(islink.indexOf(domain)==-1 
        && islink.indexOf(hosts[0])==-1 
        && islink.indexOf(hosts[1])==-1 
        && islink.indexOf('javascript:')==-1)
        { 
            if(!as[i].getAttribute('title'))as[i].setAttribute('title',islink); 
            as[i].setAttribute("target","_blank");  
        }  
    } 
} 
function imgMod_align(){ 
    var img = document.getElementsByTagName('img'); 
    for(i=0;i<img.length;i++){ 
        var attr = img[i].getAttribute('align'); 
        if(attr){ 
            if(attr=="left"){ 
                if(!img[i].className) img[i].className = 'alignLeft';  
                else img[i].className += ' alignLeft'; 
            }else if(attr=="right"){ 
                if(!img[i].className) img[i].className = 'alignRight';  
                else img[i].className += ' alignRight'; 
            }     
        } 
    } 
} 
///////////////////////////////// SCRIPTS ////////////////////////////////////// 
 
if(document.getElementById && document.createTextNode){ 
    window.onload=function (){
    	imgMod_align();
    	aMod_externalLink();
    } 
}

///////////////////////////////// AJAX /////////////////////////////////////////
function getHTTPObject() { var xmlhttp; /*@cc_on @if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @else xmlhttp = false; @end @*/  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; } } return xmlhttp; 
} var http = getHTTPObject(); // We create the HTTP Object 


function handleHttpResponse() {
    if (http.readyState == 4) {
	results = http.responseText.split("|"); 
	//alert(http.responseText);
	if(results.length<3)return;
	var nom=document.getElementById("nome");
	if(!nom.value) nom.value = unescape(results[0]);
	var cid=document.getElementById("cidade");
	if(!cid.value)cid.value =  unescape( results[1]);
	var pai=document.getElementById("pais");
	if(!pai.value)pai.value =  unescape(results[2]);
    } 
}
var url = "?pg=checkUser"; 
function checkUser(area) {
	var emailValue = document.getElementById("email").value; 
	if(isValidEmailAddress(emailValue)){
		http.open("GET", url+'&testeTipo='+area+'&email='+ escape(emailValue), true); 
		http.onreadystatechange = handleHttpResponse; 
		http.send(null);
	}	
} 

try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

//]]> 
 
