

function banners(i) {
     i1 = 0;
     sek = 5000;
     var picturs;
     var alt;
     m = i;
//    alert(imgArray);
    if (imgArray != ''){
         picturs = imgArray[i];
         alt = nameArray[i];
         document.getElementById('offers').src = picturs;
         document.getElementById('offers').title = alt;
         document.getElementById('offers').alt = alt;
         i = i + 1;
            if (i == imgArray.length) { 
                  i = 0;
                  }
        j = i;
        timerID = setTimeout("banners(j)",sek);
    }
    else{
        document.getElementById('offers_p').innerHTML = '';
    }
}

function hrefs() {
     var ssylka;
     ssylka = hreArray[m];
     hrefsWin = open(ssylka, "_blank");
}


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


function openQuest()
{
//    alert("asd");
    var url = document.URL;
//    MessageShow('<div style="background-color:#666666;display:block;height:100%;left:0;opacity:0.3;position:absolute;top:0;width:100%;z-index:30;">213</div>', 0);
    var imgWin = window.open("http://www.zvezdy.ru/quest.php?URL="+url, "popupWindow", "resizable=no,scrollbars=no,toolbar=no,location=no,directoties=no,status=no,menubar=no,width=430,height=420");
//    var imgWin = window.open("", "popupWindow", "resizable=no,scrollbars=no,toolbar=no,location=no,directoties=no,status=no,menubar=no,width=500,height=400");
//	imgWin.document.open();
//	imgWin.document.write("<html><head><title>�������� ���� �����</title></head><body topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0 marginheight=0 marginwidth=0>    <form method='POST'>    <input type='hidden' name='url' value=''>     <table><tr><td>���</td><td><input type='text' style='width:345px;'></td></tr>    <tr><td></td><td></td></tr>        <tr><td></td><td><textarea rows='15' cols='40'>        </textarea>        </td></tr>        <tr><td></td><td><input type='submit'></td></tr></table>    </form></body></html>");
//	imgWin.document.close();
//	imgWin.focus();  
}
function popupImage(vUrl, vTitle, vWidth, vHeight) {
	var imgWin = window.open("", "popupWindow", "resizable=no,scrollbars=no,toolbar=no,location=no,directoties=no,status=no,menubar=no,width="+vWidth+",height="+vHeight);
	imgWin.document.open();
	imgWin.document.write("<html><head><title>"+vTitle+"</title></head><body topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0 marginheight=0 marginwidth=0><img src='"+vUrl+"' border=0></body></html>");
	imgWin.document.close();
	imgWin.focus();  
	return false;
}

function popupWindow(vUrl, vTitle, vWidth, vHeight) {
	var imgWin = window.open(vUrl, "popupWindow", "resizable=no,scrollbars=yes,toolbar=no,location=no,directoties=no,status=no,menubar=no,width="+vWidth+",height="+vHeight);
	imgWin.focus();  
	return false;
}

function ShowSmallFoto(img){
 MessageShow('<div style="cursor:hand; background: url('+img+') center no-repeat; width: 200px; height: 200px;"></div>', 0);
}

function SmallFotoClose() {
    MessageClose();
}

function MessageClose() {
    if (document.getElementById("pop_up_message")) {
        PopUpClose("pop_up_message");
    }
}

function PopUpClose(id) {
    if (document.getElementById(id)) {
        if (document.getElementById("frame_source_" + id)) {
            document.getElementById("frame_source_" + id).src = "";
        }
        if (document.getElementById("body_" + id)) {
            document.getElementById("body_" + id).innerHTML = "";
        }
        document.getElementById(id).innerHTML = "";
        document.getElementById(id).style.display = "none";
    }
}

function MessageShow(msg, pop_up_timeout){
 if(document.getElementById('pop_up_message')){
  PopUpClick('pop_up_message', '', 0, msg, pop_up_timeout, true);
 }
}

function PopUpClick(id, frame_src, popup_type, message, pop_up_timeout, pop_up_centering) {
    if (document.getElementById(id)) {
        document.getElementById(id).style.display = "block";
        if (src = "") {
            PopUpWrite(id, 0, message);
        } else {
            PopUpWrite(id, popup_type, message);
            if (document.getElementById("body_" + id)) {
                document.getElementById("body_" + id).innerHTML = "\u0412\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442\u0441\u044F \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0430...";
            }
            if (document.getElementById("frame_source_" + id)) {
                if (document.getElementById("frame_source_" + id).location) {
                    document.getElementById("frame_source_" + id).location.href = frame_src;
                } else {
                    document.getElementById("frame_source_" + id).src = frame_src;
                }
            }
        }
        if (pop_up_centering) {
            PopUpCentering(id);
        }
        if (pop_up_timeout > 0) {
            PopUpTimeoutClose(id, pop_up_timeout);
        }
    }
}

function PopUpWrite(id, popup_type, message) {
    if (document.getElementById(id)) {
        if (document.getElementById(id).title) {
            window_name = document.getElementById(id).title;
        } else {
            window_name = "";
        }
        if (document.getElementById(id).style.width) {
            width = document.getElementById(id).style.width;
        } else {
            width = "100%";
        }
        if (document.getElementById(id).style.height) {
            height = document.getElementById(id).style.height;
        } else {
            height = "600px";
        }
        if (document.getElementById(id).style.height) {
            style = "height:" + height + ";overflow:auto;";
        } else {
            style = "";
        }
        pop_up_write = "<table class=\"popup\" width=\"" + width + "\">";
        pop_up_write += "<tr class=\"popup_header\"><td class=\"setmoveable\">&nbsp<b>" + window_name + "</b></td><td width=\"1%\" align=\"right\"></td></tr>";
        if (message != "") {
            pop_up_write += "<tr><td colspan=\"2\">" + message + "</td></tr>";
        }
        if (popup_type == 1) {
            pop_up_write += "<tr><td colspan=\"2\"><iframe id=\"frame_source_" + id + "\" name=\"frame_source_" + id + "\" height=\"" + height + "\" width=\"" + width + "\" frameborder=\"0\" src=\"\"></iframe></td></tr>";
        }
        if (popup_type == 2) {
            pop_up_write += "<tr><td colspan=\"2\"><div id=\"body_" + id + "\" style=\"" + style + "\"></div><iframe id=\"frame_source_" + id + "\" name=\"frame_source_" + id + "\" onload=\"pop_up_source_Onload('" + id + "');\" height=\"0\" width=\"0\" frameborder=\"0\" src=\"\"></iframe></td></tr>";
        }
        pop_up_write += "<tr class=\"popup_footer\"><td colspan=\"2\" class=\"setmoveable\" align=\"center\"><a href=\"javascript:PopUpClose('" + id + "');\" class=\"menu\"><b>\u0437\u0430\u043A\u0440\u044B\u0442\u044C</b></a></td></tr>";
        pop_up_write += "</table>";
        document.getElementById(id).innerHTML = pop_up_write;
    }
}

function PopUpCentering(objID) {
    pos = new Array(2);
    pos = ScrollPositionXY();
    var obj = document.getElementById(objID);
    try {
        tx = parseInt(obj.style.left + 0, 10);
        ty = parseInt(obj.style.top + 0, 10);
        
        obj.style.left = 400 + "px";
        if (pos[1] < 480) {
            shift = 480 - pos[1];
        } else {
            shift = 10;
        }
        obj.style.top = shift + pos[1] + "px";
    } catch (E) {
        alert(E);
    }
}
function PopUpTimeoutClose(id, pop_up_timeout) {
    if (pop_up_timeout > 0) {
        setTimeout("PopUpClose('" + id + "')", pop_up_timeout);
    }
}

function ScrollPositionXY() {
    var scrOfX = 0, scrOfY = 0;
    if (typeof window.pageYOffset == "number") {
        scrOfY = window.pageYOffset;
        scrOfX = window.pageXOffset;
    } else if (document.body &&
        (document.body.scrollLeft || document.body.scrollTop)) {
        scrOfY = document.body.scrollTop;
        scrOfX = document.body.scrollLeft;
    } else if (document.documentElement &&
        (document.documentElement.scrollLeft ||
        document.documentElement.scrollTop)) {
        scrOfY = document.documentElement.scrollTop;
        scrOfX = document.documentElement.scrollLeft;
    }
    return [scrOfX, scrOfY];
}

function PopUpClose(id) {
    if (document.getElementById(id)) {
        if (document.getElementById("frame_source_" + id)) {
            document.getElementById("frame_source_" + id).src = "";
        }
        if (document.getElementById("body_" + id)) {
            document.getElementById("body_" + id).innerHTML = "";
        }
        document.getElementById(id).innerHTML = "";
        document.getElementById(id).style.display = "none";
    }
}

function Compare( id, obj ){
	var type;
	if (obj.checked==true) type=1;
	if (obj.checked==false) type=0;
	
	xajax_Compare( id, type )
}

  function checkForm() {
	  if (document.add_blog.name.value == "") {
		alert("����������, ������� ���");
		document.add_blog.name.focus();
		return (false);
		}
		if (document.add_blog.name.value > "") {
		var count = document.add_blog.name.value.length
		if (count < 2 || count > 25) {
			alert("��� ������� ��������� �� ����� 2 � �� ����� 25 ��������");
			document.add_blog.name.focus();
			return (false);
			}	
		}
	  
	  if (document.add_blog.text_add_blog.value.length < 2) {
		var count = document.add_blog.text_add_blog.value.length
		if (count < 2 ) {
			alert("����� ���������� ������ ��������� �� ����� 2-� ��������");
			document.add_blog.text_add_blog.focus();
			return (false);
			}	
		}	
  document.add_blog.submit();
  }
	  
	  
  function From(id, user){
  	document.add_blog.from.value=id;
	document.getElementById('to').innerHTML = '�������� ����������� ��� '+user;
  	document.add_blog.text_add_blog.focus();
  }