/////////////////////////////////////////////////
//Библиотека функций JS
//Последнее изменение: 07.11.2011
/////////////////////////////////////////////////

function winOpen(url, width, height) {
var left=screen.availWidth/2-width/2;
var top=screen.availHeight/2-height/2;
window.open(url, "", "width="+width+"px, height="+height+", left="+left+", top="+top+", toolbar=no, location=no, directories=no, menubar=no, scrollbars=no, resizable=no, status=no, fullscreen=no");
}

function winOpenResize(url, width, height) {
var left=screen.availWidth/2-width/2;
var top=screen.availHeight/2-height/2;
window.open(url, "", "width="+width+"px, height="+height+", left="+left+", top="+top+", toolbar=no, location=no, directories=no, menubar=no, scrollbars=yes, resizable=yes, status=no, fullscreen=no");
}

function modalShow(url, width, height) {
var left=screen.availWidth/2-width/2;
var top=screen.availHeight/2-height/2;
if (navigator.appName.indexOf('Microsoft')!=-1) {
var retVal=window.showModalDialog(url,window,"dialogWidth:"+width+"px;dialogHeight:"+height+"px,left="+left+",top="+top+";edge:Raised;center:1;help:0;resizable:1;maximize:1");
}
else {
var retVal=window.open(url, "", "width="+width+"px,height="+height+",left="+left+",top="+top);
window.onfocus = function(){if (retVal.closed == false){retVal.focus();};};
}
return retVal;
}

/////////////////////////////////////////////////

function Print_Email(user, domain, suffix, title, css) {
var email='<A HREF="'+'mailto:'+user+'@'+domain+'.'+suffix+'" CLASS="'+css+'" TITLE="'+title+'">'+user+'@'+domain+'.'+suffix+'</A>';
document.write(email);
}

/////////////////////////////////////////////////

function Redirect(url, msg) {
var e=document.getElementById("redirectid");
var cTicks=parseInt(e.innerHTML);
var timer=setInterval(function() {
if (cTicks) {
e.innerHTML=--cTicks;
}
else {
clearInterval(timer);
if (msg) {
document.body.innerHTML=msg;
}
window.location=url;	  
}
}, 1000);
}

/////////////////////////////////////////////////

function print_doc() {
window.print();
} 

/////////////////////////////////////////////////

//Функция проверки правильности написания E-Mail
function isValidEmailAddress(emailAddress) {
var pattern=new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
return pattern.test(emailAddress);
}

