﻿// (c) ProNET Company 16.01.2010

//var $j = jQuery.noConflict();
//$j(document).ready(function($) {

$(document).ready(function(){
$("a.pronet").attr("href", function() { return  this.href; }); // передаем значения href
$("a.pronet").live('click', function() {
//$("#sys a").click(function(){
var toLoad = $(this).attr('href')+' .text form'; // устанавливаем фильтр (берем данные только из .text form)
$("#popup_pronet").togglePopup(); // показываем модальное окно
$("#load").append('<div style="font-size: 1.5em;">загружаю <img src="../f/i/wait_bottom.gif"></div>'); // выводим сообщениие о загрузке
$("#load").load(toLoad); // грузим контент по ссылке в content-inner учитывая фильтр
//window.location.hash = $(this).attr('href');
return false;
});

$("a.job").live('click', function() {
//$("#sys a").click(function(){
var toLoad = $(this).attr('href')+' #formQueryBg'; // устанавливаем фильтр (берем данные только из .text form)
$("#popup_pronet").togglePopup(); // показываем модальное окно
$("#load").append('<div style="font-size: 1.5em;">загружаю <img src="../f/i/wait_bottom.gif"></div>'); // выводим сообщениие о загрузке
$("#load").load(toLoad); // грузим контент по ссылке в content-inner учитывая фильтр
//window.location.hash = $(this).attr('href');
return false;
});
	
   //align element in the middle of the screen
   $.fn.alignCenter = function() {
      //get margin left
      var marginLeft =  - $(this).width()/2 + 'px';
      //get margin top
      var marginTop =  - $(this).height()/2 + 'px';
      //return updated element
      return $(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
   };

   $.fn.togglePopup = function(){
     //detect whether popup is visible or not
     if($('#popup').hasClass('hidden'))
     {
       //hidden - then display
       //when IE - fade immediately
       if($.browser.msie)
       {
         $('#opaco').height($(document).height()).toggleClass('hidden')
                    .click(function(){$(this).togglePopup();});
       }
       else
       //in all the rest browsers - fade slowly
       {
         $('#opaco').height($(document).height()).toggleClass('hidden').fadeTo('slow', 0.7)
                    .click(function(){$(this).togglePopup();});
       }

       $('#popup')
         .html($(this).html())
         .alignCenter()
         .toggleClass('hidden');
     }
     else
     {
       //visible - then hide
       $('#opaco').toggleClass('hidden').removeAttr('style').unbind('click');
       $('#popup').toggleClass('hidden');
     }
   };
});
/*
$(function () { // make this code initialize when DOM loads
	$('form').submit(function () { // optional: replace "form" with whatever CSS selector you want (ex: ID or class)
		$('input[type="submit"]', this).replaceWith('<p align="center"><strong>Отправляю...</strong></p>'); // optional: change "Sending..." to something else
	});
});*/