function popup(datei,name,breite,hoehe,noresize)
{ 
	var posX=(screen.availWidth-breite)/2;
	var posY=(screen.availHeight-hoehe)/2;
	var resizable = (noresize==1) ? 0 : 1;
	window.open(datei,name,"resizable="+resizable+",scrollbars=1,width=" + breite + ",height=" + hoehe + "screenX=" + posX + ",screenY=" + posY + ",left=" + posX + ",top=" + posY + "");
}








function mp3avi(file) {
  var html = file;
  html = html.replace(/src="/gi, 'src="../' );
  html = html.replace(/&lt;/gi, '<' );
  html = html.replace(/&gt;/gi, '>' );
  var pFenster = window.open( '', null, 'height=80,width=490,toolbar=no,location=no,status=yes,menubar=no,scrollbars=no,resizable=no' ) ;
  var HTML = '<html><head></head><body style="font-family:verdana,arial;font-size:11px;margin:0px;background:url(/templates/cp/images/fon3.jpg) top left;"><object type="application/x-shockwave-flash" data="http://ross-studio.com/templates/cp/js/ump3player_500x70.swf" height="70" width="470"><param name="wmode" VALUE="transparent" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="movie" value="http://ross-studio.com/templates/cp/js/ump3player_500x70.swf" /><param name="FlashVars" value="way=http://ross-studio.com' + html + '&amp;swf=http://ross-studio.com/templates/cp/js/ump3player_500x70.swf&amp;w=470&amp;h=70&amp;time_seconds=0&amp;autoplay=1&amp;q=&amp;skin=brown&amp;volume=70&amp;comment=" /></object></body></html>' ;
  pFenster.document.write(HTML);
  pFenster.document.close();
}




function audiofile(file) {
var html = file;
var win = new Window({className: "dialog",  width:490, height:100, zIndex: 100, resizable: false, title: "Прослушать аудио файл", draggable:true, wiredDrag: true})
win.getContent().innerHTML= '<div style="padding:10px"><object type="application/x-shockwave-flash" data="http://ross-studio.com/templates/cp/js/ump3player_500x70.swf" height="70" width="470"><param name="wmode" VALUE="transparent" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="movie" value="http://ross-studio.com/templates/cp/js/ump3player_500x70.swf" /><param name="FlashVars" value="way=http://ross-studio.com' + html + '&amp;swf=http://ross-studio.com/templates/cp/js/ump3player_500x70.swf&amp;w=250&amp;h=70&amp;time_seconds=0&amp;autoplay=0&amp;q=&amp;skin=brown&amp;volume=70&amp;comment=" /></object></div>'
win.setStatusBar("Status bar info");
win.showCenter();  
      }



function videofile(file) {
var html = file;
var win = new Window({className: "dialog",  width:420, height:320, zIndex: 100, resizable: false, title: "Посмотреть видео файл", draggable:true, wiredDrag: true})
win.getContent().innerHTML= '<div style="padding:10px"><object type="application/x-shockwave-flash" data="http://flv-mp3.com/i/pic/uflvplayer_500x375.swf" height="300" width="400"><param name="bgcolor" value="#996633" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="movie" value="http://ross-studio.com/templates/cp/js/uflvplayer.swf" /><param name="FlashVars" value="way=http://ross-studio.com/uploads/mp3/20081212172614.flv&amp;swf=http://ross-studio.com/templates/cp/js/uflvplayer.swf&amp;w=400&amp;h=300&amp;pic=http://&amp;autoplay=0&amp;tools=1&amp;skin=brown&amp;volume=70&amp;q=&amp;comment=" /></object></div>'
win.setStatusBar("");
win.showCenter();  
      }












function galpop(datei,name,breite,hoehe,noresize)
{ 
	var posX=(screen.availWidth-breite)/2;
	var posY=(screen.availHeight-hoehe)/2;
	var resizable = (noresize==1) ? 0 : 1;
	var scrollbar = (document.all) ? 0 : 1;
	window.open(datei,name,"resizable="+resizable+",scrollbars="+scrollbar+",width=" + breite + ",height=" + hoehe + "screenX=" + posX + ",screenY=" + posY + ",left=" + posX + ",top=" + posY + "");
}


function textCounter(field, countfield, maxlimit)
{
	if (field.value.length > maxlimit)
	{
		field.value = field.value.substring(0, maxlimit);
	} else {
		countfield.value = maxlimit - field.value.length;
	}
}


function elemX (element) {
	var x = 0;
	while (element) {
		x += element.offsetLeft;
		element = element.offsetParent;
	}
	return x;
}

function elemY (element) {
	var y = 0;
	while (element) {
		y += element.offsetTop;
		element = element.offsetParent;
	}
	return y;
}

function getWidth (element) {
	return element.offsetWidth;
}

function getHeight (element) {
	return element.offsetHeight;
}

function elemObj(elementId) {
	if (document.all)
		return document.all[elementId];
	else if (document.getElementById)
		return document.getElementById(elementId);
	else
		return null;
}