// Javascript source code
function fixIE6(){
    var cssAlt = "<style type='text/css'>#borderMain{margin-left:5px;width:758px;}#menu{margin-left:5px;margin-right:5px;}#content{margin:0px;margin-top:10px; padding-left:8px; width:500px;}<\/style>";
    if (window.ie6)
        document.write(cssAlt);
}

function openNews() {

	window.open ("http://www.recivil.com.br/special_news.asp", "Notícia","location=0,status=0,scrollbars=1,width=800,height=600");

}
   
function previousWeek(intWeek, intYear){

    if (intWeek <= 1) {
        intWeek = 53;
        intYear --;
    }
    else
        intWeek--;

    window.location.href = "index.asp?wk=" + intWeek + "&yr=" + intYear;

}

function nextWeek(intWeek, intYear){

    if (intWeek > 53){
        intWeek = 1;
        intYear ++;
    }
    else {
        intWeek++;
    }            

    window.location.href = "index.asp?wk=" + intWeek + "&yr=" + intYear;
                
}      	

function openBanner(intId){

    var arrBanners = new Array();
    arrBanners[1] = "http://www.lmtechnology.com.br";
    arrBanners[2] = "http://www.claro.com.br";
    arrBanners[4] = "http://www.hotelsolbh.com.br";
    arrBanners[5] = "/documentos/RecivilUnimed.pdf";
	arrBanners[6] = "http://www.bradescopoderpublico.com.br";
    
    window.open(arrBanners[intId], 'Banner');

}
function cleanNews(){

    window.location.href = "index.asp";

}

function verifyFields(){
    
    var keyword = document.getElementById("keyword");
    var startDate = document.getElementById("start_date");
    var endDate = document.getElementById("end_date");

    if (keyword.value.length < 2){
        alert("Por favor digite uma palavra válida com mais de dois caracteres.");
        keyword.focus();
        return false;
    }
    else if (endDate.value.length != 0 && startDate.value.length != 10){
        alert("Por favor digite uma data inicial válida");
        startDate.focus();
        return false;
    }
    else if (startDate.value.length != 0 && endDate.value.length != 10){
        alert("Por favor digite uma data final válida");
        endDate.focus();
        return false;
    }            
    
    return true;
}

function closeNews(){
	document.getElementById("SpecialNews").style.visibility = "hidden";
}

function checkSubmitNL(objForm){
    
    var strEmail = objForm.info_email.value;

    if (!checkEmail(strEmail)){
        alert('Por favor forneça um e-mail válido');
        objForm.info_email.focus();
        return false;
    }            
    
    return true;
}

function checkEmail(email) {
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (!filter.test(email)) {
        return false;
    }
    else
        return true;
}