function formValidation(){
	
	var d = document.contactForm;
	
	//verify if the name field is not empty
	if (d.name.value == ""){
		jAlert('YOU HAVE TO TYPE YOUR NAME!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.name.focus();
			}
		);
		return false;
	}	
	
	//verify if the e-mail field is not empty
	if (d.email.value == ""){
		jAlert('YOU HAVE TO TYPE YOUR E-MAIL!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.email.focus();
			}
		);
		return false;
	}	
	
	//verify if the message field is not empty
	if (d.msg.value == ""){
		jAlert('YOU HAVE TO TYPE A TEXT!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.msg.focus();
			}
		);
		return false;
	}	
	
	//verify if the e-mail in a valid e-mail
	var validacao;	
	var str = d.email.value;	
    var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
    if(filter.test(str)){
		
      validacao = true;
	  
	}else{
		jAlert('THIS IS NOT A VALID E-MAIL!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.email.focus();
			}
		);
      validacao = false;
	  
    }	
    return validacao;


	
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function valMaillingList(){
	
	var d = document.maillingList;
	
	//verify if the e-mail field is not empty
	if (d.email.value == ""){
		alert("YOU HAVE TO TYPE YOUR E-MAIL!");
		d.email.focus();
		return false;
	}	
	
	//verify if the e-mail in a valid e-mail
	var validacao;	
	var str = d.email.value;	
    var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
    if(filter.test(str)){
		
      validacao = true;
	  
	}else{
		
      alert("THIS IS NOT A VALID E-MAIL.");
      d.email.focus();
      validacao = false;
	  
    }	
    return validacao;


	
}


function newCustomer(){
	
	var d = document.newCostumerForm;
	
	if (d.billingFirstName.value == ""){
		jAlert('YOU HAVE TO TYPE YOUR FIRST NAME!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingFirstName.focus();
			}
		);
		return false;
	}
	
	if (d.billingSurname.value == ""){
		jAlert('YOU HAVE TO TYPE YOUR SURNAME!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingSurname.focus();
			}
		);
		return false;
	}
	
	if (d.billingAddress1.value == ""){
		jAlert('YOU HAVE TO TYPE YOUR ADDRESS!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingAddress1.focus();
			}
		);
		return false;
	}
	
	if (d.billingCity.value == ""){
		jAlert('YOU HAVE TO TYPE YOUR CITY!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingCity.focus();
			}
		);
		return false;
	}
	
	if (d.billingPostZipCode.value == ""){
		jAlert('YOU HAVE TO TYPE THE POSTCODE!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingPostZipCode.focus();
			}
		);
		return false;
	}
	
	if (d.billingCountry.value == ""){
		jAlert('YOU HAVE TO SELECT A COUNTRY!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingCountry.focus();
			}
		);
		return false;
	}
	
	if (d.billingPhone.value == ""){
		jAlert('YOU HAVE TO TYPE THE BILLING PHONE!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingPhone.focus();
			}
		);
		return false;
	}
	
	if (d.billingPassword.value == ""){
		jAlert('YOU HAVE TO TYPE THE PASSWORD!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingPassword.focus();
			}
		);
		return false;
	}
	
	//DELIVERY=========================================================
	
	if(d.same_as_delivery.checked==false){
	
		if (d.deliveryFirstName.value == ""){
			jAlert('YOU HAVE TO TYPE THE DELIVERY NAME!', 'OOPS!', 
				function(r){				
					if(r==true)
					d.deliveryFirstName.focus();
				}
			);
			return false;
		}
		
		if (d.deliverySurname.value == ""){
			jAlert('YOU HAVE TO TYPE THE DELIVERY SURNAME!', 'OOPS!', 
				function(r){				
					if(r==true)
					d.deliverySurname.focus();
				}
			);
			return false;
		}
		
		if (d.deliveryAddress1.value == ""){
			jAlert('YOU HAVE TO TYPE THE DELIVERY ADDRESS!', 'OOPS!', 
				function(r){				
					if(r==true)
					d.deliveryAddress1.focus();
				}
			);
			return false;
		}
		
		if (d.deliveryCity.value == ""){
			jAlert('YOU HAVE TO TYPE THE DELIVERY CITY!', 'OOPS!', 
				function(r){				
					if(r==true)
					d.deliveryCity.focus();
				}
			);
			return false;
		}
		
		if (d.deliveryPostZipCode.value == ""){
			jAlert('YOU HAVE TO TYPE THE DELIVERY POSTCODE!', 'OOPS!', 
				function(r){				
					if(r==true)
					d.deliveryPostZipCode.focus();
				}
			);
			return false;
		}
		
		if (d.deliveryCountry.value == ""){
			jAlert('YOU HAVE TO TYPE THE DELIVERY COUNTRY!', 'OOPS!', 
				function(r){				
					if(r==true)
					d.deliveryCountry.focus();
				}
			);
			return false;
		}
		
		if (d.deliveryPhone.value == ""){
			jAlert('YOU HAVE TO TYPE THE DELIVERY PHONE!', 'OOPS!', 
				function(r){				
					if(r==true)
					d.deliveryPhone.focus();
				}
			);
			return false;
		}
	
	}
	
	
	if (d.billingEmailAddres.value == ""){
		jAlert('YOU HAVE TO TYPE THE BILLING E-MAIL!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingEmailAddres.focus();
			}
		);
		return false;
	}
	
	var validacao;	
	var str = d.billingEmailAddres.value;	
    var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
    if(filter.test(str)){
		
      validacao = true;
	  
	}else{
		jAlert('THIS IS NOT A VALID E-MAIL!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingEmailAddres.focus();
			}
		);
      validacao = false;
	  
    }	
    return validacao;
	
}










function billingEdit(){
	
	var d = document.billingform;
	
	if (d.billingFirstName.value == ""){
		jAlert('YOU HAVE TO TYPE YOUR FIRST NAME!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingFirstName.focus();
			}
		);
		return false;
	}
	
	if (d.billingSurname.value == ""){
		jAlert('YOU HAVE TO TYPE YOUR SURNAME!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingSurname.focus();
			}
		);
		return false;
	}
	
	if (d.billingAddress1.value == ""){
		jAlert('YOU HAVE TO TYPE YOUR ADDRESS!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingAddress1.focus();
			}
		);
		return false;
	}
	
	if (d.billingCity.value == ""){
		jAlert('YOU HAVE TO TYPE YOUR CITY!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingCity.focus();
			}
		);
		return false;
	}
	
	if (d.billingPostZipCode.value == ""){
		jAlert('YOU HAVE TO TYPE THE POSTCODE!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingPostZipCode.focus();
			}
		);
		return false;
	}
	
	if (d.billingCountry.value == ""){
		jAlert('YOU HAVE TO SELECT A COUNTRY!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingCountry.focus();
			}
		);
		return false;
	}
	
	if (d.billingPhone.value == ""){
		jAlert('YOU HAVE TO TYPE THE BILLING PHONE!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingPhone.focus();
			}
		);
		return false;
	}
	
	if (d.billingPassword.value == ""){
		jAlert('YOU HAVE TO TYPE THE PASSWORD!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingPassword.focus();
			}
		);
		return false;
	}
	
	
	
	if (d.billingEmailAddres.value == ""){
		jAlert('YOU HAVE TO TYPE THE BILLING E-MAIL!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingEmailAddres.focus();
			}
		);
		return false;
	}
	
	var validacao;	
	var str = d.billingEmailAddres.value;	
    var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
    if(filter.test(str)){
		
      validacao = true;
	  
	}else{
		jAlert('THIS IS NOT A VALID E-MAIL!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingEmailAddres.focus();
			}
		);
      validacao = false;
	  
    }	
    return validacao;
	
}


function editDelivery(){
	
	var d = document.deliveryForm;
	
	
	//DELIVERY=========================================================
	
	if(d.same_as_delivery.checked==false){
	
		if (d.deliveryFirstName.value == ""){
			jAlert('YOU HAVE TO TYPE THE DELIVERY NAME!', 'OOPS!', 
				function(r){				
					if(r==true)
					d.deliveryFirstName.focus();
				}
			);
			return false;
		}
		
		if (d.deliverySurname.value == ""){
			jAlert('YOU HAVE TO TYPE THE DELIVERY SURNAME!', 'OOPS!', 
				function(r){				
					if(r==true)
					d.deliverySurname.focus();
				}
			);
			return false;
		}
		
		if (d.deliveryAddress1.value == ""){
			jAlert('YOU HAVE TO TYPE THE DELIVERY ADDRESS!', 'OOPS!', 
				function(r){				
					if(r==true)
					d.deliveryAddress1.focus();
				}
			);
			return false;
		}
		
		if (d.deliveryCity.value == ""){
			jAlert('YOU HAVE TO TYPE THE DELIVERY CITY!', 'OOPS!', 
				function(r){				
					if(r==true)
					d.deliveryCity.focus();
				}
			);
			return false;
		}
		
		if (d.deliveryPostZipCode.value == ""){
			jAlert('YOU HAVE TO TYPE THE DELIVERY POSTCODE!', 'OOPS!', 
				function(r){				
					if(r==true)
					d.deliveryPostZipCode.focus();
				}
			);
			return false;
		}
		
		if (d.deliveryCountry.value == ""){
			jAlert('YOU HAVE TO TYPE THE DELIVERY COUNTRY!', 'OOPS!', 
				function(r){				
					if(r==true)
					d.deliveryCountry.focus();
				}
			);
			return false;
		}
		
		if (d.deliveryPhone.value == ""){
			jAlert('YOU HAVE TO TYPE THE DELIVERY PHONE!', 'OOPS!', 
				function(r){				
					if(r==true)
					d.deliveryPhone.focus();
				}
			);
			return false;
		}
	
	}
	
	
	if (d.billingEmailAddres.value == ""){
		jAlert('YOU HAVE TO TYPE THE BILLING E-MAIL!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingEmailAddres.focus();
			}
		);
		return false;
	}
	
	var validacao;	
	var str = d.billingEmailAddres.value;	
    var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
    if(filter.test(str)){
		
      validacao = true;
	  
	}else{
		jAlert('THIS IS NOT A VALID E-MAIL!', 'OOPS!', 
			function(r){				
				if(r==true)
				d.billingEmailAddres.focus();
			}
		);
      validacao = false;
	  
    }	
    return validacao;
	
}




function termsValidation(){
	var d = document.SagePayForm;
	
	if (d.terms.checked == false)
	{
		jAlert('In order to proceed, you need to agree with our Terms &amp; Conditions.', 'OOPS!', 
			function(r){				
				if(r==true)
				d.terms.focus();
			}
		);
		return false;
	}
	
}


/*Função Pai de Mascaras*/
function Mascara(o,f){
    v_obj=o
    v_fun=f
    setTimeout("execmascara()",1)
}

/*Função que Executa os objetos*/
function execmascara(){
    v_obj.value=v_fun(v_obj.value)
}

function Postcode(v){
	
	v=v.replace(/^([a-zA-Z]+[0-9]{1,2})([0-9]+[a-zA-Z]{1,2})$/,"$1 $2")
	v=v.replace(/^([a-zA-Z]+[0-9]{2,2})([0-9]+[a-zA-Z]{1,2})$/,"$1 $2")
	v=v.replace(/^([a-zA-Z]+[0-9]{1,1})([0-9]+[a-zA-Z]{1,2})$/,"$1 $2")
	v=v.replace(/^(\w{4})([0-9]+[a-zA-Z]{1,2})$/,"$1 $2")
	v=v.replace(/^(\w{3})([0-9]+[a-zA-Z]{1,2})$/,"$1 $2")
    return v
    
}


/***********************************************
* Floating Top Bar script- © Dynamic Drive (www.dynamicdrive.com)
* Sliding routine by Roy Whittle (http://www.javascript-fx.com/)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var persistclose=0 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session
var startX = 0 //set x offset of bar in pixels
var startY = 0 //set y offset of bar in pixels
var verticalpos="fromtop" //enter "fromtop" or "frombottom"

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function closebar(){
if (persistclose)
document.cookie="remainclosed=1"
document.getElementById("coluna-left").style.visibility="hidden"
}

function staticbar(){
	barheight=document.getElementById("coluna-left").offsetHeight
	var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
	var d = document;
	function ml(id){
		var el=d.getElementById(id);
		if (!persistclose || persistclose && get_cookie("remainclosed")=="")
		el.style.visibility="visible"
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";};
		el.x = startX;
		if (verticalpos=="fromtop")
		    if(startY<400){
		        el.y = startY;
		    }
		else{
		el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
		el.y -= startY;
		}
		return el;
	}
	window.stayTopLeft=function(){
		
		if (verticalpos=="fromtop"){
		    var pY = ns ? pageYOffset : iecompattest().scrollTop;
		    
		    var bLateralHeight = document.getElementById('coluna-left').clientHeight;
		    var contentHeight = document.getElementById('content').clientHeight
		    var pStop = contentHeight - (bLateralHeight+96);
		    
		    //alert(pStop);
		    
		    if(pY>400){
		        
		        if((pY + (startY-400)) > pStop){
		            ftlObj.y = pStop;
		        }else{
		            ftlObj.y += (pY + (startY-400) - ftlObj.y)/8;
		        }
		        
		    }else{
		        ftlObj.y += (startY - ftlObj.y)/8;
		    }

		}else{
		    var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;
		    //ftlObj.y += (pY - (startY-400) - ftlObj.y)/8;
		}
		
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 10);
	}
	ftlObj = ml("coluna-left");
	stayTopLeft();
}

if (window.addEventListener)
window.addEventListener("load", staticbar, false)
else if (window.attachEvent)
window.attachEvent("onload", staticbar)
else if (document.getElementById)
window.onload=staticbar


