/*-------------------------------------------------
версия JS:		1.8.1
автор:			Студия дизайна pilotov.com
сайт автора:	www.pilotov.com
сжато:			pilotov-js-griper v2.0
-------------------------------------------------*/
$(document).ready( function() { if ( $('#scroll_to').length ) { scrollToElement = $('#scroll_to').html(); if ( scrollToElement != null ) $.scrollTo( $(".news_ancor[name='"+scrollToElement+"']"), 10, {offset:-30} ); } if ( $('#scroll_to_vac').length ) { scrollToElementVac = $('#scroll_to_vac').html(); if ( scrollToElementVac != null ) $.scrollTo( $(".vac_ancor[name='"+scrollToElementVac+"']"), 10, {offset:-30} ); } $("a").click( function() { var urla = $(this).attr("href"); ssilka = $(this); if ( urla.search('/downloadfile/') != -1 ) { download_file ( urla, $(this) ); return false; } return true; }); }); function download_file ( urla ) { $.ajax({ url: urla, dataType: "json", type: "GET", beforeSend: show_loading, error: show_err, success: show_success }); } function show_success ( data, statusText ) { ssilka.css( { "cursor": "pointer" } ); if ( data.ok == 1 ) window.location = data.message; else alert (data.message); } function show_loading () { ssilka.css( { "cursor": "wait" } ); } function show_err (data) { ssilka.css( { "cursor": "pointer" } ); alert ('Файл не найден'); }