// JavaScript Document
function clearInput(formName, inputName) {
	eval("document."+formName+"."+inputName).value = '';
}
function view_image(path, width, height, id) {
	pop = popup("units/catalog/view_image.php?file="+path+"&id="+id, "popup", width, height, false, false, 50, 150);
}
function popupbyname(url){
	xPos = window.screenLeft+10;
	yPos = window.screenTop+20;
	win = window.open(siteURL + '/objects/editor/viewpopup.php?url='+url, 'filepopup', "width=400,height=230,left="+xPos+",top="+yPos+",scrollbars=no,resizable=no,toolbars=no");
}
function toggleDiv(id){
	obj = document.getElementById(id);
	tmp = obj.style.display;
	if (tmp == 'none') obj.style.display='block';
	else obj.style.display='none';
}
function getid(id){
	return document.getElementById(id);
}
function popupeditor(inputname){
	xPos = window.screenLeft+10;
	yPos = window.screenTop+20;
	win = window.open('/d-engine/objects/editor/tinymce_external.php?var='+inputname, 'filepopup', "width=700,height=400,left="+xPos+",top="+yPos+",scrollbars=no,resizable=yes,toolbars=no");	
}
function removeLinks2Self() {
	try {
		links = document.links
		if (links.length) {
			var current_location      = window.location.href
			current_location          = current_location.toString()
			current_location_relative = current_location.replace(/^[a-z]+\/\/[^\/]+/, '')
			var i = 0
			var node, href, inner, span;
			while (node = links.item(i++)) {
				href = node.getAttribute('href')
				href = href.toString()
				if (!href || 
					(href == current_location) || 
					(href == current_location+"#") || 
					(href == current_location+"/#") || 
					(href == current_location_relative) || 
					(href == current_location_relative+"#") || 
					(href == current_location_relative+"/#") || 
					(href == "./") || 
					(href == "#") || 
					(href == "./#")) {
					node.removeAttribute('href')
				}
			}
		}
	} catch (e) {
		alert(e.message)
	}
}