function newImg(i){p=new Image(); p.src=i; return p;}

var m1 = newImg("/_img/ru.gif");
var m1_o = newImg("/_img/ru_o.gif");

var m3 = newImg("/_img/ua.gif");
var m3_o = newImg("/_img/ua_o.gif");

var m4 = newImg("/_img/en.gif");
var m4_o = newImg("/_img/en_o.gif");

var m2 = newImg("/_img/close-it.gif");
var m2_o = newImg("/_img/close-it_o.gif");

function over(img) {
	document[img].src = eval(img + "_o.src");
}
function out(img) {
	document[img].src = eval(img + ".src");
}

function openPic(picName) {
	//DownloadFile("/files/pic/"+picName);
	OpenWindow("/pictures.php?pic_id="+picName,parseInt(picName.substr(3,3)),440);
}
function openAni(picName) {
	//DownloadFile("/files/ani/"+picName);
	OpenWindow("/animations.php?ani_id="+picName,parseInt(picName.substr(3,3)),440);
}
function openMp3(picName) {
	//DownloadFile("/files/mp3/"+picName);
	OpenWindow("/mp3.php?mp3_id="+picName,300,248);
}
function PlayGame(picName) {
	
	OpenWindow("/games.php?game_id="+picName,600,400);
}
function openVideo(picName) {
	OpenWindow("/video.php?video_id="+picName,400,328);
//	alert("заменить скриптом открывающим окно с видео №" + picName)
}
function openContacts1() {
	alert("send letter window")
}
function openContacts2() {
	alert("multiform window")
}
function openCard(picName) {
	OpenWindow("/postcards?postcard_id="+picName,800,470);
//	alert("заменить скриптом открывающим окно с открыткой №" + picName)
}
function openZast(picName) {
	//DownloadFile("/files/zast/"+picName);
	OpenWindow("/zast.php?zast_id="+picName,400,348);
//	alert("заменить скриптом открывающим окно с заставкой " + picName)
}

function DownloadFile(file){
	document.location.href="/download.php?file="+file;
}
function OpenWindow(url,width,height){
loadwindow2(url,width,height);
/*if (window.showModalDialog) {
		alert("+++");
	 window.showModalDialog(url,'video',"dialogWidth:"+width+"px;dialogHeight:"+height+"px");
}else{
	window.open(url,'video',"width="+width+",height="+height+",status=0,toolbar=no,menubar=no,location=no,left="+((window.screen.width-width)/2)+",top="+((window.screen.height-height)/2));
}*/
}

/*var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety
}
}
*/
/*function initializedrag(e){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
if (ie5)
document.getElementById("saver").style.display=''

tempx=parseInt(document.getElementById("dwindow").style.left)
tempy=parseInt(document.getElementById("dwindow").style.top)

dragapproved=true
document.onmousemove=drag_drop
}*/

function loadwindow2(url,width,height){
if(document.getElementById('cframe')&&document.getElementById('cframe').contentWindow.document.getElementsByTagName("body")[0])
document.getElementById('cframe').contentWindow.document.getElementsByTagName("body")[0].innerHTML="";
else
document.getElementById('cframe').contentDocument.document.body.innerHTML="";
document.getElementById("back").style.display=''
document.getElementById("skin").style.display=''
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width
document.getElementById("dwindow").style.height=initialheight=height
document.getElementById("skin").style.width=width;
document.getElementById("top-bg").style.width=width;
document.getElementById("bottom-bg").style.width=width-6;
document.getElementById("skin").style.height=height;
document.getElementById("left-bg").style.height=height-5;
document.getElementById("right-bg").style.height=height-5;
document.getElementById("skin").style.left=((window.screen.width-width)/2);
document.getElementById("skin").style.top=100+"px";
document.getElementById("cframe").src=url
}
//}
/*
function maximize(){
	return;
if (minrestore==0){
minrestore=1 //maximize window
document.getElementById("maxname").setAttribute("src","restore.gif")
document.getElementById("dwindow").style.width=ns6? window.innerWidth-20 : document.body.clientWidth
document.getElementById("dwindow").style.height=ns6? window.innerHeight-20 : document.body.clientHeight

}
else{
minrestore=0 //restore window
document.getElementById("maxname").setAttribute("src","max.gif")
document.getElementById("dwindow").style.width=initialwidth
document.getElementById("dwindow").style.height=initialheight
}
document.getElementById("dwindow").style.left=ns6? window.pageXOffset : document.body.scrollLeft
document.getElementById("dwindow").style.top=ns6? window.pageYOffset : document.body.scrollTop
}*/

function closeit(){
document.getElementById("back").style.display="none"
document.getElementById("skin").style.display="none"
document.getElementById("dwindow").style.display="none"
if(document.getElementById('cframe')&&document.getElementById('cframe').contentWindow.document.getElementsByTagName("body")[0])
document.getElementById('cframe').contentWindow.document.getElementsByTagName("body")[0].innerHTML="";
else
document.getElementById('cframe').contentDocument.document.body.innerHTML="";
document.getElementById("cframe").src="about:blank"
}

