/*
* Copyright (c) 2010 2km interativa! - http://www.2km.com.br
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this 
* software and associated documentation files (the "Software"), to deal in the Software 
* without restriction, including without limitation the rights to use, copy, modify, merge, 
* publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 
* to whom the Software is furnished to do so, subject to the following conditions:
* 	
* The above copyright notice and this permission notice shall be included in all copies or 
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 
* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
* DEALINGS IN THE SOFTWARE.
*/
$(function(){if($('<input/>').attr('placeholder','')[0].placeholder===undefined){$('input[placeholder]').each(function(){this.value===''?this.value=$(this).attr('placeholder'):false;}).live('focusin focusout',function(event){event.type=='focusout'&&this.value===''?this.value=$(this).attr('placeholder'):this.value===$(this).attr('placeholder')?this.value='':false;});}
$("a.externo").each(function(){$(this).attr("target","_blank");})
SexyLightbox.initialize({find:'sexylightbox',color:'morangao',dir:baseUrl+'img/sexyimages',imagesdir:baseUrl+'img/sexyimages',emergefrom:'bottom'});setTimeout(function(){if($.cookie('form_oferta')!=1){$('a.cadastro').trigger('click');setaCookieForm();}},10000);$("#FormOferta").live('submit',function(){return validaFormOferta();});});var setaCookieForm=function(){$.cookie('form_oferta','1',{path:'/',expires:90});}
var validaFormOferta=function(){if($('#CadastroName').val()!=""&&$('#CadastroFrom').val()!=""){if(validaEmail($('#CadastroFrom').val())){return true;}else{SexyLightbox.shake();return false;}}else{SexyLightbox.shake();return false;}}
var validaEmail=function(email){var at=email.lastIndexOf("@");if(at<1||(at+1)===email.length)
return false;if(/(\.{2,})/.test(email))
return false;var local=email.substring(0,at);var domain=email.substring(at+1);if(local.length<1||local.length>64||domain.length<4||domain.length>255)
return false;if(/(^\.|\.$)/.test(local)||/(^\.|\.$)/.test(domain))
return false;if(!/^"(.+)"$/.test(local)){if(!/^[-a-zA-Z0-9!#$%*\/?|^{}`~&'+=_\.]*$/.test(local))
return false;}
if(!/^[-a-zA-Z0-9\.]*$/.test(domain)||domain.indexOf(".")===-1)
return false;return true;}