function openWin(image,title)
{
	aWindow=window.open("img_large.php?img="+image+"&title="+title,"","toolbar=no,width=400,height=400,status=no,scrollbars=no,resizable=no,menubar=no");
	aWindow.focus();
}

function openWin2(url,w,h)
{
	aWindow=window.open(url,"","toolbar=no,width="+w+",height="+h+",status=no,scrollbars=no,resizable=no,menubar=no");
	aWindow.focus();
}
function openWin3(url,w,h,title)
{
	aWindow=window.open(url,"","toolbar=no,width="+w+",height="+h+",status=no,scrollbars=yes,resizable=no,menubar=no");
	aWindow.focus();
}


function openLargeImage(url)
{
    aWindow=window.open(url,"","toolbar=no,width=400,height=400,status=no,scrollbars=no,resizable=no,menubar=no");
	aWindow.focus();
}

function openBookmark(aURL)
{
	aWindow=window.open(aURL,"","toolbar=no,width=400,height=100,status=no,scrollbars=no,resizable=no,menubar=no");
	aWindow.focus();
}
function openVideo(aURL)
{
	aWindow=window.open(aURL,"","toolbar=no,width=400,height=400,status=no,scrollbars=no,resizable=no,menubar=no");
	aWindow.focus();
}
function openMatchUs(aURL)
{
	aWindow=window.open(aURL,"","toolbar=no,width=400,height=200,status=no,scrollbars=no,resizable=no,menubar=no");
	aWindow.focus();
}
function submitFormTA()
{
	updateRTE('ta');
	return true;
}
function setImage(string)
{
	document.getElementById('previewImage').src = 'File:\/\/' + string;
}

function checkSelectedOption(value,form,warning)
{
	if( value != -1 )
	{
		form.catid.value = value;
		form.submit();
	}
	else
	{
		alert(warning);
	}
}
function previewImage(string)
{
	document.getElementById('previewImage').src = 'File:\/\/' + string;
}
function previewImageServer(string)
{
	if (string=="")
		document.getElementById('previewImage').src = "../catimages/blank.gif";
	else
		document.getElementById('previewImage').src = "../catimages/" + string;
}
isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

function switchDiv(strDivName,bolVisible){

 //identify the element based on browser type
 if (isNS4) {
   objElement = document.layers[strDivName];
 } else if (isIE4) {
   objElement = document.all[strDivName];
 } else if (isIE5 || isNS6) {
   objElement = document.getElementById(strDivName);
 }

 if(isNS4){
     if(!bolVisible) {
       objElement.visibility ="hidden"
     } else {
       objElement.visibility ="visible"
     }
 }else{
     if(!bolVisible) {
       objElement.style.visibility = "hidden";
     } else {
       objElement.style.visibility = "visible";
     }
 }
}


function removeall(checkboxId)
{

	var the_box = eval("window.document.itemForm." + checkboxId);
	for (var i=0;i<the_box.length;i++)
	{
		the_box[i].checked=false;
  	}
  	the_box[0].checked=true;
}

function resetfirst(checkboxId)
{
  	var the_box = eval("window.document.itemForm." + checkboxId);
  	the_box[0].checked=false;
}

function collapse_all (n_index, n_depth) {
	var o_tree = TREES[n_index ? n_index : 0];
	if (!n_depth) n_depth = 1;
	if (!o_tree)
		alert("Tree is not initialized yet");
	var a_nodes = o_tree.a_nodes;
	for (var i = a_nodes.length - 1; i >= 0; i--)
		if (a_nodes[i].n_depth >= n_depth && a_nodes[i].open)
			a_nodes[i].open(1, 1);
	o_tree.ndom_refresh();
}
function expand_all (n_index, n_depth) {
	var o_tree = TREES[n_index ? n_index : 0];
	if (!o_tree)
		alert("Tree is not initialized yet");
	var a_nodes = o_tree.a_nodes;
	for (var i = 0; i< a_nodes.length; i++)
		if (n_depth == null || a_nodes[i].n_depth <= n_depth)
			a_nodes[i].open(0, 1);
	o_tree.ndom_refresh();
}
<!-- swensen B-->
function show_hint(obj) {

	if(document.getElementById(obj).style.display=="block") {
		document.getElementById(obj).style.display='none';
	} else {
		document.getElementById(obj).style.display='block';
	}
}

// usage: format_zahl( number [, number]  [, bool]  )
function formatZahl(zahl, k, fix) {
    if(!k) k = 0;
    var neu = '';
    // Runden
    var f = Math.pow(10, k);
    zahl = '' + parseInt( zahl * f + (.5 * (zahl > 0 ? 1 : -1)) ) / f ;
    // Komma ermittlen
    var idx = zahl.indexOf('.');
    // fehlende Nullen einfügen
    if(fix) zahl += (idx == -1 ? '.' : '' ) + f.toString().substring(1);

    // Nachkommastellen ermittlen
    idx = zahl.indexOf('.');
    if(idx == -1) {
		idx = zahl.length;
	} else {
		neu = ',' + zahl.substr(idx + 1, k);
	}
    // Tausendertrennzeichen
    while(idx > 0) {
        if(idx - 3 > 0) {
	        neu = '.' + zahl.substring(idx - 3, idx) + neu;
        } else {
    	    neu = zahl.substring(0, idx) + neu;
        }
		idx-= 3;
    }
    return neu;
}

function addLoadEvent(func) {
    if(typeof window.onload != 'function') {
        window.onload = func;
    }
    else {
        if(func) {
            var oldLoad = window.onload;

            window.onload = function() {
                if(oldLoad)
                        oldLoad();

                func();
            }
        }
    }
}

function setCaretPosition(elemId, caretPos) {
    var elem = document.getElementById(elemId);

    if(elem != null) {
        if(elem.createTextRange) {
            var range = elem.createTextRange();
            range.move('character', caretPos);
            range.select();
        }
        else {
            if(elem.selectionStart) {
                elem.focus();
                elem.setSelectionRange(caretPos, caretPos);
            }
            else
                elem.focus();
        }
    }
}


function countLetters(viewObjName,countObjName,maxLength){
    var viewObj = document.getElementById(viewObjName);
    var countObj = document.getElementById(countObjName);
    var textLength = countObj.value.length;
    if(textLength>maxLength) {
        //minusLength = maxLength-textLength;
        countObj.value = countObj.value.substr(0,maxLength);
    }
    //document.getElementById(viewObj).value=textLength;
    viewObj.innerHTML=maxLength-textLength;
}

function substr_count (haystack, needle, offset, length) {
    // Returns the number of times a substring occurs in the string
    //
    // version: 909.322
    // discuss at: http://phpjs.org/functions/substr_count
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Onno Marsman
    // *     example 1: substr_count('Kevin van Zonneveld', 'e');
    // *     returns 1: 3
    // *     example 2: substr_count('Kevin van Zonneveld', 'K', 1);
    // *     returns 2: 0
    // *     example 3: substr_count('Kevin van Zonneveld', 'Z', 0, 10);
    // *     returns 3: false
    var pos = 0, cnt = 0;

    haystack += '';
    needle += '';
    if (isNaN(offset)) {offset = 0;}
    if (isNaN(length)) {length = 0;}
    offset--;

    while ((offset = haystack.indexOf(needle, offset+1)) != -1){
        if (length > 0 && (offset+needle.length) > length){
            return false;
        } else{
            cnt++;
        }
    }

    return cnt;
}


function countSMSText(text1,counttarget){
    tmptext = text1.toLowerCase();
    var ae = substr_count(tmptext,unescape('%E4'));
    var ue = substr_count(tmptext,unescape('%FC'));
    var oe = substr_count(tmptext,unescape('%F6'));
    var sz = substr_count(tmptext,unescape('%DF'));
    var ENTER = substr_count(tmptext,'\n');

    counttarget.value = text1.length+ae+ue+oe+sz+ENTER;
}

function openOrderWin()
{
   orderwindow = window.open('about:blank', 'orderwin', 'width=800,height=600');
   orderwindow.focus();
   checkorder();

}
function checkorder()
{
    if(orderwindow.closed) {
        hidewaiting();
    } else {
        setTimeout('checkorder()',3000);
    }
}
<!-- swensen E-->