function openPopup(url,name,width,height) {
var popupWin = top[name];
popupWin = window.open(url, name, 'width=' + width + ',height=' + height + ',status=yes,menubar=no,resizable=no,scrollbars=no, left=' + String((screen.width-width)/2) + ',top=' + String((screen.height-height)/2));
popupWin.focus();
}
function closePopup(url) {
if (opener) {
if (opener.closed) window.open(url, "");
self.close();
return false;
}
return true;
}
function strrchr (haystack, needle) {
// http://kevin.vanzonneveld.net
// + original by: Brett Zamir (http://brett-zamir.me)
// + input by: Jason Wong (http://carrot.org/)
// + bugfixed by: Brett Zamir (http://brett-zamir.me)
// * example 1: strrchr("Line 1\nLine 2\nLine 3", 10).substr(1)
// * returns 1: 'Line 3'
var pos = 0;
if (typeof needle !== 'string') {
needle = String.fromCharCode(parseInt(needle, 10));
}
needle = needle.charAt(0);
pos = haystack.lastIndexOf(needle);
if (pos === -1) {
return false;
}
return haystack.substr(pos);
}
$(document).ready(function(){
// menu
//$('#nav').droppy();
$('#nav2').droppy2();
// menu
$("a[rel=gapict-group]").fancybox({
'padding': 2,
'transitionIn': 'none',
'transitionOut': 'none',
'titlePosition': 'over',
'overlayOpacity': 0.8,
'overlayColor': '#fff',
'autoScale': false,
/*'titleFormat': function(title, currentArray, currentIndex, currentOpts) {
return 'Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' ' + title : '') + '';*/
'titleFormat': function(title){
return '' + (title.length ? ' ' + title : ' ') + 'Распечатать схему';
},
'onComplete': function(){
$('.print_link').click(function (){
$('head').append('');
$('body').append('
');
window.print();
window.setTimeout(function (){
$('#img_print').remove();
}, 0);
});
}
});
$("a[rel=gapict-group2]").fancybox({
'padding': 2,
'transitionIn': 'none',
'transitionOut': 'none',
'titlePosition': 'over',
'overlayOpacity': 0.8,
'overlayColor': '#fff',
'titleFormat': function(title){
return '' + (title.length ? ' ' + title : ' ') + '';
}
});
/*
$("a.prw").live("click", function(){
var hrf = $(this).attr("href");
var idx = $(this).attr("id").substr(5);
var fnm = strrchr(hrf, "/");
var nfnm = "/m" + fnm.substr(2);
hrf = hrf.replace(fnm, nfnm);
$("#opuppict img").attr("src", hrf);
$("#opuppict").attr("rel", "gapict-group_" + idx);
return false;
});
*/
$("a.prw").live("click", function(){
//$("a.prw").click(function(){
var hrf = $(this).attr("href");
var idx = $(this).attr("id").substr(5);
var ext = strrchr(hrf, ".");
//var fnm = strrchr(hrf, "/");
var hrf = hrf.replace(ext, "") + "_thumb" + ext;
$("#opuppict img").attr("src", hrf);
$("#opuppict").attr("rel", "gapict-group_" + idx);
return false;
});
$("#opuppict").live("click", function(){
//$("#opuppict").click(function(){
var str = $(this).attr("rel");
inx = str.substr(13);
$("#_oppt_" + inx).trigger('click');
return false;
});
$("#ankt").click(function(){
$("#anktbl").toggle("slow");
return false;
});
$(".slider td").mouseover(function(){
if (!$(this).attr("class") && $("a", this).size() > 0){
$(this).css({
backgroundImage: "url(/i/slider_bg2.png)",
cursor: "pointer"
});
}
});
$(".slider td").mouseout(function(){
if (!$(this).attr("class") && $("a", this).size() > 0){
$(this).css({
backgroundImage: "url(/i/slider_bg.png)"
});
}
});
$(".tdata2 .dd3 .goo").mouseover(function(){
$(this).css({
border: "1px solid #eb193c",
cursor: "pointer"
});
$(".go", this).css({
backgroundColor: "#fff",
color: "#eb193c"
});
});
$(".tdata2 .dd3 .goo").mouseout(function(){
$(this).css({
border: "1px solid #ccc",
cursor: "pointer"
});
$(".go", this).css({
backgroundColor: "#eb193c",
color: "#fff"
});
});
$(".tdata2 .dd6 .goo").mouseover(function(){
$(this).css({
//border: "1px solid #eb193c",
cursor: "pointer"
});
$(".go", this).css({
backgroundColor: "#eb193c"
});
});
$(".tdata2 .dd6 .goo").mouseout(function(){
$(this).css({
//border: "1px solid #ccc",
cursor: "pointer"
});
$(".go", this).css({
backgroundColor: "#000"
});
});
//$(".swnav .sw a").live ("click", function(){
$(".swnav .sw a").click(function(){
if ($(this).parent().hasClass("swc")) return false;
else{
var dig = $(this).attr("id").substr(7);
/*
$(this).css({
textTransform: "uppercase",
color: "#000",
cursor: "default"
});
$(".swnav .ctab .sw a").css({
textTransform: "capitalize",
color: "#eb193c",
cursor: "pointer"
});
*/
$(".swnav table").each(function(){
if ($(this).hasClass("ctab")){
$(this).removeClass("ctab");
$(this).addClass("ctab3");
$(".sw", this).removeClass("swc");
var dig2 = $(".sw a", this).attr("id").substr(7);
$("#gspdata" + dig2).css("display", "none");
$("#maptab" + dig2).css("visibility", "hidden");
}
});
$(this).parent().addClass("swc");
$(this).parents("table:first").removeClass("ctab3");
$(this).parents("table:first").addClass("ctab");
$("#gspdata" + dig).css("display", "block");
$("#maptab" + dig).css("visibility", "visible");
return false;
}
});
/*
$("#toffred").click(function(){
$("#tonred").attr("checked", "");
$("#red input:checkbox").each(function(){
$(this).attr("checked", "");
});
return false;
});
$("li").toggle(
function () {
$(this).css("list-style-type", "disc")
.css("color", "blue");
},
function () {
$(this).css({"list-style-type":"", "color":""});
}
);
*/
/*
$(".dlist li ul").slideUp();
$(".dlist li a").click(function(){
var cElem = $(this).next("ul");
console.log($(this).next("ul"));
if(!$(this).data('flag')){
$(cElem).slideDown();
$(this).data('flag', 1)
}else{
$(cElem).slideUp();
$(this).removeData('flag');
}
return false;
});
*/
/*
var flag = false;
$(".dlist li a").click(function(){
var cElem = $(this).next("ul");
if(!flag){
$(cElem).slideDown();
flag = true;
}else{
$(cElem).slideUp();
flag = false;
}
return false;
});*/
/*$('#outer #descl').click(function(){
if ($('#outer .superInfo').hasClass('On'))
{
$('#outer .superInfo').removeClass('On')
}else {
$('#outer .superInfo').addClass('On');
}
});*/
});
/*
function ankshow(){
var elem = document.getElementById("anketa");
if (elem.style.display == "block"){
elem.style.display = "none";
return false;
}
elem.style.display = "block";
return false;
}
*/
function check2(){
var al = '';
$.ajax({
type: "POST",
url: "/ajax/vac_check.php",
data: "captcha="+$('#captcha_val').val(),
success: function(msg){
if (msg=="1"){
al="Неверный код с картинки!\n";
}
if ($("#id_contact").val()==""){
al+="Не указано контактное лицо\n";
}
if ($("#id_phone").val()==""){
al+="Не указан телефон\n";
}
if ($("#id_email").val()==""){
al+="Не указан email\n";
}
if (al!=''){
alert(al);
return false;
}else{
$("#f_tander").submit();
}
}
});
}
function check(){
var al = '';
$.ajax({
type: "POST",
url: "/ajax/vac_check.php",
data: "captcha="+$('#captcha_val').val(),
success: function(msg){
if (msg=="1"){
al="Неверный код с картинки!\n";
}
if ($("#id_name1").val()=="" || $("#id_name2").val()=="" || $("#id_name3").val()==""){
al+="Не указано ФИО\n";
}
if ($("#id_bd").val()==""){
al+="Не указана дата рождения\n";
}
if ($("#id_pd").val()==""){
al+="Не указано место рождения\n";
}
if ($("#id_phone1").val()=="" && $("#id_phone2").val()==""){
al+="Не указан телефон\n";
}
if ($("#id_email").val()==""){
al+="Не указан email\n";
}
if (al!=''){
alert(al);
return false;
}else{
$("#vform").submit();
}
}
});
}
function check3(){
var al = '';
$.ajax({
type: "POST",
url: "/ajax/vac_check.php",
data: "captcha="+$('#captcha_val').val(),
success: function(msg){
if (msg=="1"){
al="Неверный код с картинки!\n";
}
if ($("#id_name").val()==""){
al+="Не указано ФИО\n";
}
if ($("#id_phone").val()==""){
al+="Не указан телефон\n";
}
if ($("#id_email").val()==""){
al+="Не указан email\n";
}
if ($("#id_subj").val()==""){
al+="Не указан заголовок\n";
}
if ($("#id_descr").val()==""){
al+="Не указано сообщение\n";
}
if (al!=''){
alert(al);
return false;
}else{
$("#f_tander").submit();
}
}
});
}