// <!--
var layerRef="null", styleSwitch="null";


isDOM=(document.getElementById)? true:false
isNC=navigator.appName=="Netscape"
isNC6=isNC && isDOM

styleSwitch=".style";
vs = "visible";
hd = "hidden";
dvs = "block";
dhd = "none";

function correctWidth() {
	if (isNC && isDOM) {
	document.getElementById("level2").style.marginRight = '230px';
	}
}


if (isDOM) {
   layerRef="document.getElementById";
}
else {
   layerRef="document.all";
}

function hideLayer(layerName){
        eval(layerRef+'("'+layerName+'")'+styleSwitch+'.visibility="'+hd+'"');
        eval(layerRef+'("'+layerName+'")'+styleSwitch+'.display="'+dhd+'"');
}
function showLayer(layerName, point, offsetX, offsetY){

        if (point !== undefined) {
                layerTop = calcTop(eval(layerRef+'("'+point+'")'))+offsetY;
                eval(layerRef+'("'+layerName+'")'+styleSwitch+'.top="'+layerTop+'px"');
        //        layerLeft = calcLeft(eval(layerRef+'("'+point+'")'))+offset;
                layerLeft = offsetX;
                eval(layerRef+'("'+layerName+'")'+styleSwitch+'.left="'+layerLeft+'px"');
        }

        eval(layerRef+'("'+layerName+'")'+styleSwitch+'.visibility="'+vs+'"');
        eval(layerRef+'("'+layerName+'")'+styleSwitch+'.display="'+dvs+'"');
}

function calcTop(x_ele){
//  if (!document.all) return (x_ele.offsetTop);

  var x_ret=0;
  var oParent = x_ele.offsetParent;
  if (oParent == null) return 0
  else x_ret=x_ele.offsetTop + calcTop(oParent);
  return x_ret;
}

function calcLeft(x_ele){
        var x_ret=0;
        var oParent = x_ele.offsetParent;
        if (oParent == null) return 0
        else x_ret=x_ele.offsetLeft + oParent.clientLeft + calcLeft(oParent);
        return x_ret
}


function showHint(layerName, point){

    var y=calcTop(eval(layerRef+'("'+point+'")'));
    var x=calcLeft(eval(layerRef+'("'+point+'")'));
    var posX=x+10; // Є®®а¤Ё­ вл x
    var posY=y+10; // Є®®а¤Ё­ вл y

        eval(layerRef+'("'+layerName+'")'+styleSwitch+'.top="'+posY+'"');
        eval(layerRef+'("'+layerName+'")'+styleSwitch+'.left="'+posX+'"');

        eval(layerRef+'("'+layerName+'")'+styleSwitch+'.visibility="'+vs+'"');
}




function showbible(book,chapter,verse)
{
//	w = window.open("/forum/bible/bibleshow.php?b=" + book + "&c=" + chapter + "&v=" + verse, 'bible', 'height=400, width=450, resizable=yes')
	w = window.open("http://jesuschrist.ru/bible/go.php?b=" + book + "&c=" + chapter + "&v=" + verse, 'bible', 'height=400, width=450, resizable=yes')
	w.focus();
}

function showRSBible(book,chapter,verse)
{
	w = window.open("/forum/bible/bibleshow.php?b=" + book + "&c=" + chapter + "&v=" + verse, 'bible', 'height=400, width=450, resizable=yes')
	w.focus();
}

function openwin(url,w,h)
{
        window.open(url, "", "toolbar=no, status=no, width="+w+", height="+h+", scrollbars=yes, resizable=yes");
}

// Open popups for chat registration stuff
function reg_popup(name)
{
        window.focus();
        url = "/chat/chat/" + name + ".php3?L=russian&Link=1";
        pop_width = (name != 'admin'? 400:510);
        pop_height = (name != 'deluser'? 420:190);
        param = "width=" + pop_width + ",height=" + pop_height + ",resizable=yes,scrollbars=yes";
        name += "_popup";
        window.open(url,name,param);
}


var NS4 = (document.layers) ? 1 : 0;
var IE4 = ((document.all) && (parseInt(navigator.appVersion)>=4)) ? 1 : 0;
var ver4 = (NS4 || IE4) ? "H" : "L";

// Will update the "Ver" field in the form below according to the javascript abilities of
// the browser the users surf with
function defineVerField()
{
        if (document.images && ver4 == 'L')
                document.forms['Params'].elements['Ver'].value = 'M';        // js1.1 enabled browser
        else document.forms['Params'].elements['Ver'].value = ver4;

        setTimeout('document.location.href = document.location.href', 20000);
//        alert("www");
//        settimeout('alert("www")', 5000);
}



function VerificationPrayForm(el)
{
        str_name = el.name.value.replace(/\s/g, "");
        str_text = el.message.value.replace(/\s/g, "");

        if(el.ispublic.checked)
           str_subject = el.subject.value.replace(/\s/g, "");
        
       
        str = "";
        if (str_name == "") str += "Введите имя отправителя \n";
        if (el.ispublic.checked && (str_subject == "")) str += "Введите заголовок сообщения \n";
        if (str_text == "") str += "Введите молитвенную нужду \n";
 
        if(str == "") {
/*
	  		if(el.sctcode.value !== "vasya") {
//	  		    w = window.open("/lib/sctcode/index.php?from=post","sctcode","width=330,height=140,status=0,scrollbars=0,toolbar=0,resizable=1");
	  		    w = window.open("/forum/kcaptcha/prayform.php?from=post","sctcode","width=330,height=160,status=0,scrollbars=0,toolbar=0,resizable=1");
				w.focus();
				
				return false;
			} 		
*/

        	el.submit();
	  		
		}
        else {
            alert(str);
            return false;
        }
	

}

function VerificationCommentForm(el)
{
        str_name = document.commentform.comment_name.value.replace(/\s/g, "");
        str_text = document.commentform.comment_text.value.replace(/\s/g, "");
        str = "";
        if (str_name == "") str += "Введите свое имя \n";
        if (str_text == "") str += "Введите комментарий \n";


        if(str == "") {
		
	  		if(document.commentform.sctcode.value == "") {
	  		    w = window.open("/lib/sctcode/index.php?from=commentform","sctcode","width=330,height=140,status=0,scrollbars=0,toolbar=0,resizable=1");
	     		    w.focus();
			    return false;
			} 		

			el.sndcom.value = 1;
			el.submit(); 
	}
        else {
           alert(str);
           return false;
        }
}

function VerificationSearchForm()
{
        str_text = document.searchform.query.value.replace(/\s/g, "");
        str = "";
        if (str_text == "") str += "Введите строку поиска \n";

        if(str == "") return true;
        else {
               alert(str);
           return false;
        }
}



/*****************/


function getHeight() { 
if (isDOM) send = document.body.clientHeight;
if (isNC) send = window.innerHeight;
return send;
}

function getWidth() { 
if (isDOM) 
send = document.body.clientWidth;
if (isNC) send = window.innerWidth;
return send;
}

function fixCOL(element)
{ 

var wW = getWidth()

if(wW < 780) {
	document.getElementById("rgtBar").style.right = wW-780;
	if (isNC)
		document.getElementById("level2").style.marginRight = wW-560;
	else
		document.getElementById("level2").style.marginRight = wW-590;
}
else {
	document.getElementById("rgtBar").style.right = "10px";
	if (isNC)
	 	document.getElementById("level2").style.marginRight = "230px";
	else
		document.getElementById("level2").style.marginRight = "200px";
}

}













// -->