function fInit () {
    document.getElementById( 'divJS' ).style.visibility = "hidden";
    document.getElementById( 'divJS' ).style.display = "none";
    frmCkOthersChange('txtOthers', 'ckOthers');
}


function frmRdInput( target, trigger ) {

    if (document.getElementById( trigger ).value == "weniger") {
        fSetStatus( target, false );
    } else {
        fSetStatus( target, true );
    }
}


function frmCkOthersChange(target, trigger) {
    if ( document.getElementById( trigger ).checked == true ) {
        fSetStatus( target, false );
    } else {
        fSetStatus( target, true );
    }
}


function fSetStatus( target, status ) {
    document.getElementById( target ).disabled = status;
}


function fCkTextarea( target ) {
    l = 500;
    var s = document.getElementById( target ).value;
    if ( s.length >= (l-1) ) {
        s = s.substring(0, (l-2));
        document.getElementById( target ).value = s;
    }
}


function fCkContact () {

    var sName = document.frmSkate.txtName.value;
    var sMail = document.frmSkate.txtMail.value;
    var sMsg  = document.frmSkate.txtMsg.value;
    var pattern = /^\S+\@\S+\.[a-zA-Z]+$/;

    if ( (sName.length >= 3) && (pattern.test(sMail) == true) ) {
        document.frmSkate.submit();
        document.getElementById( 'txtName' ).style.border = "1px solid #dddddd";
        document.getElementById( 'txtMail' ).style.border = "1px solid #dddddd";
    }
    else if ( sName.length < 3 ) {
        document.getElementById( 'txtName' ).style.border = "2px solid red";
    }
    else if ( pattern.test(sMail) == false ) {
        document.getElementById( 'txtMail' ).style.border = "2px solid red";
    } 

    if ( sName.length >= 3 ) {
        document.getElementById( 'txtName' ).style.border = "1px solid #dddddd";
    }

    if ( pattern.test(sMail) == true ) {
        document.getElementById( 'txtMail' ).style.border = "1px solid #dddddd";
    } 

}


function ueSrcInput () {
	document.frmSrcIn.src.value = encodeURI(document.frmSrcIn.txtSrcIn.value);
	document.frmSrcIn.submit();
}

//---------------------------------------------------------------------

/* return the x/y-Position of an object   */
/* requires the (string) name of the object */
function getPosition(obj) {
	var pos = { x:0, y:0 };

	do {
		pos.x += obj.offsetLeft;
		pos.y += obj.offsetTop;
	} while (obj = obj.offsetParent);

	return pos;
}


/* show the info box and move it to the corresponding image */
/* requires the (string) names of the image and the name of */
/* the information box */
function fShowInfo ( img, target ) {
	var pos = getPosition(document.getElementById( img ));

	document.getElementById( target ).style.visibility = "visible";
	document.getElementById( target ).style.display    = "inline";
	document.getElementById( target ).style.overflow   = "hidden";
	document.getElementById( target ).style.height     = "450px";

	document.getElementById( target ).style.position   = "absolute";
	document.getElementById( target ).style.zIndex     = "6";
//alert( pos.x + "/" + pos.y );
	document.getElementById( target ).style.left = (pos.x + 80) + "px";
	document.getElementById( target ).style.top  = (pos.y - 300) + "px";
}


/* Hide the info box */
function fHideInfo ( target ) {
	document.getElementById( target ).style.visibility = "hidden";
	document.getElementById( target ).style.display    = "none";
}
