function check_contact_form(mail, comment) 
{
    var result = true;
    
    $('#alert_form_error').hide();
    $('#coment_form_error').hide();
    
    if (!is_correct_mail(mail))
    {
        $('#alert_form_error').show() ;
        result = false ;
    }
    if (comment == "")
    { 
        $('#coment_form_error').show() ;
        result = false ;
    }         

    return result ;
}

$(document).ready(function()
{
    function bindings(){}
    $('#jContact a').click(function(){
        var str = '';
        switch(ops[this.rel].type){
            case 'html':
                str = '<div class="text">'+(ops[this.rel].text)+'</div>';
                break;

            case 'form':
            default:
                str = $('#jGenericForm').clone().css('display','block');
                break;
        }

        //var close = '<a class="close" href="#">'+(trans.close)+'</a>';
		var close = '<a class="close" href="#"></a>';
        var title = '<div class="title">'+(close)+($(this).parent().text())+'</div>';
        $('#lightboxText').html(title);  
        $('#lightboxText').append(str);
        $('#lightboxText a.close').click(function(){ lightBoxClose(); return false; });
        bindings();
        lightboxOpen();
        
        return false;
    });
    $('#lightboxBack').click(function(){ lightBoxClose(); });
    $(window).scroll(function(){ recalculate(); });
    $(window).resize(function(){ recalculate(); });
    
    parseInit();
     
});
function parseInit(){
    var trigger = document.location.href;
    if((trigger=trigger.split('#')).length>1 && trigger[1]!=''){
        var as = $('#jContact a');
        switch(trigger[1]){
            case 'form':
            $(as[as.length-1]).click();
            break;
            
            default:       
            if($('#'+(trigger[1])).length>0){
                $('#'+(trigger[1])).click();
            }
            else {            
                var rel = parseInt(trigger[1]);
                if(rel<(as.length+1) && rel>0)
                $('#jContact a[rel="'+(trigger[1]-1)+'"]').click();
            }
        }       
    }
}
function lightBoxClose(){
    $('#lightboxBack').fadeOut('normal',function(){$('#lightboxBack').css('display','none');});
    $('#lightboxContent').fadeOut('normal',function(){$('#lightboxContent').css('display','none');});
}
function lightboxOpen(){
    recalculate();
    $('#lightboxBack').animate({opacity:.5},10).fadeIn('normal',function(){$('#lightboxBack').css('display','block');});
    $('#lightboxContent').fadeIn('normal',function(){$('#lightboxContent').css('display','block');});                        
}
function recalculate(){
    var sT = $(window)['scrollTop']() || 0;
    //var sT = document.documentElement.scrollTop || window.pageYOffset || 0; 
    $('#lightboxContent').css('top',(105+sT)+'px');
    $('#lightboxBack').css({
        'width':($(window)['width']())+'px',
        'height':($(window)['height']())+'px',
        'top':(sT)+'px'
    });
}

