// Кодировка
// 
function openPhoto(url,id,width,height)
{
	window.open("/photo.php?file="+url,id,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+width+",height="+height)
}

function openPhotonr(url,id,width,height)
{
	window.open("/photo.php?file="+url,id,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width="+width+",height="+height)
}

function openResumeMail(id,width,height)
{
	window.open("/modules/empmail.php?id="+id,id,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+width+",height="+height)
}

function openLetterRudakovMail(id,width,height)
{
	window.open("/modules/rudakovmail.php?id="+id,id,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+width+",height="+height)
}

function showWindowColsultant(par1,par2,par3,par4,width,height)
{
	window.open("/modules/showconsultant.php?id="+par1+"&subrazdel_id="+par2+"&theme_id="+par3+"&q_id="+par4,par1,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+width+",height="+height)
}









function show_answer_cons(p1)
{
if (p1==0) 
{
x0.style.display = "";y0.style.display = "";
x1.style.display = "none";y1.style.display = "none";
x2.style.display = "none";y2.style.display = "none";
x3.style.display = "none";y3.style.display = "none";
x4.style.display = "none";y4.style.display = "none";
x5.style.display = "none";y5.style.display = "none";
}
if (p1==1) 
{
x1.style.display = "";y1.style.display = "";
x0.style.display = "none";y0.style.display = "none";
x2.style.display = "none";y2.style.display = "none";
x3.style.display = "none";y3.style.display = "none";
x4.style.display = "none";y4.style.display = "none";
x5.style.display = "none";y5.style.display = "none";
}
if (p1==2)
{
x2.style.display = "";y2.style.display = "";
x0.style.display = "none";y0.style.display = "none";
x1.style.display = "none";y1.style.display = "none";
x3.style.display = "none";y3.style.display = "none";
x4.style.display = "none";y4.style.display = "none";
x5.style.display = "none";y5.style.display = "none";
}
if (p1==3)
{
x3.style.display = "";y3.style.display = "";
x0.style.display = "none";y0.style.display = "none";
x1.style.display = "none";y1.style.display = "none";
x2.style.display = "none";y2.style.display = "none";
x4.style.display = "none";y4.style.display = "none";
x5.style.display = "none";y5.style.display = "none";
}
if (p1==4)
{
x4.style.display = "";y4.style.display = "";
x0.style.display = "none";y0.style.display = "none";
x1.style.display = "none";y1.style.display = "none";
x2.style.display = "none";y2.style.display = "none";
x3.style.display = "none";y3.style.display = "none";
x5.style.display = "none";y5.style.display = "none";
}
if (p1==5)
{
x5.style.display = "";y5.style.display = "";
x0.style.display = "none";y0.style.display = "none";
x1.style.display = "none";y1.style.display = "none";
x2.style.display = "none";y2.style.display = "none";
x3.style.display = "none";y3.style.display = "none";
x4.style.display = "none";y4.style.display = "none";
}
}

function loader2()
{
bt1.style.display = "none";
bt2.style.display = "none";
bt3.style.display = "none";
bt4.style.display = "none";
bt5.style.display = "none";
}

function count_change1(d,st)
	{
	window.open("templates/mynews/js/ix1.php?x="+d+"&nst="+st,"","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=300");
	}

function count_change2(d,st,n)
	{
	window.open("templates/mynews/js/ix2.php?x="+d+"&nst="+st+"&nnum="+n,"","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=300");
	}

var s=1;
function loader()
{
bt1.style.display = "none";
bt2.style.display = "none";
bt3.style.display = "none";
bt4.style.display = "none";
bt5.style.display = "none";
}

function count_change4(d,st,n)
	{
	var i=5;
	//document.writeln(i);
	//this.window.write('!!');
	//window.open('http://www.samru.ru/templates/mynews/js/ix4.php?x='+d+'&nst='+st+'&nnum='+n,'-','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=300');
	window.open("http://www.samru.ru/templates/mynews/js/ix4.php?x="+d+"&nst="+st+"&nnum="+n,"","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=300");
	return i;
	}

function do_change()
	{
	if (bt1.style.display == "none"){bt1.style.display = "";bt.style.display = "";} else
	if (bt2.style.display == "none"){bt2.style.display = "";bt.style.display = "";} else
	if (bt3.style.display == "none"){bt3.style.display = "";bt.style.display = "";} else
	if (bt4.style.display == "none"){bt4.style.display = "";bt.style.display = "";} else
	if (bt5.style.display == "none"){bt5.style.display = "";bt.style.display = "none";}
	}

function del_photo(s)
	{
	if (s==1)
	{
	bt1.style.display = "none";
	if (bt2.style.display=="none") {bt2.style.display=="none"} else {bt2.style.display==""}
	if (bt3.style.display=="none") {bt3.style.display=="none"} else {bt3.style.display==""}
	if (bt4.style.display=="none") {bt4.style.display=="none"} else {bt4.style.display==""}
	bt.style.display = "";
	}
	if (s==2){bt2.style.display = "none";bt.style.display = "";}
	if (s==3){bt3.style.display = "none";bt.style.display = "";}
	if (s==4){bt4.style.display = "none";bt.style.display = "";}
	if (s==5){bt5.style.display = "none";bt.style.display = "";}
	s--;
	}












var imageTag1 = false;
var theSelection1 = false;


var clientPC1 = navigator.userAgent.toLowerCase();
var clientVer1 = parseInt(navigator.appVersion); 

var is_ie1 = ((clientPC1.indexOf("msie") != -1) && (clientPC1.indexOf("opera") == -1));
var is_nav1 = ((clientPC1.indexOf('mozilla')!=-1) && (clientPC1.indexOf('spoofer')==-1)
                && (clientPC1.indexOf('compatible') == -1) && (clientPC1.indexOf('opera')==-1)
                && (clientPC1.indexOf('webtv')==-1) && (clientPC1.indexOf('hotjava')==-1));
var is_moz1 = 0;

var is_win1 = ((clientPC1.indexOf("win")!=-1) || (clientPC1.indexOf("16bit") != -1));
var is_mac1 = (clientPC1.indexOf("mac")!=-1);




bbcode1 = new Array();
bbtags1 = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[red]','[/red]','[blue]','[/blue]','[green]','[/green]');
imageTag1 = false;




function getarraysize1(thearray1) {
   for (i = 0; i < thearray1.length; i++) {
      if ((thearray1[i] == "undefined") || (thearray1[i] == "") || (thearray1[i] == null))
         return i;
      }
   return thearray1.length;
}


function arraypush1(thearray1,value) {
   thearray1[ getarraysize1(thearray1) ] = value;
}


function arraypop1(thearray1) {
   thearray1size = getarraysize1(thearray1);
   retval = thearray1[thearray1size - 1];
   delete thearray1[thearray1size - 1];
   return retval;
}


function bbstyle1(bbnumber1) {

   var txtarea = document.add_news.answer;
// document.writeln(txtarea);
   txtarea.focus();
   donotinsert = false;
   theSelection1 = false;
   bblast = 0;


   if ((clientVer1 >= 4) && is_ie1 && is_win1)
   {
      theSelection1 = document.selection.createRange().text;
      if (theSelection1) {

         document.selection.createRange().text = bbtags1[bbnumber1] + theSelection1 + bbtags1[bbnumber1+1];
         txtarea.focus();
         theSelection1 = '';
         return;
      }
   }
   else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
   {
      mozWrap1(txtarea, bbtags1[bbnumber1], bbtags1[bbnumber1+1]);
      return;
   }


   for (i = 0; i < bbcode1.length; i++) {
      if (bbcode1[i] == bbnumber1+1) {
         bblast = i;
         donotinsert = true;
      }
   }

   if (donotinsert) {
      while (bbcode1[bblast]) {
            butnumber = arraypop1(bbcode1) - 1;
            txtarea.value += bbtags1[butnumber + 1];
            buttext = eval('document.add_news.addbbcode1' + butnumber + '.value');
            eval('document.add_news.addbbcode1' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
            imageTag1 = false;
         }
         txtarea.focus();
         return;
   } else {



    
      txtarea.value += bbtags1[bbnumber1];
      txtarea.value += bbtags1[bbnumber1+1];
      
      
      
      
      
      txtarea.focus();
      return;
   }
   storeCaret1(txtarea);
}


function mozWrap1(txtarea, open, close)
{
   var selLength = txtarea.textLength;

   var selStart = txtarea.selectionStart;
   var selEnd = txtarea.selectionEnd;
   if (selEnd == 1 || selEnd == 2)
      selEnd = selLength;

   var s1 = (txtarea.value).substring(0,selStart);
   var s2 = (txtarea.value).substring(selStart, selEnd)
   var s3 = (txtarea.value).substring(selEnd, selLength);
    txtarea.value = s1 + open + s2 + close + s3;
   return;
}



function storeCaret1(textEl) {
   if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}


function bbfontstyle1(bbopen, bbclose) {
   var txtarea = document.add_news.answer;

   if ((clientVer1 >= 4) && is_ie1 && is_win1) {
      theSelection1 = document.selection.createRange().text;
      if (!theSelection1) {
         txtarea.value += bbopen + bbclose;
         txtarea.focus();
         return;
      }
      document.selection.createRange().text = bbopen + theSelection1 + bbclose;
      txtarea.focus();
      return;
   }
   else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
   {
      mozWrap1(txtarea, bbopen, bbclose);
      return;
   }
   else
   {
      txtarea.value += bbopen + bbclose;
      txtarea.focus();
   }
   storeCaret1(txtarea);
}