
<!-- // MOVE COLORPICKER DIV
N = (document.all) ? 0 : 1;
var ob;
function MD(e) {
if (N) {
ob = document.layers[e.target.name];
X=e.x;
Y=e.y;
return false;
}
else {
ob = event.srcElement.parentElement.style;
X=event.offsetX;
Y=event.offsetY;
   }
}
function MM(e) {
if (ob) {
if (N) {
ob.moveTo((e.pageX-X), (e.pageY-Y));
}
else {
ob.pixelLeft = event.clientX-X + document.body.scrollLeft;
ob.pixelTop = event.clientY-Y + document.body.scrollTop;
return false;
      }
   }
}
function MU() {
ob = null;
}

if (N) {
document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
}
//document.onmousedown = MD;
//document.onmousemove = MM;
//document.onmouseup = MU;
//  End -->
// end move






// ERRORMESSAGE
emsg = "Der eingegebene Farbwert ist nich korrekt:\n-der Wert muss mit einem '#' anfangen\n-es dürfen nur die Zeichen 0-9 und A-F verwendet werden\n-nach dem '#' müssen sechs Zeichen folgen";

//  set display of colorpicker = none



function closecolorpicker()

{
document.getElementById('divofswf').style.display='none';
}

// reset the colorpicker swf file
function resetswf()
{
document.tester.TPlay("_level0");
//document.tester.TPlay = "_level0";
document.tester.TGotoFrame("_level0.Colorpicker",0);
}


// creates the colorpicker div
function createcolorp(ueber)
{
//blurid ="textof"+ueber;
//document.getElementById(blurid).style.borderColor="red";
document.tester.TPlay("_level0");
welches = "textof"+ueber;
hexfarbe = document.getElementById(welches).value;
pid = "divofswf";
document.getElementById(pid).style.display='block';
document.getElementById(pid).style.top=window.event.clientY;
document.getElementById(pid).style.left=window.event.clientX+50	;
hexfarbe = hexfarbe.substring(1,7);
window.document.tester.SetVariable("idvompicker",ueber);
window.document.tester.SetVariable("sent",hexfarbe);
}
// function for the OK button in swf
function farbe(dieFarbe,pickerid) {
//alert(pickerid);
if(dieFarbe == "") {
	// do nothing when no color is selected and user click on OK
	// more down i hide the div
}
else
{
if(dieFarbe.length != 7) { dieFarbe = dieFarbe+"00" ;}
whatelement = 'showcolor'+pickerid;
document.getElementById(whatelement).style.backgroundColor=dieFarbe;
whatelement = 'textof'+pickerid;
document.getElementById(whatelement).value=dieFarbe;
pid = "divofswf";

}
document.getElementById(pid).style.display='none';
}
// give the input text value to the flash
function framer(uebergabe)
{
x ="y";
window.document.tester.SetVariable("sent",x);
window.document.tester.TGotoFrame("_level0",12);
}


// chek if the manual input is valid
function wert(pickerid)
{
//alert(pickerid);
whatelement = 'showcolor'+pickerid;
whatetext= 'textof'+pickerid;
a = new String(document.getElementById(whatetext).value);
laenge = a.length;

re = /#([0-9]|[a-f]|[A-F])+/;
        if (re.test(a) == false || laenge  != 7)
        {
        alert(emsg);
        }
else {
document.getElementById(whatelement).style.backgroundColor= document.getElementById(whatetext).value;
blurid = "textof"+pickerid;
document.getElementById(blurid).style.borderColor="black";
}

}

// MAIN FUNCTION to create the colorpicker
function webnovaColorpicker (id,inputname,color,text_before)
{
if (!color)
{ color = "#FFFFFF" }
pid = "pickof"+id;
//document.write(id);
document.write("<table border=\"0\" width=\"300\" >");
document.write("<tr>");
document.write("<td height=\"25\" align=\"left\" style=\"width:148px !important; width:126px;\">"+text_before);
document.write("</td>");
document.write("<td width=\"60\">");
document.write("<input  onFocus=\"this.style.borderColor='red'\" onkeyup=\"javascript:if(window.event.keyCode == 13){ this.blur(); }\" type=\"text\" onBlur=\'wert("+id+");\' class=\"WNCPinput\"  name="+inputname+" size=\"7\" maxlength=\"7\" value="+color+" id=textof"+id+"  style=\"border:1px solid black;width:60px\" >");
document.write("</td>");
document.write("<td width=\"10\">");
document.write("<div id=showcolor"+id+" style=\"width:20px;height:20px;border:1px solid #000000;display:inline;background-color:"+color+"\"  >");
document.write("</div>");
document.write("</td>");
document.write("<td>");
pid = "divofswf";
document.write("<img src=/colorpicker/webnova_colorpicker_pipette.gif onClick=\"javascript:resetswf();createcolorp('"+id+"')\"  onmouseover=\"this.src='/colorpicker/webnova_colorpicker_pipette2.gif'\" onmouseout=\"this.src='/colorpicker/webnova_colorpicker_pipette.gif';\" style='padding:0px;z-index:10;' >");
document.write("</td>");
document.write("</tr>");
document.write("</table>");
}

