
function disable_1 (v) {
  var i = 0;
  var j = 0;
  while (document.getElementById('country['+i+']'))
  {
	  document.getElementById('country['+i+']').disabled=v;
	  
	  if (v) {
		  document.getElementById('country['+i+']').checked=false;
	  }
	  i++;	
  }
  
  while (document.getElementById('sotrasl['+j+']'))
  {
	  document.getElementById('sotrasl['+j+']').disabled=false;
	  j++;
  }
  document.getElementById('bcgrnd1').style.backgroundColor = 'f2f1ee';
  document.getElementById('bcgrnd2').style.backgroundColor = 'cacab2';
}

function disable_2 (v) {
  var i = 0;
  var j = 0;
  while (document.getElementById('sotrasl['+i+']'))
  {
	  document.getElementById('sotrasl['+i+']').disabled=v;
	  
	  if (v) {
		  document.getElementById('sotrasl['+i+']').checked=false;
	  }
	  i++;
  }
  while (document.getElementById('country['+j+']'))
  {
	  document.getElementById('country['+j+']').disabled=false;
	  j++;
  }
  document.getElementById('bcgrnd1').style.backgroundColor = 'cacab2';
  document.getElementById('bcgrnd2').style.backgroundColor = 'f2f1ee';
}


// функция создающая окно c картинкой (используется в админке)
function adminFotoimgWindow(file, bigfile, page_title){
var features = "top=10, left=10, width=700 , height=560, scrollbars=yes, status=no, toolbar=no, menubar=no, resizable=yes";
adminFotoWin = window.open('','fotowin',features);
onlynamebig=bigfile.substring(bigfile.lastIndexOf("/")+1);
adminFotoWin.focus();
adminFotoWin.document.write("<html><head><title>"+page_title+"</title>");
adminFotoWin.document.write("<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">");
adminFotoWin.document.write("<META NAME='Author' CONTENT='arsenieff.ru'>");  
adminFotoWin.document.write("<link rel=stylesheet type=\"text/css\" href=\"/css/rosmould.css\">");
adminFotoWin.document.write("</head><body bgcolor=#FFFFFF leftmargin=0 topmargin=0 marginheight=0 marginwidth=0 rightmargin=0 bottommargin=0>");
adminFotoWin.document.write("<p class=\"text2\"><strong>"+page_title+"&nbsp;</strong></p>");
adminFotoWin.document.write("<table align=\"center\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\" class=\"print_table\"><tr><td  align=\"center\" valign=\"middle\"><img src=\""+file+"\" border=\"0\"></td></tr></table>");
adminFotoWin.document.write("<p><strong>Скачать: </strong><a href=\""+bigfile+"\" target=\"_blank\" class=\"podfoto\">"+onlynamebig+"</a></p>");
adminFotoWin.document.write("<body></html>");
adminFotoWin.document.close();
};

// функция создающая окно в фотогаллерии
function FotoimgWindow(file, bigfile, bigwight, bigheight, page_title)
{
var features = "top=10, left=10, width=700, height=590, scrollbars=yes, status=no, toolbar=no, menubar=no, resizable=yes";
myFotoWin = window.open('', 'fotowin', features);
onlynamebig=bigfile.substring(bigfile.lastIndexOf("/")+1);
myFotoWin.focus();
myFotoWin.resizeTo(700,590);
myFotoWin.document.writeln("<html><head><title>"+page_title+"</title>");
myFotoWin.document.writeln("<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">");
myFotoWin.document.writeln("<META NAME='Author' CONTENT='Arsenyev A.V.'>");  
myFotoWin.document.writeln("<link rel=stylesheet type=\"text/css\" href=\"/css/rosmould.css\">");
myFotoWin.document.writeln("</head><body bgcolor=#FFFFFF leftmargin=0 topmargin=0 marginheight=0 marginwidth=0 rightmargin=0 bottommargin=0>");
myFotoWin.document.writeln("<p class=\"text2\"><strong>"+page_title+"&nbsp;</strong></p>");
myFotoWin.document.writeln("<table align=\"center\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\" class=\"print_table\"><tr><td  align=\"center\" valign=\"middle\"><img src=\""+file+"\" border=\"0\"></td></tr></table>");
myFotoWin.document.writeln("<p class=\"text2\"><strong>Скачать: </strong><a href=\""+bigfile+"\" target=\"_blank\" class=\"podfoto\">"+onlynamebig+" ("+bigwight+"x"+bigheight+"px)</a></p>");
myFotoWin.document.writeln("<body></html>");
myFotoWin.document.close();
};


// если мыло валидное вертает истину
function emailverify(email)
{
	function emailCheck (email) {
	var emailPat=/^(.+)@(.+).(.+)$/;
	var matchArray=email.match(emailPat);
	if (matchArray==null) {
		return false;
	}
		return true;
	}
	
	function cyrCheck (email) {
	var cyrPat=/[а-яА-Я]/;
	var matchArray2=email.match(cyrPat);
	if (matchArray2==null) {
		return false;
	}
		return true;
	}

	if ((email.indexOf('@') == -1)  ||
		(email.indexOf('.') == -1)  ||
		(email.indexOf('/') != -1)  ||
		(email.indexOf('\\') != -1) ||
		(email.indexOf('*') != -1)  ||
		(email.indexOf('?') != -1)  || 
		!emailCheck(email) ||
		cyrCheck(email))
	{
		return false;					
	} else {
		return true;
	}

	return true;
};

function imgWindow(file,width_len,height_len,page_title){
var features = "top=20, left=20, width=100 , height=100, scrollbars=yes,status=no,toolbar=no,menubar=no,resizable=yes";
myWin = window.open('','foto',features);
//alert(file);
myWin.focus();
w=width_len; 
w=w+29;
h=height_len;
if (h <= 520 ){
	h=h+40;} 
else {
	h=520;
};
myWin.resizeTo(w,h);
myWin.document.write("<html><head><title>"+page_title+"</title>");
myWin.document.write("<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">");
myWin.document.write("<META NAME='Author' CONTENT='arsenieff.ru'>");  
myWin.document.write("</head><body bgcolor=#FFFFFF leftmargin=0 topmargin=0 marginheight=0 marginwidth=0 rightmargin=0 bottommargin=0>");
myWin.document.write("<table border=0 cellspacing=0 cellpadding=0 align=center width=\"100%\"><tr><td align=center><img src=\""+file+"\" alt=\""+page_title+"\" width="+width_len+" height="+height_len+" border=0>");
myWin.document.write("</td></td></table><body></html>");
myWin.document.close();
};

// функция создаёт оконо, но контролирует размер на 1024*768
function imgWindow_fix(file,width_len,height_len,page_title){
var features = "top=10, left=10, width=100, height=100, scrollbars=yes, status=no, toolbar=no, menubar=no, resizable=yes";
myWin = window.open('','foto',features);
//alert(file);
myWin.focus();
w=width_len; 
h=height_len;
if (h <= 600 ){
	h=h+90;} 
else {
	h=600;
};

if (w <= 900){
	w=w+50;}
else{
	w=900;
};
myWin.resizeTo(w,h);
myWin.document.write("<html><head><title>"+page_title+"</title>");
myWin.document.write("<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">");
myWin.document.write("<META NAME='Author' CONTENT='arsenieff.ru'>");  
myWin.document.write("</head><body bgcolor=#FFFFFF leftmargin=0 topmargin=0 marginheight=0 marginwidth=0 rightmargin=0 bottommargin=0>");
myWin.document.write("<table border=0 cellspacing=0 cellpadding=0 align=center width=\"100%\"><tr><td align=center><img src=\""+file+"\" alt=\""+page_title+"\" width="+width_len+" height="+height_len+" border=0>");
myWin.document.write("</td></td></table><body></html>");
myWin.document.close();
};

// this function make popup-window with doubling title in popup, control popup size (max 1024*768)
//  work with function form func/func.php rosmould_popup_img_2 determinate calculate size pic
function imgWindow_fix_tit(file,width_len,height_len,page_title){
var features = "top=10, left=10, width=100, height=100, scrollbars=yes, status=no, toolbar=no, menubar=no, resizable=yes";
myWin = window.open('','foto',features);
//alert(file);
myWin.focus();
w=width_len; 
h=height_len;
if (h <= 600 ){
	h=h+120;} 
else {
	h=600;
};

if (w <= 900){
	w=w+60;}
else{
	w=900;
};
myWin.resizeTo(w,h);
myWin.document.write("<html><head><title>"+page_title+"</title>");
myWin.document.write("<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">");
myWin.document.write("<META NAME='Author' CONTENT='arsenieff.ru'>");  
myWin.document.write("<link rel=stylesheet type=\"text/css\" href=\"css/rosmould.css\">"); 
myWin.document.write("</head><body bgcolor=#FFFFFF leftmargin=0 topmargin=0 marginheight=0 marginwidth=0 rightmargin=0 bottommargin=0>");
myWin.document.write("<div align=center><h1>"+page_title+"</h1><img src=\""+file+"\" title=\""+page_title+"\" width="+width_len+" height="+height_len+" border=0>");
myWin.document.write("</div><body></html>");
myWin.document.close();
};


