Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/colorselector.js =================================================================== diff -u -r1485 -r1486 --- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/colorselector.js (.../colorselector.js) (revision 1485) +++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/colorselector.js (.../colorselector.js) (revision 1486) @@ -1,6 +1,7 @@ // color Selector var aColors = '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF'; + var $color_selector_field = ''; function InitColorSelector() { @@ -58,21 +59,46 @@ } - function colorMouseOut($e) + function colorMouseOut($e, $element) { if(!$e) $e = window.event; - this.parentNode.style.backgroundColor = '#F6F6F6'; - this.parentNode.style.borderColor = '#F6F6F6'; + if(!$element) $element = this; + $element.parentNode.style.backgroundColor = '#F6F6F6'; + $element.parentNode.style.borderColor = '#F6F6F6'; } function colorClick($e) { if(!$e) $e = window.event; var $color = aColors[ this.getAttribute('ColorIndex') ]; - document.getElementById('color_'+$input_name).style.backgroundColor = $color; - document.getElementById($input_name).value = '#' + $color; + document.getElementById('color_'+$color_selector_field).style.backgroundColor = $color; + document.getElementById($color_selector_field).value = '#' + $color; document.getElementById('colorSelector_div').style.display = 'none'; - colorMouseOut($e); - } \ No newline at end of file + colorMouseOut($e, this); + } + + function openColorSelector($e, $field) + { + $color_selector_field = $field; + var $div = document.getElementById('colorSelector_div'); + + var posx = 0; + var posy = 0; + if (!$e) var $e = window.event; + if ($e.pageX || $e.pageY) + { + posx = $e.pageX; + posy = $e.pageY; + } + else if ($e.clientX || $e.clientY) + { + posx = $e.clientX + document.body.scrollLeft; + posy = $e.clientY + document.body.scrollTop; + } + + $div.style.left = posx; + $div.style.top = posy; + $div.style.display = 'block'; + }