 if (!window.Silverlight) { window.Silverlight = { }; } Silverlight._silverlightCount = 0; Silverlight.__onSilverlightInstalledCalled = false; Silverlight.fwlinkRoot='http://go2.microsoft.com/fwlink/?LinkID='; Silverlight.__installationEventFired = false; Silverlight.onGetSilverlight = null; Silverlight.onSilverlightInstalled = function () {window.location.reload(false);}; Silverlight.isInstalled = function(version) { if (version == undefined) version = null; var isVersionSupported = false; var container = null; try { var control = null; var tryNS = false; if (window.ActiveXObject) { try { control = new ActiveXObject('AgControl.AgControl'); if (version === null) { isVersionSupported = true; } else if (control.IsVersionSupported(version)) { isVersionSupported = true; } control = null; } catch (e) { tryNS = true; } } else { tryNS = true; } if (tryNS) { var plugin = navigator.plugins["Silverlight Plug-In"]; if (plugin) { if (version === null) { isVersionSupported = true; } else { var actualVer = plugin.description; if (actualVer === "1.0.30226.2") actualVer = "2.0.30226.2"; var actualVerArray = actualVer.split("."); while (actualVerArray.length > 3) { actualVerArray.pop(); } while (actualVerArray.length < 4) { actualVerArray.push(0); } var reqVerArray = version.split("."); while (reqVerArray.length > 4) { reqVerArray.pop(); } var requiredVersionPart; var actualVersionPart; var index = 0; do { requiredVersionPart = parseInt(reqVerArray [index]); actualVersionPart = parseInt(actualVerArray[index]); index++; } while (index < reqVerArray.length && requiredVersionPart === actualVersionPart); if (requiredVersionPart <= actualVersionPart && !isNaN(requiredVersionPart)) { isVersionSupported = true; } } } } } catch (e) { isVersionSupported = false; } return isVersionSupported; }; Silverlight.WaitForInstallCompletion = function() { if ( ! Silverlight.isBrowserRestartRequired && Silverlight.onSilverlightInstalled ) { try { navigator.plugins.refresh(); } catch(e) { } if (Silverlight.isInstalled(null) && !Silverlight.__onSilverlightInstalledCalled) { Silverlight.onSilverlightInstalled(); Silverlight.__onSilverlightInstalledCalled = true; } else { setTimeout(Silverlight.WaitForInstallCompletion, 3000); } } }; Silverlight.__startup = function() { navigator.plugins.refresh(); Silverlight.isBrowserRestartRequired = Silverlight.isInstalled(null); if (!Silverlight.isBrowserRestartRequired) { Silverlight.WaitForInstallCompletion(); if (!Silverlight.__installationEventFired) { Silverlight.onInstallRequired(); Silverlight.__installationEventFired = true; } } else if (window.navigator.mimeTypes) { var mimeSL2 = navigator.mimeTypes["application/x-silverlight-2"]; var mimeSL2b2 = navigator.mimeTypes["application/x-silverlight-2-b2"]; var mimeSL2b1 = navigator.mimeTypes["application/x-silverlight-2-b1"]; var mimeHighestBeta = mimeSL2b1; if (mimeSL2b2) mimeHighestBeta = mimeSL2b2; if (! mimeSL2 && (mimeSL2b1 || mimeSL2b2)) { if (!Silverlight.__installationEventFired) { Silverlight.onUpgradeRequired(); Silverlight.__installationEventFired = true; } } else if (mimeSL2 && mimeHighestBeta) { if (mimeSL2.enabledPlugin && mimeHighestBeta.enabledPlugin) { if (mimeSL2.enabledPlugin.description != mimeHighestBeta.enabledPlugin.description) { if (! Silverlight.__installationEventFired) { Silverlight.onRestartRequired(); Silverlight.__installationEventFired = true; } } } } } if (! Silverlight.disableAutoStartup) { if (window.removeEventListener) { window.removeEventListener('load', Silverlight.__startup, false); } else { window.detachEvent('onload', Silverlight.__startup); } } }; if (!Silverlight.disableAutoStartup) { if (window.addEventListener) { window.addEventListener('load', Silverlight.__startup, false); } else { window.attachEvent('onload', Silverlight.__startup); } } Silverlight.createObject = function(source, parentElement, id, properties, events, initParams, userContext) { var slPluginHelper = new Object(); var slProperties = properties; var slEvents = events; slPluginHelper.version = slProperties.version; slProperties.source = source; slPluginHelper.alt = slProperties.alt; if ( initParams ) slProperties.initParams = initParams; if ( slProperties.isWindowless && ! slProperties.windowless) slProperties.windowless = slProperties.isWindowless; if ( slProperties.framerate && !slProperties.maxFramerate) slProperties.maxFramerate = slProperties.framerate; if ( id && !slProperties.id) slProperties.id = id; delete slProperties.ignoreBrowserVer; delete slProperties.inplaceInstallPrompt; delete slProperties.version; delete slProperties.isWindowless; delete slProperties.framerate; delete slProperties.data; delete slProperties.src; delete slProperties.alt; if (Silverlight.isInstalled (slPluginHelper.version)) { for (var name in slEvents) { if ( slEvents[name]) { if ( name == "onLoad" && typeof slEvents[name] == "function" && slEvents[name].length != 1 ) { var onLoadHandler = slEvents[name]; slEvents[name]=function (sender){ return onLoadHandler (document.getElementById(id), userContext, sender)}; } var handlerName = Silverlight.__getHandlerName(slEvents[name]); if ( handlerName != null ) { slProperties[name] = handlerName; slEvents[name] = null; } else { throw "typeof events."+name+" must be 'function' or 'string'"; } } } slPluginHTML = Silverlight.buildHTML(slProperties); } else { slPluginHTML = Silverlight.buildPromptHTML(slPluginHelper); } if (parentElement) { parentElement.innerHTML = slPluginHTML; } else { return slPluginHTML; } }; Silverlight.buildHTML = function( slProperties) { var htmlBuilder = []; htmlBuilder.push('<object type=\"application/x-silverlight\" data="data:application/x- silverlight,"'); if ( slProperties.id != null ) { htmlBuilder.push(' id="' + Silverlight.HtmlAttributeEncode(slProperties.id) + '"'); } if ( slProperties.width != null ) { htmlBuilder.push(' width="' + slProperties.width+ '"'); } if ( slProperties.height != null ) { htmlBuilder.push(' height="' + slProperties.height + '"'); } htmlBuilder.push(' >'); delete slProperties.id; delete slProperties.width; delete slProperties.height; for (var name in slProperties) { if (slProperties[name]) { htmlBuilder.push('<param name="'+Silverlight.HtmlAttributeEncode(name)+'" value="'+Silverlight.HtmlAttributeEncode (slProperties[name])+'" />'); } } htmlBuilder.push('<\/object>'); return htmlBuilder.join(''); }; Silverlight.createObjectEx = function(params) { var parameters = params; var html = Silverlight.createObject(parameters.source, parameters.parentElement, parameters.id, parameters.properties, parameters.events, parameters.initParams, parameters.context); if (parameters.parentElement == null) { return html; } }; Silverlight.buildPromptHTML = function(slPluginHelper) { var slPluginHTML = ""; var urlRoot = Silverlight.fwlinkRoot; var version = slPluginHelper.version ; if ( slPluginHelper.alt ) { slPluginHTML = slPluginHelper.alt; } else { if (! version) { version=""; } slPluginHTML = "<a href='javascript:Silverlight.getSilverlight(\"{1}\");' style='text-decoration: none;'><img src='{2}' alt='Get Microsoft Silverlight' style='border-style: none'/></a>"; slPluginHTML = slPluginHTML.replace('{1}', version); slPluginHTML = slPluginHTML.replace('{2}', urlRoot + '108181'); } return slPluginHTML; }; Silverlight.getSilverlight = function(version) { if (Silverlight.onGetSilverlight ) { Silverlight.onGetSilverlight(); } var shortVer = ""; var reqVerArray = String(version).split("."); if (reqVerArray.length > 1) { var majorNum = parseInt(reqVerArray[0] ); if ( isNaN(majorNum) || majorNum < 2 ) { shortVer = "1.0"; } else { shortVer = reqVerArray[0] +'.'+reqVerArray[1]; } } var verArg = ""; if (shortVer.match(/^\d+\056\d+$/) ) { verArg = "&v="+shortVer; } Silverlight.followFWLink ("114576" + verArg); }; Silverlight.followFWLink = function(linkid) { top.location=Silverlight.fwlinkRoot+String(linkid); }; Silverlight.HtmlAttributeEncode = function( strInput ) { var c; var retVal = ''; if(strInput == null) { return null; } for(var cnt = 0; cnt < strInput.length; cnt++) { c = strInput.charCodeAt(cnt); if (( ( c > 96 ) && ( c < 123 ) ) || ( ( c > 64 ) && ( c < 91 ) ) || ( ( c > 43 ) && ( c < 58 ) && (c!=47)) || ( c == 95 )) { retVal = retVal + String.fromCharCode(c); } else { retVal = retVal + '&#' + c + ';'; } } return retVal; }; Silverlight.default_error_handler = function (sender, args) { var iErrorCode; var errorType = args.ErrorType; iErrorCode = args.ErrorCode; var errMsg = "\nSilverlight error message \n" ; errMsg += "ErrorCode: "+ iErrorCode + "\n"; errMsg += "ErrorType: " + errorType + " \n"; errMsg += "Message: " + args.ErrorMessage + " \n"; if (errorType == "ParserError") { errMsg += "XamlFile: " + args.xamlFile + " \n"; errMsg += "Line: " + args.lineNumber + " \n"; errMsg += "Position: " + args.charPosition + " \n"; } else if (errorType == "RuntimeError") { if (args.lineNumber != 0) { errMsg += "Line: " + args.lineNumber + " \n"; errMsg += "Position: " + args.charPosition + " \n"; } errMsg += "MethodName: " + args.methodName + " \n"; } alert (errMsg); }; Silverlight.__cleanup = function () { for (var i = Silverlight._silverlightCount - 1; i >= 0; i--) { window['__slEvent' + i] = null; } Silverlight._silverlightCount = 0; if (window.removeEventListener) { window.removeEventListener('unload', Silverlight.__cleanup , false); } else { window.detachEvent('onunload', Silverlight.__cleanup ); } }; Silverlight.__getHandlerName = function (handler) { var handlerName = ""; if ( typeof handler == "string") { handlerName = handler; } else if ( typeof handler == "function" ) { if (Silverlight._silverlightCount == 0) { if (window.addEventListener) { window.addEventListener('onunload', Silverlight.__cleanup , false); } else { window.attachEvent('onunload', Silverlight.__cleanup ); } } var count = Silverlight._silverlightCount++; handlerName = "__slEvent"+count; window[handlerName]=handler; } else { handlerName = null; } return handlerName; }; Silverlight.onRequiredVersionAvailable = function() { }; Silverlight.onRestartRequired = function() { }; Silverlight.onUpgradeRequired = function() { }; Silverlight.onInstallRequired = function() { }; Silverlight.IsVersionAvailableOnError = function(sender, args) { var retVal = false; try { if (args.ErrorCode == 8001 && !Silverlight.__installationEventFired) { Silverlight.onUpgradeRequired(); Silverlight.__installationEventFired = true; } else if (args.ErrorCode == 8002 && ! Silverlight.__installationEventFired) { Silverlight.onRestartRequired(); Silverlight.__installationEventFired = true; } else if (args.ErrorCode == 5014 || args.ErrorCode == 2106) { if (Silverlight.__verifySilverlight2UpgradeSuccess(args.getHost())) { retVal = true; } } else { retVal = true; } } catch (e) { } return retVal; }; Silverlight.IsVersionAvailableOnLoad = function(sender) { var retVal = false; try { if (Silverlight.__verifySilverlight2UpgradeSuccess(sender.getHost())) { retVal = true; } } catch (e) { } return retVal; }; Silverlight.__verifySilverlight2UpgradeSuccess = function(host) { var retVal = false; var version = "2.0.31005"; var installationEvent = null; try { if (host.IsVersionSupported(version + ".99")) { installationEvent = Silverlight.onRequiredVersionAvailable; retVal = true; } else if (host.IsVersionSupported(version + ".0")) { installationEvent = Silverlight.onRestartRequired; } else { installationEvent = Silverlight.onUpgradeRequired; } if (installationEvent && !Silverlight.__installationEventFired) { installationEvent(); Silverlight.__installationEventFired = true; } } catch (e) { } return retVal; }; var cmdown = false; var canam; var cam2; var cam3; var curcol = "#"+"0000ff"; var thick = false; var trans = false; var stamp = 0; var res=''; function csl2(){Silverlight.createObject("mysl2.xaml",psl2,"msl",{width:'32',height:'32',inplaceInstallPrompt:false,background:'#D6D6D6', isWindowless:'false', framerate:'24', version:'1.0' },{ onError:null, onLoad:null }, null);} function createMySilverlightPlugin(){ Silverlight.createObject("myx.xaml",parentElement,"msl", {width:'384',height:'384',inplaceInstallPrompt:false,background:'#D6D6D6',isWindowless:'false', framerate:'24',version:'1.0'}, {onError:null,onLoad:null},null);} function gm() { mbyte = 0; marr=""; for (y=31; y>=0; y--){ for (x=0; x<=31; x++) if(canam.findName(y+'x'+x).Fill.Color < 0 ) marr=marr+"0"; else marr=marr+="1"; } res=res+marr; } function getFillColor(color) { var fill = color; if (fill < 0) { fill = (16777216 + parseInt(fill)); } fill = fill.toString(16); if (fill.length > 6) { fill = fill.substr(fill.length - 6); } while (fill.length < 6) { fill = "0" + fill; } fill = "#" + fill; return fill; } function getcol(){res=""; for (y=31; y>=0; y--){ for (x=0; x<32; x++){ var color = canam.findName(y+'x'+x).Fill.Color; var rcol = getFillColor(color); if (rcol == "#ffffff") rcol="#fffffe"; rc = rcol.substring(1,3); gc = rcol.substring(3,5); bc = rcol.substring(5); res=res+ rcol; } } } function doaj() { res=""; getcol(); gm(); document.getElementById ("dcur").value=res; var mylist=document.getElementById("opx"); document.getElementById("hsx").value=mylist.options [mylist.selectedIndex].text; var mylisty=document.getElementById("opy"); document.getElementById("hsy").value=mylisty.options [mylisty.selectedIndex].text; } function dldoaj() { res=""; getcol(); gm(); document.getElementById("dldcur").value=res; var mylist=document.getElementById("opx"); document.getElementById("dlhsx").value=mylist.options[mylist.selectedIndex].text; var mylisty=document.getElementById("opy"); document.getElementById("dlhsy").value=mylisty.options[mylisty.selectedIndex].text; } function dlicon() { res=""; getcol(); gm(); document.getElementById("dlico").value=res; } function csl3() { Silverlight.createObject("mysl3.xaml", psl3, "msl",{ width:'32', height:'32', inplaceInstallPrompt:false, background:'#D3F9BC"', isWindowless:'false', framerate:'24', version:'1.0' },{ onError:null, onLoad:null }, null); } function OnMouseLeftButtonDown(sender, mouseEventArgs) { bx = (mouseEventArgs.getPosition(null).x /12); by = (mouseEventArgs.getPosition(null).y /12); cmdown = true; switch (stamp) { case 0: { if (thick == false) { if (trans == false) { sender["Fill"] = curcol; cam2.findName(sender.Name).Fill = curcol; } else { sender["Fill"] = "transparent"; cam2.findName(sender.Name).Fill = "transparent"; } } else if (by<31 && by>1 && bx<31 && bx>1) { sender.findName(Math.floor(by)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx-1)).Fill = curcol; } } break; case 1: { if (by<30 && by>2 && bx<30 && bx>2) { sender.findName(Math.floor(by+2)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx-2)).Fill = curcol; } } break; case 2: { if (by<30 && by>2 && bx<30 && bx>2) { sender.findName(Math.floor(by+2)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx)).Fill = curcol; } } break; case 3: { if (by<30 && by>2 && bx<30 && bx>2) { sender.findName(Math.floor(by+2)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor (bx+2)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor (bx-2)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor (bx+2)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor (bx-2)).Fill = curcol; } } break; case 4: { if (by<30 && by>2 && bx<30 && bx>2) { sender.findName(Math.floor(by)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx+1)).Fill = curcol; } } break; case 5: { if (by<30 && by>2 && bx<30 && bx>2) { sender.findName(Math.floor(by+1)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx-2)).Fill = curcol; } } break; case 6: { if (by<30 && by>2 && bx<30 && bx>2) { sender.findName(Math.floor(by)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx-1)).Fill = curcol; } } break; case 7: { if (by<30 && by>2 && bx<30 && bx>2) { sender.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx+2)).Fill = curcol; } } break; case 8: { if (by<31 && by>1 && bx<31 && bx>1) { sender.findName(Math.floor(by)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx-1)).Fill = curcol; } } break; case 9: { if (by<30 && by>2 && bx<30 && bx>2) { sender.findName(Math.floor(by)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx-2)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx+2)).Fill = curcol; sender.findName(Math.floor(by-2)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by+2)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx-2)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx+2)).Fill = curcol; cam2.findName(Math.floor(by-2)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by+2)+"x"+Math.floor(bx)).Fill = curcol; } } break; case 10: { } break; default: return false; } return false; } function OnMouseMove(sender, mouseEventArgs) { bx = (mouseEventArgs.getPosition(null).x /12); by = (mouseEventArgs.getPosition(null).y /12); document.fn.posxy.value= Math.ceil(bx) +"x" + Math.ceil(by); if (stamp == 0) { if (cmdown == true) { if (thick == false) { if (trans == false) { sender["Fill"] = curcol; cam2.findName(sender.Name).Fill = curcol; } else { sender["Fill"] = "transparent"; cam2.findName(sender.Name).Fill = "transparent"; } } else if (by<31 && by>1 && bx<31 && bx>1) { sender.findName(Math.floor(by)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by-1)+"x"+Math.floor(bx-1)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx+1)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx)).Fill = curcol; sender.findName(Math.floor(by+1)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by-1)+"x"+Math.floor(bx-1)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx+1)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx)).Fill = curcol; cam2.findName(Math.floor(by+1)+"x"+Math.floor(bx-1)).Fill = curcol; } } } } function OnMouseLeftButtonUp(sender, mouseEventArgs) { cmdown = false; } function copg(sender) { } function undo() { } function creategrid(sender, args) { var canvastop = 12; var canvasleft = 12; var slControl = sender.getHost(); canam = sender; for (y = 0; y < 32; ++y) { for (x = 0; x < 32; ++x) { cellid = y+'x'+x; xamlstring = '<Rectangle Height="12" Width="12" Fill="transparent" MouseLeftButtonDown="OnMouseLeftButtonDown" MouseLeftButtonUp="OnMouseLeftButtonUp" MouseMove="OnMouseMove" '; xamlstring += " Name = '" + (cellid) + "'"; xamlstring += " Canvas.Left = '" + (canvasleft*x) + "'"; xamlstring += " Canvas.Top = '" + (canvastop*y) + "'"; xamlstring += "/>"; var e = slControl.content.createFromXaml(xamlstring); var canvas = sender; canvas.children.Add(e); } } } function cg2(sender, args) { var canvastop = 1; var canvasleft = 1; var slControl = sender.getHost(); cam2 = sender; for (y = 0; y < 32; ++y) { for (x = 0; x < 32; ++x) { cellid = y+'x'+x; xamlstring = '<Rectangle Height="1" Width="1" Fill="transparent" '; xamlstring += " Name = '" + (cellid) + "'"; xamlstring += " Canvas.Left = '" + (canvasleft*x) + "'"; xamlstring += " Canvas.Top = '" + (canvastop*y) + "'"; xamlstring += "/>"; var e = slControl.content.createFromXaml(xamlstring); var canvas = sender; canvas.children.Add(e); } } } function cg3(sender, args) { var canvastop = 1; var canvasleft = 1; var slControl = sender.getHost(); cam3 = sender; for (y = 0; y < 32; ++y) { for (x = 0; x < 32; ++x) { cellid = y+'x'+x; xamlstring = '<Rectangle Height="1" Width="1" Fill="transparent" '; xamlstring += " Name = '" + (cellid) + "'"; xamlstring += " Canvas.Left = '" + (canvasleft*x) + "'"; xamlstring += " Canvas.Top = '" + (canvastop*y) + "'"; xamlstring += "/>"; var e = slControl.content.createFromXaml(xamlstring); var canvas = sender; canvas.children.Add(e); } } } function clearcells() { for (y = 0; y < 32; ++y) for (x = 0; x < 32; ++x) { canam.findName(y+'x'+x).Fill = "transparent"; cam2.findName (y+'x'+x).Fill = "transparent"; } } function ml() { for (y = 0; y < 32; ++y) for (x = 0; x < 31; ++x) { cellid = y+'x'+x; canam.findName (cellid).Fill = canam.findName(y+'x'+(x+1)).Fill; cam2.findName(cellid).Fill = cam2.findName(y+'x'+(x+1)).Fill; } mll(); } function mll() { for (y = 0; y < 32; ++y) { canam.findName(y+"x"+31).Fill = "transparent"; cam2.findName(y+"x"+31).Fill = "transparent"; } } function mr() { for (y = 31; y >= 0; --y) for (x = 31; x >= 1; --x) { cellid = y+'x'+x; canam.findName(cellid).Fill = canam.findName(y+'x'+(x-1)).Fill; cam2.findName(cellid).Fill = cam2.findName(y+'x'+(x-1)).Fill; } mrr(); } function mrr() { for (y = 0; y < 32; ++y) { canam.findName (y+"x"+0).Fill = "transparent"; cam2.findName(y+"x"+0).Fill = "transparent"; } } function md() { for (y = 30; y >= 0; --y) for (x = 31; x >= 0; --x) { canam.findName((y+1)+"x"+x).Fill = canam.findName((y)+"x"+x).Fill; cam2.findName((y+1)+"x"+x).Fill = cam2.findName((y) +"x"+x).Fill; } mdd(); } function mdd() { for (y = 0; y < 32; ++y) { canam.findName(0+"x"+y).Fill = "transparent"; cam2.findName (0+"x"+y).Fill = "transparent"; } } function mu() { for (y = 0; y < 31; ++y) for (x = 0; x < 32; ++x) { canam.findName(y+"x"+x).Fill = canam.findName((y+1)+"x"+x).Fill; cam2.findName(y+"x"+x).Fill = cam2.findName((y+1)+"x"+x).Fill; } muu(); } function muu() { for (y = 0; y < 32; ++y) { canam.findName(31+"x"+y).Fill = "transparent"; cam2.findName(31+"x"+y).Fill = "transparent"; } } function thlt(){thick = true;stamp = 0;} function thlf(){thick = false;stamp = 0;} function $(v,o) { return((typeof(o)=='object'?o:document).getElementById(v)); } function $S(o) { o=$(o); if(o) return(o.style); } function abPos(o) { var o=(typeof(o)=='object'?o:$(o)), z={X:0,Y:0}; while(o!=null) { z.X+=o.offsetLeft; z.Y+=o.offsetTop; o=o.offsetParent; }; return(z); } function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); } function isset(v) { return((typeof(v)=='undefined' || v.length==0)?false:true); } function toggle(i,t,xy) { var v=$S(i); v.display=t?t:(v.display=='none'?'block':'none'); if(xy) { v.left=xy[0]; v.top=xy[1]; } } function XY(e,v) { var o=agent('msie')?{'X':e.clientX+document.body.scrollLeft,'Y':e.clientY+document.body.scrollTop}: {'X':e.pageX,'Y':e.pageY}; return(v?o[v]:o); } function zero(n) { return(!isNaN(n=parseFloat(n))?n:0); } function zindex(d) { d.style.zIndex=zINDEX++; } Picker={}; Picker.stop=1; chocol=function(o,e,xy,z,fu) { function point(a,b,e) { eZ=XY(e); commit([eZ.X+a,eZ.Y+b]); } function M(v,a,z) { return(Math.max(!isNaN(z)? z:0,!isNaN(a)?Math.min(a,v):v)); } function commit(v) { if(fu) fu(v); if(o=='cmdruc') { var W=parseInt($S('cmpac').width), W2=W/2, W3=W2/2; var x=v[0]-W2-3, y=W-v[1]-W2+21, SV=Math.sqrt(Math.pow(x,2)+Math.pow(y,2)), hue=Math.atan2(x,y)/(Math.PI*2); hsv={'H':hue>0?(hue*360): ((hue*360)+360), 'S':SV<W3?(SV/W3)*100:100, 'V':SV>=W3?Math.max(0,1-((SV-W3)/(W2-W3)))*100:100}; document.ccpic.style.backgroundColor='#'+ color.HSV_HEX(hsv); curcol='#'+ color.HSV_HEX(hsv); trans = false; document.ccpic.src='images/_.gif'; color.cords(W); } else if(o=='mSize') { var b=Math.max(Math.max(v[0],v[1])+oH,75); color.cords(b); $S('cmid').height=(b+28)+'px'; $S('cmid').width=(b+20)+'px'; $S ('cmpac').height=b+'px'; $S('cmpac').width=b+'px'; } else { if(xy) v=[M(v[0],xy[0],xy[2]), M(v[1],xy[1],xy[3])]; if(!xy || xy[0]) d.left=v [0]+'px'; if(!xy || xy[1]) d.top=v[1]+'px'; } }; if(Picker.stop) { Picker.stop=''; var d=$S(o), eZ=XY(e); if(!z) zindex($(o)); if (o=='cmdruc') { var ab=abPos($(o).parentNode); point(-(ab.X-5),-(ab.Y-28),e); } if(o=='mSize') { var oH=parseInt($S('cmpac').height), oX=- XY(e).X, oY=-XY(e).Y; } else { var oX=zero(d.left)-eZ.X, oY=zero(d.top)-eZ.Y; } document.onmousemove=function(e){ if(!Picker.stop) point (oX,oY,e); }; document.onmouseup=function(){ Picker.stop=1; document.onmousemove=''; document.onmouseup=''; }; } }; Picker.hsv={H:0, S:0, V:100}; zINDEX=2; color={}; color.cords=function(W) { var W2=W/2, rad=(hsv.H/360)*(Math.PI*2), hyp=(hsv.S+(100-hsv.V))/100*(W2/2); $S ('cmdruc').left=Math.round(Math.abs(Math.round(Math.sin(rad)*hyp)+W2+3))+'px'; $S('cmdruc').top=Math.round(Math.abs(Math.round(Math.cos (rad)*hyp)-W2-21))+'px'; }; color.HEX=function(o) { o=Math.round(Math.min(Math.max(0,o),255)); return("0123456789ABCDEF".charAt((o-o% 16)/16)+"0123456789ABCDEF".charAt(o%16)); }; color.RGB_HEX=function(o) { var fu=color.HEX; return(fu(o.R)+fu(o.G)+fu(o.B)); }; color.HSV_RGB=function(o) { var R, G, A, B, C, S=o.S/100, V=o.V/100, H=o.H/360; if(S>0) { if(H>=1) H=0; H=6*H; F=H-Math.floor(H); A=Math.round(255*V*(1-S)); B=Math.round(255*V*(1-(S*F))); C=Math.round(255*V*(1-(S*(1-F)))); V=Math.round(255*V); switch(Math.floor(H)) { case 0: R=V; G=C; B=A; break; case 1: R=B; G=V; B=A; break; case 2: R=A; G=V; B=C; break; case 3: R=A; G=B; B=V; break; case 4: R=C; G=A; B=V; break; case 5: R=V; G=A; B=B; break; } return({'R':R?R:0, 'G':G?G:0, 'B':B?B:0, 'A':1}); } else return({'R':(V=Math.round(V*255)), 'G':V, 'B':V, 'A':1}); }; color.HSV_HEX=function(o) { return(color.RGB_HEX(color.HSV_RGB(o))); }; 