
var isNetscape = navigator.appName=="Netscape";
var brw_version=parseInt(navigator.appVersion.substring(0,1));
var brw_name=navigator.appName;

// navigation einblenden script
function showSubnav(lay)
{
	for (i=1;i<=6;i++)
		if (get_style('navsub'+i)!='none')
			set_style('navsub'+i,'none');
	if (get_style(lay)=='none')
		set_style(lay,'');
}

function openNickpageNet(userID)
{
	window.open("http://www.allesheute.at/cont/community/nickpage.aspx?ui="+userID,"_blank","width=467,height=310,menubar=no,toolbar=no,scrollbars=yes,resizable=no,directories=no,location=no,status=no");	
}

function openNickpageCommunity(userID)
{
	window.open("nickpage.aspx?ui="+userID,"_blank","width=467,height=310,menubar=no,toolbar=no,scrollbars=yes,resizable=no,directories=no,location=no,status=no");	
}

//showhidecontentvonjürgen

function showHideContent(lay)
{
	if (get_style(lay)=='none')
		set_style(lay,'');
	else
		set_style(lay,'none');	
}

function set_style(lay,myValue)
{
   if(!isNetscape)
     eval('document.all.'+lay+'.style.display="'+myValue+'"');
   else if (brw_version<=4)  
        eval('document.all.'+lay+'.display="'+myValue+'"');
   else 
     eval('document.getElementById("'+lay+'").style.display="'+myValue+'"');   
}

function get_style(lay)
{
   var tmp='';
   if(!isNetscape)
     eval('tmp=document.all.'+lay+'.style.display');
   else if (brw_version<=4)  
        eval('tmp=document.all.'+lay+'.display');
   else 
     eval('tmp=document.getElementById("'+lay+'").style.display'); 
	return tmp;  
}

// html editor
function over(element) {
element.style.borderStyle= "solid";
element.style.borderWidth = "1px";
element.style.borderColor = "#000000";
element.style.backgroundColor = "#F1F1F1";
element.style.cursor = "hand";
}

function out(element) {
element.style.borderColor = "#CCCCCC";
element.style.backgroundColor = "#CCCCCC"
element.style.cursor = "default";
}

function readyDiv(divName) {
var theHTML;
theHTML = document.all.tags('div')[divName].innerText;
document.all.tags('div')[divName].innerHTML = theHTML;
}

function cmdExec(cmd,divName,opt) {
eval(divName+'.document.execCommand(cmd,"",opt)');
document.body.all.tags('div')[divName].focus();
}

function createLink() {
cmdExec("CreateLink");
}

function insertImage() {
var sImgSrc = prompt("Image: ", "http://www.[domain].[ext]/[folder]/[file]");
if(sImgSrc!=null)
cmdExec("InsertImage",sImgSrc);
}

function copyhiddensubmit(objForm,divName,toObj) {
	toObj.value = document.all.tags('div')[divName].innerHTML;
	objForm.submit();
}

function copyhidden(objForm,divName,toObj) {
	toObj.value = doCleanCode(document.all.tags('div')[divName].innerHTML);
}

function go(where) {
window.location.href = where;
}

// clean wordhtml

function validateNumKey (div)
{  
	if (event.ctrlKey && window.event.keyCode==86)
	{
		paste(div); 
		event.returnValue=false;	
	}
	//window.status="CtrlKey:"+window.event.ctrlKey+" KeyCode:"+window.event.keyCode;	
	
}

function validateNumKeyOnly()
{  
	if (event.ctrlKey && window.event.keyCode==86)
	{
		event.returnValue=false;	
	}
	//window.status="CtrlKey:"+window.event.ctrlKey+" KeyCode:"+window.event.keyCode;	
	
}

function paste(div)
{
	cmdExec('paste',div);
	document.all.tags('div')[div].innerHTML=doCleanCode(document.all.tags('div')[div].innerHTML);
}

function cleanWordHTML(div)
{
	document.all.tags('div')[div].innerHTML=doCleanCode(document.all.tags('div')[div].innerHTML);
}

function doCleanCode(code) 
{
	//alert(code);
	code = code.replace(/<([\w]+) class=([^ |>]*)([^>]*)/gi, "<$1$3");
	code = code.replace(/<([\w]+) style="([^"]*)"([^>]*)/gi, "<$1$3");
	code = code.replace(/<\\?\??xml[^>]*>/gi, "");
	code = code.replace(/<\/?\w+:[^>]*>/gi, "");
	code = code.replace(/<p([^>])*>(&nbsp;)*\s*<\/p>/gi,"");
	code = code.replace(/<span([^>])*>(&nbsp;)*\s*<\/span>/gi,"");
	code = code.replace(/<span[^>]*>/gi, '');     
	code = code.replace(/<\/span>/gi, '');       
	code = code.replace(/<font[^>]*>/gi, '');     
	code = code.replace(/<\/font>/gi, ''); 
	code = code.replace(/<h[0-9]>/gi,'');
	code = code.replace(/<\/h[0-9]>/gi,'');	
	//alert(code);   
	return code;
}