function isValidEmailAddress(emailAddress) {
var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
return pattern.test(emailAddress);
}
function sendOptin() {
if(isValidEmailAddress($("#search-input").val()))
{
var dataString;
var optincurlurl = $("#optincurl").val();
dataString=$("#frmnewsletter").serialize();
$.post(optincurlurl,{ url: dataString },
function(data){
if(data=="error") {
alert("Seu cadastro não foi efetuado.");
} else {
//$("#newsLetterFrmContent").hide();
//$("#silverblurb").html(data);
$("#silverpopResult").html("Seu cadastro na newsletter foi efetuado");
$("#silverpopResult").toggle();
}
});
} else {
alert("email invalido.");
}
return false;
}
$(document).ready(function(){
$("#search-input").focus(function(){
$(this).val("");
$(this).css("color","#000000");
$(this).css("font-style","normal");
});
/* subscribe to newsletter */
$("#silverpopSubmit a").click(function(event){
event.preventDefault();
sendOptin();
});
/* submit article comment */
$("#SubmitCommentButton").click(function(event){
event.preventDefault();
$("#frm_articleComment").submit();
});
/* toggle small favourite articles panel */
$("#FaveArtLink a").click(function(event){
event.preventDefault();
$("div.blueArrowRight").toggle();
$("div.blueArrowBottom").toggle();
$("div.SmallArticleFavouritesList").toggle();
});
/* search schools panel */
$("#searchStateSel").change(function() {
var selState = $("#searchStateSel").val();
var action = $("#action").val();
var siteURL = $("#siteURL").val();
var ajaxhelper = siteURL + "/ajaxhelper";
var dataString;
dataString=$("#frmSearchSchool").serialize();
$.post(ajaxhelper,{ action: action, stateID: selState },
function(data){
if(data=="Error") {
//console.info("Sorry, we were unable to process your request.");
} else {
$("#coverSearchSchoolSubmit").hide();
$("#searchSchoolSubmit a").addClass("searchSchoolSubmit");
var jason_data = eval("("+data+")");
var content = "";
$.each(jason_data.rsp.content,function(i,item){
content += "";
});
$("#searchCitySel").html(content);
$("#searchCitySel").attr("disabled", "");
$("#searchSchoolBtn").attr("disabled", "");
}
}
);
});
$("#searchSchoolSubmit a").click(function(event){
event.preventDefault();
var selState = $("#searchStateSel option:selected").text();
var selCity = $("#searchCitySel").val();
var siteURL = $("#siteURL").val() + "/categories/Universidades/";
if (selState == "" || selCity == "") {
alert("Selecione o Estado e a Cidade onde deseja buscar universidades.");
return false;
} else {
selState = selState.replace(/\s/g, "-");
selCity = selCity.replace(/\s/g, "-");
siteURL += selState + "/" + selCity + "/";
window.location.href = siteURL;
}
});
});
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ADxMenu.js - v4 (4.10)
www.aplus.co.yu/adxmenu/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(c) Copyright 2003, Aleksandar Vacic, www.aplus.co.yu
This work is licensed under the Creative Commons Attribution License.
To view a copy of this license, visit http://creativecommons.org/licenses/by/2.0/ or
send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
function ADxMenu_IESetup() {
var aTmp2, i, j, oLI, aUL, aA;
var aTmp = xGetElementsByClassName("adxm", document, "ul");
for (i=0;i<\/scr"+"ipt>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
if (this.readyState == "complete") {
DomLoaded.loaded();
}
};
/*@end @*/
}
};
// load the setup function
DomLoaded.load(ADxMenu_IESetup);