//    ***********************************************************************
//    *                                                                     *
//    *                        JavaScript alerts                            *
//    *                  Copyright by Eduard WishUp Avetyan                 *
//    *                            2009 year                                *
//    *                                                                     *
//    ***********************************************************************

var windowinterval;
var windowt1=0;
var windowopen=0;
var href='';
var windowimg1=new Image();
windowimg1.src='./i/windowlb.png';
var windowimg2=new Image();
windowimg2.src='./i/windowrb.png';
var windowimg3=new Image();
windowimg3.src='./i/windowlt.png';
var windowimg4=new Image();
windowimg4.src='./i/windowrt.png';
var windowimg5=new Image();
windowimg5.src='./i/windowbg.png';

function alertwindow(source){
	if(navigator.appVersion.search(/msie 6/i)==-1){
		if(windowopen==0){
			windowopen=1;
			if(document.getElementById('windowwindowbg')==null){
				document.body.innerHTML+="<div class='windowwindowbg' id='windowwindowbg'><div style='position:relative; top:0; left:50%; width:1px'><div class='alertcontainer' id='alertcontainer'><table border='0' cellpadding='0' cellspacing='0' width='100%' height='100%'><tr><td width='15' height='15'><img src='./i/windowlt.png' border='0' alt='' height='15' width='15' /></td><td width='*' height='15' bgcolor='#ececec'></td><td width='15' height='15'><img src='./i/windowrt.png' border='0' alt='' height='15' width='15' /></td></tr><tr><td width='15' bgcolor='#ececec'></td><td width='*' bgcolor='#ececec' valign='top'><table border=0 height=120 width=100% cellpadding=0 cellspacing=0><tr><td class='windowtext' valign=top id='sourceplace' style='color:#05690a'>"+source+"</td></tr><tr><td align=right height=1><input type=button style='color:#000000' value='Ok' onclick='closealertwindow()'></td></tr></table></td><td width='15' bgcolor='#ececec'></td></tr><tr><td width='15' height='15'><img src='./i/windowlb.png' border='0' alt='' height='15' width='15' /></td><td width='*' height='15' bgcolor='#ececec'></td><td width='15' height='15'><img src='./i/windowrb.png' border='0' alt='' height='15' width='15' /></td></tr></table></div></div></div>";
			} else {
				document.getElementById('windowwindowbg').innerHTML="<div style='position:relative; top:0; left:50%; width:1px'><div class='alertcontainer' id='alertcontainer'><table border='0' cellpadding='0' cellspacing='0' width='100%' height='100%'><tr><td width='15' height='15'><img src='./i/windowlt.png' border='0' alt='' height='15' width='15' /></td><td width='*' height='15' bgcolor='#ececec'></td><td width='15' height='15'><img src='./i/windowrt.png' border='0' alt='' height='15' width='15' /></td></tr><tr><td width='15' bgcolor='#ececec'></td><td width='*' bgcolor='#ececec' valign='top'><table border=0 height=120 width=100% cellpadding=0 cellspacing=0><tr><td class='windowtext' valign=top id='sourceplace'>"+source+"</td></tr><tr><td align=right height=1><input type=button value='Ok' onclick='closealertwindow()'></td></tr></table></td><td width='15' bgcolor='#ececec'></td></tr><tr><td width='15' height='15'><img src='./i/windowlb.png' border='0' alt='' height='15' width='15' /></td><td width='*' height='15' bgcolor='#ececec'></td><td width='15' height='15'><img src='./i/windowrb.png' border='0' alt='' height='15' width='15' /></td></tr></table></div></div>";
				document.getElementById('windowwindowbg').style.display='block';
			}
			alcnt=document.getElementById('alertcontainer');
			alcnt.style.top="-"+parseInt(alcnt.offsetHeight)+"px";
			if(navigator.appName=="Microsoft Internet Explorer"){
				document.getElementById("windowwindowbg").style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='i/windowbg.png',sizingMethod='scale')";
			} else {
				document.getElementById("windowwindowbg").style.backgroundImage="url(i/windowbg.png)";
			}
			windowt1=0;
			windowinterval=setInterval("windowdrop(alcnt)",30);
			return false;
		}
	} else {
		alert(source);	
		return false;
	}
}

function confirmwindow(obj,source){
	href=obj.href;
	if(navigator.appVersion.search(/msie 6/i)==-1){
		if(windowopen==0){
			windowopen=1;
			if(document.getElementById('windowwindowbg')==null){
				document.body.innerHTML+="<div class='windowwindowbg' id='windowwindowbg'><div style='position:relative; top:0; left:50%; width:1px'><div class='alertcontainer' id='alertcontainer'><table border='0' cellpadding='0' cellspacing='0' width='100%' height='100%'><tr><td width='15' height='15'><img src='./i/windowlt.png' border='0' alt='' height='15' width='15' /></td><td width='*' height='15' bgcolor='#ececec'></td><td width='15' height='15'><img src='./i/windowrt.png' border='0' alt='' height='15' width='15' /></td></tr><tr><td width='15' bgcolor='#ececec'></td><td width='*' bgcolor='#ececec' valign='top'><table border=0 height=120 width=100% cellpadding=0 cellspacing=0><tr><td class='windowtext' valign=top id='sourceplace'>"+source+"</td></tr><tr><td align=right height=1><input type=button value='Да' onclick='window.location=href'>&nbsp;&nbsp;&nbsp;<input type=button value='Нет' onclick='closealertwindow()'></td></tr></table></td><td width='15' bgcolor='#ececec'></td></tr><tr><td width='15' height='15'><img src='./i/windowlb.png' border='0' alt='' height='15' width='15' /></td><td width='*' height='15' bgcolor='#ececec'></td><td width='15' height='15'><img src='./i/windowrb.png' border='0' alt='' height='15' width='15' /></td></tr></table></div></div></div>";
			} else {
				document.getElementById('windowwindowbg').innerHTML="<div style='position:relative; top:0; left:50%; width:1px'><div class='alertcontainer' id='alertcontainer'><table border='0' cellpadding='0' cellspacing='0' width='100%' height='100%'><tr><td width='15' height='15'><img src='./i/windowlt.png' border='0' alt='' height='15' width='15' /></td><td width='*' height='15' bgcolor='#ececec'></td><td width='15' height='15'><img src='./i/windowrt.png' border='0' alt='' height='15' width='15' /></td></tr><tr><td width='15' bgcolor='#ececec'></td><td width='*' bgcolor='#ececec' valign='top'><table border=0 height=120 width=100% cellpadding=0 cellspacing=0><tr><td class='windowtext' valign=top id='sourceplace'>"+source+"</td></tr><tr><td align=right height=1><input type=button value='Да' onclick='window.location=href'>&nbsp;&nbsp;&nbsp;<input type=button value='Нет' onclick='closealertwindow()'></td></tr></table></td><td width='15' bgcolor='#ececec'></td></tr><tr><td width='15' height='15'><img src='./i/windowlb.png' border='0' alt='' height='15' width='15' /></td><td width='*' height='15' bgcolor='#ececec'></td><td width='15' height='15'><img src='./i/windowrb.png' border='0' alt='' height='15' width='15' /></td></tr></table></div></div>";
				document.getElementById('windowwindowbg').style.display='block';
			}
			alcnt=document.getElementById('alertcontainer');
			alcnt.style.top="-"+parseInt(alcnt.offsetHeight)+"px";
			if(navigator.appName=="Microsoft Internet Explorer"){
				document.getElementById("windowwindowbg").style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='i/windowbg.png',sizingMethod='scale')";
			} else {
				document.getElementById("windowwindowbg").style.backgroundImage="url(i/windowbg.png)";
			}
			windowt1=0;
			windowinterval=setInterval("windowdrop(alcnt)",30);
			return false;
		}
	} else {
		confirm(source);
	}
}

function windowdrop(win){
	if(parseInt(win.style.top)+130-50<((parseInt(document.getElementById('windowwindowbg').offsetHeight)/2)-(parseInt(document.getElementById('alertcontainer').offsetHeight)/2)) && windowt1==0){
		win.style.top=(parseInt(win.style.top)+50)+'px';
	} else {
		if(parseInt(win.style.top)+20-50<((parseInt(document.getElementById('windowwindowbg').offsetHeight)/2)-(parseInt(document.getElementById('alertcontainer').offsetHeight)/2)) && windowt1==0){
			win.style.top=(parseInt(win.style.top)+20)+'px';
		} else {
			windowt1=1;
			if(parseInt(win.style.top)>((parseInt(document.getElementById('windowwindowbg').offsetHeight)/2)-(parseInt(document.getElementById('alertcontainer').offsetHeight)/2))){
				win.style.top=(parseInt(win.style.top)-5)+'px';
			} else {
				clearInterval(windowinterval);
			}
		}
	}
}

function closealertwindow(){
	windowt1=0;
	windowopen=0;
	obj=document.getElementById('windowwindowbg');
	obj.style.display='none';
}