$(function(){                  
    $('.customNyroModal').click(function(e){    
        $('html, body').animate({scrollTop:0}, 'slow');
        var d = new Date();   
        url = $(this).attr('href') + '&dummy=' + d.getTime();
        
        e.preventDefault();                       
        onOpenModalCustom();
        $.nyroModalManual({                 
            'modal': true,
            'url': url,
            'resizable': false
        });                        
        afterOpenModalCustom();
        return false;

    });                                
});

function saveModalPageClick(){  
    $('#pagelocation').val(window.location);                               
    $('#PageForm').submit(); 
}

function cancelModalPageClick(){   
    if (window.confirm("Leave form without Saving?")){
        $.nyroModalRemove();      
    }
}

function onOpenModalCustom(){
  
}

function afterOpenModalCustom(){
 
}

function updateModalCustom(){
//    $('#customblocker')
//        .css('width', window.innerWidth + 'px')    
//        .css('height', window.innerHeight + 'px');  
//    $('#nyroModalFull')
//        .css('width', window.innerWidth + 'px')    
//        .css('height', window.innerHeight + 'px')
//        .css('top', window.pageYOffset + 'px');   
}

function sendContactMail(formid){
    $.post('ajax/mailajax.php',$('#' + formid).serialize(true),function(msg){  
        if(msg == 'No Error'){
            $('#mailmessage').css('color','#52612A');  
            $('#mailmessage').html('Thank you, your message has been sent.'); 
            
            $('#firstname').val('');          
            $('#lastname').val('');          
            $('#company').val('');          
            $('#email').val('');          
            $('#message').val('');        
        }   
        else{
            $('#mailmessage').css('color','#FF0000');  
            $('#mailmessage').html(msg);  
        } 
    });            
}