function ConfirmDelete() {
	return (window.confirm("Вы уверены, что хотите удалить?"));

}
function clSelfrelOp(){

	self.close();
	self.opener.location.reload();
}
function delPopup(url){

	var del;
	del = ConfirmDelete();
	if (del != false){

		PopupWindow(url);

	}

}
var newWindow;
function PopupWindow(URL) {
	self.name="smmain"
	var topPos=0;
	var leftPos=(screen.width-340)>>1;
	var winHeight=screen.height-80;
	if (!newWindow || newWindow.closed) {
		newWindow = window.open(URL, "details", "dependent=yes,top="+topPos+",left="+leftPos+",height=600,width=600,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");
	} else
	{		newWindow.document.location.href = URL;
	newWindow.focus();
	}

}
function delPopup(url){

	var del;
	del = ConfirmDelete();
	if (del != false){

		PopupWindow(url);

	}

}
/*function isinArray(array,find){

var cc = 0;
for (var i = 0; i < array.length; i++) {
if (array[i] == find){

cc += 1;}


}
if(cc > 0){
return true;
} else {
return false;
}

}*/

function isinArray(array,find){

	if (array.length>1){
		var cc = 0;
		for (var i = 0; i < array.length; i++) {
			if (array[i] == find){

				cc += 1;}


		}
		if(cc > 0){
			return true;
		} else {
			return false;
		}
	} else {
		if(array == find){
			return true;
		} else {
			return false;
		}
	}
}

function string2Array(string) {
	eval("var result = " + string);
	return result;
}
function getElementWithId(id){
	var obj = null;
	if(document.getElementById){
		/* Prefer the widely supported W3C DOM method, if
		available:-
		*/
		obj = document.getElementById(id);
	}else if(document.all){
		/* Branch to use document.all on document.all only
		browsers. Requires that IDs are unique to the page
		and do not coincide with NAME attributes on other
		elements:-
		*/
		obj = document.all[id];
	}
	/* If no appropriate element retrieval mechanism exists on
	this browser this function always returns null:-
	*/
	return obj;
}
  function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) {
         result = obj.getAttributeNode("class").value;
     }
     return result;
  }   


function stripe(id) {

	// the flag we'll use to keep track of
	// whether the current row is odd or even
	var even = false;

	// if arguments are provided to specify the colours
	// of the even & odd rows, then use the them;
	// otherwise use the following defaults:
	var evenColor = arguments[1] ? arguments[1] : "#fff";
	var oddColor = arguments[2] ? arguments[2] : "#eee";

	// obtain a reference to the desired table
	// if no such table exists, abort
	var table = document.getElementById(id);
	if (! table) { return; }

	// by definition, tables can have more than one tbody
	// element, so we'll have to get the list of child
	// &lt;tbody&gt;s
	var tbodies = table.getElementsByTagName("tbody");

	// and iterate through them...
	for (var h = 0; h < tbodies.length; h++) {

		// find all the &lt;tr&gt; elements...
		var trs = tbodies[h].getElementsByTagName("tr");

		// ... and iterate through them
		for (var i = 0; i < trs.length; i++) {

			// avoid rows that have a class attribute
			// or backgroundColor style
			if (!hasClass(trs[i]) && ! trs[i].style.backgroundColor) {

				// get all the cells in this row...
				var tds = trs[i].getElementsByTagName("td");

				// and iterate through them...
				for (var j = 0; j < tds.length; j++) {

					var mytd = tds[j];

					// avoid cells that have a class attribute
					// or backgroundColor style
					if (! hasClass(mytd) && ! mytd.style.backgroundColor) {

						mytd.style.backgroundColor = even ? evenColor : oddColor;

					}
				}
			}
			// flip from odd to even, or vice-versa
			even =  ! even;
		}
	}
}

/*function validate(reqs) {
	
	var errors='';
	for (var i = 0; i < reqs.length; i++) {
		
		var str = document.getElementById(reqs[i]).value;
		//alert(str.length);
		if(str == '' || str.length < 9) {
		   errors +=(reqs[i] +" is empty! \n");
		} 
	}
	 if (errors != ''){
  alert(errors);
  return false;
  } else {
   return true; 
	
}

}*/

function redirect(url){
document.location.href = url;
}