function showPop(name) {
	document.getElementById(name).className='vis';
}
function hidePop(name) {
	document.getElementById(name).className='hid';
	
}
function Clear (name)
{
	document.getElementById(name).innerHTML="";
}



function ImgShw(ID, width, height, alt)
{

	var scroll = "no";

	var top=0, left=0;

	if(width > screen.width-10 || height > screen.height-28) scroll = "yes";

	if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14);

	if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5);

	width = Math.min(width, screen.width-10);

	height = Math.min(height, screen.height-28);

	var wnd = window.open("","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left ="+left+",top="+top);

	wnd.document.write(

		"<html><head>"+"<"+"script type=\"text/javascript\">"+
		"function KeyPress()"+
		"{"+		"	if(window.event.keyCode == 27) "+
		"		window.close();"+
		"}"+
		"</"+"script>"+

		"<title>"+(alt == ""? "Картинка":alt)+"</title></head>"+

		"<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onKeyPress=\"KeyPress()\">"+

		"<img src=\""+ID+"\" border=\"0\" alt=\""+alt+"\" />"+

		"</body></html>"

	);

	wnd.document.close();

}


function showPop(name) {
	document.getElementById(name).className='vis';
}
function hidePop(name) {
	document.getElementById(name).className='hid';
	
}
function Clear (name)
{
	document.getElementById(name).innerHTML="";
}



function FlwShw(ID, width, height, alt)
{

	var scroll = "no";

	var top=0, left=0;

	if(width > screen.width-10 || height > screen.height-28) scroll = "yes";

	if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14);

	if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5);

	width = Math.min(width, screen.width-10);

	height = Math.min(height, screen.height-28);

	var wnd = window.open("","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left ="+left+",top="+top);

	wnd.document.write(

		"<html><head>"+"<script type=\"text/javascript\" src=\"/bitrix/templates/main/js/swfobject.js\"></script>"+"<"+"script type=\"text/javascript\">"+
		"function KeyPress()"+
		"{"+		"	if(window.event.keyCode == 27) "+
		"		window.close();"+
		"}"+
		"</"+"script>"+

		"<title>"+(alt == ""? "Ролик":alt)+"</title></head>"+

		"<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onKeyPress=\"KeyPress()\" style=\"background:transparent url(/bitrix/templates/main/img/ico/ico-play.gif)center center no-repeat\" OnClick=\"window.location.reload();\">"+
        "<div id=\"banner\" style=\"cursor:hand;\" OnClick=\"window.location.reload();\" >"+
        	"<script type=\"text/javascript\">"+
                    "var so = new SWFObject(\""+ID+"\", \"fl01\", \""+width+"\", \""+height+"\", \"6\", \"#EBF2F6\");"+
                    "so.addParam(\"menu\", \"false\");"+
					"so.addParam(\"wmode\", \"transparent\");"+
					"so.write(\"banner\");"+
					"</script>"+	
        	
"</body></html>"

	);
wnd.document.write("Нажмите для начала просмотра");

	wnd.document.close();

}






function showAjax(ID,mode,idobjects) {
	
	 var TID = CPHttpRequest.InitThread();
 
   CPHttpRequest.SetAction(TID, SetResult);
   CPHttpRequest.Send(TID, mode, {'mode':'ajax'});
   //alert(idobject);
   document.getElementById(idobjects).innerHTML = "<p><span color='red'>Ждите</span></p>";
   
 
}

 function SetResult(data)
 {
 	
 if (document.getElementById(idobject)) {
 document.getElementById(idobject).innerHTML = data;
 }
 }
 
function GetNewFirms(ids,idobjects)
{
	//alert(idobject);
	var strpage="";
	idobject=idobjects;
	
	if (idobjects=="firms") 
	{
		id=ids;
		firm="";
		strpage='/ajax/getselection.php?type='+idobjects+'&ID='+id+'&firm='+firm+"&";
		
		
	}
	
	if (idobjects=="elements")
	{
		firm=ids;
		//alert(ids);
		strpage='/ajax/getselection.php?type='+idobjects+'&ID='+id+'&firm='+firm+"&";
		
	}
	showAjax(id,strpage,idobject);
}

var idobject;
var id;
var frim;