function CheckAndSubmit(id){
	var flag = true;
	$("#"+id+" .ness").each(function(){
		if( $(this).val() == "" ) {
			$(this).focus().addClass("ness_bord");
			flag = false;
			return false;
		} else {
			$(this).removeClass("ness_bord");
		}
	});
	if(flag)
		$("#"+id).submit();
	else return false;
}
function show(id){
	layer = document.getElementById(id);
	if(layer.style.display == "none")
		layer.style.display = "block";
	else 
		layer.style.display = "none";
}
function openwin_text(url , w , h){
	window.open(url,"","toolbar=no,location=no,directories=no,resizable=no,scrollbars=no,width="+w+",height="+h);
}
function pics(img,ref){
	document.images[img].src = ref;
}
function openwin(img,w,h,title){
 var hWnd;
 if(hWnd!=null) hWnd.close();
 hWnd=window.open(img,"","toolbar=no,location=no,directories=no,resizable=no,left=100,top=100,width="+w+",height="+h);
 hWnd.document.open();
 hWnd.document.write("<html><head><title>"+title+"</title></head><body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>");
 hWnd.document.write("<img src=\""+img+"\" width="+w+" height="+h+">");
 hWnd.document.write("</body></html>");
 hWnd.document.close();
}
function openwindow( img , w , h , title ){
	if( hwnd != null )
	hwnd.close();
	hwnd = window.open( img , "" , "toolbar=no , location=no , directories=no , resizable=no , width=" + w + " , height=" + h );
	hwnd.document.open();
	hwnd.document.write("<html>");
	hwnd.document.write("<head>");
	hwnd.document.write("<title>" + title + "</title>");
	hwnd.document.write("</head>");
	hwnd.document.write("<body bgcolor=#ffffff bottommargin=0 leftmargin=0 marginheight=0 marginwidth=0 rightmargin=0 topmargin=0 style='border:0px;'>");
	hwnd.document.write("<table align=center width=100% height=100% cellspacing=0 cellpadding=0 border=0>");
	hwnd.document.write("<tr><td><img src='" + img + "' border=0></td></tr>");
	hwnd.document.write("</table></body></html>");
	hwnd.document.close();
}
function openproduct(img,w,h,title,info){
 var hWnd;
 if(hWnd!=null) hWnd.close();
 if(info!='') h2 = h + 16*(info.length/70)+30; else h2 = h;
 hWnd=window.open(img,"","toolbar=no,location=no,directories=no,resizable=no,left=100,top=100,width="+w+",height="+h2);
 hWnd.document.open();
 hWnd.document.write("<html><head><title>"+title+"</title></head><body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>");
 hWnd.document.write("<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=windows-1251\">");
 hWnd.document.write("<LINK href=\"/inc/cssw.css\" type=text/css rel=stylesheet>");
 hWnd.document.write("<img src='/i/emp.gif' STYLE='BACKGROUND:url("+img+");' WIDTH="+w+" HEIGHT="+h+">");
 if(info!='') hWnd.document.write("<DIV STYLE='PADDING:7px;'>"+info+"</DIV>");
 hWnd.document.write("</body></html>");
 hWnd.document.close();
}
function setColor(element_id, cc){
	document.getElementById( element_id ).style.backgroundColor = cc;
}
function showObject(obj){
	obj.className = "visible"
}
function hideObject(obj){   
	obj.className = "hidden"
}
function show_div(id){
	var div;
	div = document.getElementById(id);
	if ( div.style.display == "none" ) div.style.display = "block";
		else div.style.display = "none";
}
function show_div_in_tree(div_id, picture_id){
	var div_id;
	var picture_id;
	div = document.getElementById(div_id);
	if ( div.style.display == "none" ){
		div.style.display = "block";
		pics(picture_id,"/i/tree_minus.gif");
	}else{
		div.style.display = "none";
		pics(picture_id,"/i/tree_plus.gif");
	}
}
function openwin_text( url , w , h ) {
		window.open( url , "" , "toolbar=no , location=no , directories=no , resizable=no , scrollbars=yes , width=" + w + " , height=" + h );
	}



