

var Host = 'http://'+window.location.hostname;
var w=540;
var h=700;
var t=(screen.height-h-20)/2; 
var l = (self.screen.width-w)*9/10;	  
var set_val=0;	 
var act_menu=0;	   
var new_menu=0;
var browser_name = navigator.appName;
var browser_version = parseFloat(navigator.appVersion);


var IS_EMAIL = new RegExp('([._a-z0-9-]+[._a-z0-9-]*)@([a-z0-9-]+\.)*([.])([a-z]{2,3})$');
var IS_IMG = new RegExp('\.(gif|png|tif|jpeg|jpg|bmp|tiff|jpe|ief|djvu|djv|ras|pnm|pbm|pgm|rgb|xbm|xwd|ppm)$');
var IS_ARCHIVES = new RegExp('\.(tgz|gz|zip|bz2|tar|7z|rar|arj)$');
var IS_SYMBOLS = new RegExp('\\s\\w+');
var IS_SPACE = new RegExp('^(\\s+|\\s*)$');
var IS_FLOAT = new RegExp('^\\d+[.]{0,1}\\d+$');
var IS_QUANTITY = new RegExp('^\\d+$');
var IS_PHONE = new RegExp('\\d+\\s*\\w*[-()]*');
var IS_DATE = new RegExp('\\d{4,}\\s*\\w*[-()]*');
var IS_RUSCHAR = new RegExp('[а-яА-ЯёЁ]');
var IS_WORD = new RegExp('[a-zA-Z0-9]');
var IS_URL = new RegExp('/(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)/');
var IS_TEXT = new RegExp('\.(css|html|htm|asc|txt|sgml|sgm|tsv|wml|wmls|etx|xml|xsl|xsl|wmls)$');
var IS_VECTOR = new RegExp('\.(ai|eps)$');
var IS_DOC = new RegExp('\.(xls|doc|rtf|pdf|rtx)$');
var IS_VIDEO = new RegExp('\.(mpeg|mpg|mpe|qt|mov|mxu|avi|movie)$');
var IS_MEDIA = new RegExp('\.(swf)$');
var IS_AUDIO = new RegExp('\.(mp3|mp2|mpga|kar|midi|mid|aif|aiff|aifc|m3u|ram|rm|rpm|ra|wav)$');
var IS_BINARY = new RegExp('\.(exe|hqx|cpt|bin|dms|lha|lzh|dms|lha|lzh|class|so|dll|oda)$');
var IS_PHOTO = new RegExp('\.(jpeg|jpg|jpe)$');
var IS_VIDEO_WEB = new RegExp('\.(mpeg|mpg|mpg4|avi|wmv)$');
var IS_AUDIO_WEB = new RegExp('\.(mp3)$');



function isEmpty(Set) {
if (Set.value.length < isEmpty.arguments[1])  return true;
else return false;
 }

function EmptyDef(Set) {
if (Set.value.length > 0)  return true;
else return false;
 }
 
function isBig(Set) {
if (Set.value.length > isBig.arguments[1])  return true;
else return false;
 }


  

function trim(str){

str.replace(/^\s+/, '');
str.replace(/\s+$/, '');
return str;
}



function _open(pg, w, h, ph, scr) {
var scr = scr;
if(w > 860 || h> 860){
var h = 560;
var w = 860;
scr = 1;
}

t=parseInt((screen.height-h)/5); 
l=parseInt((self.screen.width-w)*9/10);
d = open(Host+pg,ph,'menubar=0,directories=0,location=0,toolbar=0,scrollbars='+scr+',status=0,resizable=1,width='+w+',height='+h+',top='+t+',left='+l);
d.focus();
}

function SelField(Set,txt){
alert(unescape(txt));
Set.focus();
Set.select();
}


function MsgConfirm(txt){
return confirm(unescape(txt));

}



function MsgAlert(txt){
alert(unescape(txt));

}





function _SelCheckBox(Set) {
var k = Set.elements.length;
for (var i = 0; i < k; i++) {
if(Set.elements[i].checked) {
Set.elements[i].checked=false;
} else {
Set.elements[i].checked=true;
        }
     }
}




function CheckBox(Set,Msg){

var k = Set.elements.length;
for (var i = 0; i < k; i++) {
    if(Set.elements[i].checked) {
return Set.elements[i].value;
    	}
     }

alert(unescape(Msg));
return false;
}




function DelMsg(Set,Msg){

if(!CheckBox(Set,Msg)) {
return false;
}
return true;
}


// Corner
//$("div.rounded").corner("round 24px");


/*


//on page load call TB_init
$(document).ready(_img_init);


//add thickbox to href elements that have a class of .thickbox
function _img_init(){
  $("a.thickbox").click(function(){
  imgOpen(this);
  return false;
  });
}

*/



var resId = 0;
var imgWndw;

function imgOpen(imgLink) {
  if (imgLink.target != '_blank') return true;
    if (typeof(window.resizeBy)=='undefined') return true;
    imgWndw=window.open('',imgLink.target,'width=100,height=100'+
        ',toolbar=no,menubar=no,location=no,status=no,'+
        'resizable=no,scrollbars=yes,left='+(screen.width>>>2)+
        ',top='+(screen.height>>>4));
    self.focus();

with(imgWndw.document){

Ititle = unescape(imgLink.title);

open();
writeln('<html>');
writeln('<head>');
writeln('<title>'+Ititle+'</title>');
writeln('</head>');
writeln('<body style="margin:0;padding:0;position:fixed;overflow:none;background-color:#363636;background-position:center;background: url(/img/load.gif);background-repeat:no-repeat" onselectstart="return false">');
writeln('<img style="cursor:pointer" src="'+imgLink.href+'" border="0" alt="'+Ititle+'" title="'+Ititle+'" disabled="return false" onclick="window.close();" />');
writeln('</body>');
writeln('</html>');
close();
      }
    resId=setInterval('imgResize()',100);
    return false
}

function imgResize() {
    var w=imgWndw.document.images[0].width;
    if (w>screen.availWidth) w=screen.availWidth;
    var h=imgWndw.document.images[0].height;
    if (h>screen.availHeight) h=screen.availHeight;
    if (w>50 && h>50) {
        var ww=(imgWndw.innerWidth)?imgWndw.innerWidth:((document.body)?
            imgWndw.document.body.clientWidth:null);
        var wh=(imgWndw.innerHeight)?imgWndw.innerHeight:((document.body)?
            imgWndw.document.body.clientHeight:null);
        if (ww && wh) {
        
        
if (screen.height < 500) {
wi = w-ww;
hi = 500;

   } else {

wi = w-ww;
hi = h-wh;

           }
           
            imgWndw.resizeBy(wi,hi);
            
        }
        imgWndw.focus();
        clearInterval(resId)
    }
}


var MsgWndw;

function _msg(id){

t=(screen.height-500)/5;
l=(self.screen.width-435)*9/10;
MsgWndw = window.open('/inc/_msg.php?id='+id,'msg'+id,'menubar=0,directories=0,location=0,toolbar=0,scrollbars=1,status=0,resizable=0,width=435,height=500,top='+t+',left='+l);
MsgWndw.focus();
}




function _Edit(pg, w, h, j){
t=(screen.height-h)/5;
l=(self.screen.width-w)*9/10;
f = open(pg,j,'menubar=0,directories=0,location=0,toolbar=0,scrollbars=1,status=0,resizable=1,width='+w+',height='+h+',top='+t+',left='+l);
f.focus();
}





function getCookie(name) {
cookie_name = name + "=";
cookie_length = document.cookie.length;
cookie_begin = 0;
//alert(cookie_length);
while (cookie_begin < cookie_length){


value_begin = cookie_begin + cookie_name.length;
if (document.cookie.substring(cookie_begin, value_begin) == cookie_name) {
var value_end = document.cookie.indexOf (";", value_begin);
if (value_end == -1){
value_end = cookie_length;

}

return unescape(document.cookie.substring(value_begin, value_end));

}
cookie_begin = document.cookie.indexOf(" ", cookie_begin) + 1;
if (cookie_begin == 0){
break;
}
}
return null;
}






function getMimeType()  {
//      var mimeType = "application/x-mplayer2"; //default
      var mimeType = "application/x-shockwave-flash";
      var agt=navigator.userAgent.toLowerCase();
      if (navigator.mimeTypes && agt.indexOf("windows")==-1) {
         //non-IE, no-Windows
//         var plugin=navigator.mimeTypes["audio/mpeg"].enabledPlugin;
//         if (plugin) mimeType="audio/mpeg" //Mac/Safari & Linux/FFox
         var plugin=navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
         if (plugin) mimeType="application/x-shockwave-flash" //Mac/Safari & Linux/FFox

      }//end no-Windows
      return mimeType;
   }

function playSound(wav_file)  {
      var player = document.getElementById("player");
      if (player)   {
         player.parentNode.removeChild(player);
      }
      player = document.body.appendChild(document.createElement("div"));
      player.innerHTML = "<embed src='"+wav_file+"' autostart='1' loop='0' height='0px' width='0px' type='"+getMimeType()+"'></embed>";
   }
   
   
   
   
   
   
   



function addBookmark(url, title){
  if (!url) url = location.href;
  if (!title) title = document.title;

  //Gecko
  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel (title, url, "");
  //IE4+
  else if (typeof window.external == "object") window.external.AddFavorite(url, title);
  //Opera7+
  else if (window.opera && document.createElement) {
    var a = document.createElement('A');
    if (!a) return false; //IF Opera 6
    a.setAttribute('rel','sidebar');
    a.setAttribute('href',url);
    a.setAttribute('title',title);
    a.click();
  }
  else return false;

  return true;
}


function _addfavorite(){
if(!addBookmark()) alert('Your browser does not support the automatic accompaniment a bookmark.');
  return true;
}


   
   



function admin(pg, w, h, ph) {


t=parseInt((screen.height-h)/5);
l=parseInt((self.screen.width-w)*9/10);
d = open(Host+pg,ph,'menubar=0,directories=0,location=0,toolbar=0,scrollbars=1,status=0,resizable=1,width='+w+',height='+h+',top='+t+',left='+l);
d.focus();
}

   