// Title: Tigra Color Picker // URL: http://www.softcomplex.com/products/tigra_color_picker/ // Version: 1.1 // Date: 06/26/2003 (mm/dd/yyyy) // Note: Permission given to use this script in ANY kind of applications if // header lines are left unchanged. // Note: Script consists of two files: picker.js and picker.html var TCP = new TColorPicker(); function TCPopup(field, palette) { this.field = field; this.initPalette = !palette || palette > 3 ? 0 : palette; var w = 194, h = 240, move = screen ? ',left=' + ((screen.width - w) >> 1) + ',top=' + ((screen.height - h) >> 1) : '', o_colWindow = window.open('/picker.html', null, "help=no,status=no,scrollbars=no,resizable=no" + move + ",width=" + w + ",height=" + h + ",dependent=yes", true); o_colWindow.opener = window; o_colWindow.focus(); } function TCBuildCell (R, G, B, w, h) { return ''; } function TCSelect(c) { this.field.value = '#' + c.toUpperCase(); document.getElementById('avatarid').style.backgroundColor = '#' + c.toUpperCase(); this.win.close(); } function TCPaint(c, b_noPref) { c = (b_noPref ? '' : '#') + c.toUpperCase(); if (this.o_samp) this.o_samp.innerHTML = '' + c +' ' + c + '' if(this.doc.layers) this.sample.bgColor = c; else { if (this.sample.backgroundColor != null) this.sample.backgroundColor = c; else if (this.sample.background != null) this.sample.background = c; } } function TCGenerateSafe() { var s = ''; for (j = 0; j < 12; j ++) { s += ""; for (k = 0; k < 3; k ++) for (i = 0; i <= 5; i ++) s += this.bldCell(k * 51 + (j % 2) * 51 * 3, Math.floor(j / 2) * 51, i * 51, 8, 10); s += ""; } return s; } function TCGenerateWind() { var s = ''; for (j = 0; j < 12; j ++) { s += ""; for (k = 0; k < 3; k ++) for (i = 0; i <= 5; i++) s += this.bldCell(i * 51, k * 51 + (j % 2) * 51 * 3, Math.floor(j / 2) * 51, 8, 10); s += ""; } return s } function TCGenerateMac() { var s = ''; var c = 0,n = 1; var r,g,b; for (j = 0; j < 15; j ++) { s += ""; for (k = 0; k < 3; k ++) for (i = 0; i <= 5; i++){ if(j<12){ s += this.bldCell( 255-(Math.floor(j / 2) * 51), 255-(k * 51 + (j % 2) * 51 * 3),255-(i * 51), 8, 10); }else{ if(n<=14){ r = 255-(n * 17); g=b=0; }else if(n>14 && n<=28){ g = 255-((n-14) * 17); r=b=0; }else if(n>28 && n<=42){ b = 255-((n-28) * 17); r=g=0; }else{ r=g=b=255-((n-42) * 17); } s += this.bldCell( r, g,b, 8, 10); n++; } } s += ""; } return s; } function TCGenerateGray() { var s = ''; for (j = 0; j <= 15; j ++) { s += ""; for (k = 0; k <= 15; k ++) { g = Math.floor((k + j * 16) % 256); s += this.bldCell(g, g, g, 9, 7); } s += ''; } return s } function TCDec2Hex(v) { v = v.toString(16); for(; v.length < 6; v = '0' + v); return v; } function TCChgMode(v) { for (var k in this.divs) this.hide(k); this.show(v); } function TColorPicker(field) { this.build0 = TCGenerateSafe; this.build1 = TCGenerateWind; this.build2 = TCGenerateGray; this.build3 = TCGenerateMac; this.show = document.layers ? function (div) { this.divs[div].visibility = 'show' } : function (div) { this.divs[div].visibility = 'visible' }; this.hide = document.layers ? function (div) { this.divs[div].visibility = 'hide' } : function (div) { this.divs[div].visibility = 'hidden' }; // event handlers this.C = TCChgMode; this.S = TCSelect; this.P = TCPaint; this.popup = TCPopup; this.draw = TCDraw; this.dec2hex = TCDec2Hex; this.bldCell = TCBuildCell; this.divs = []; } function TCDraw(o_win, o_doc) { this.win = o_win; this.doc = o_doc; var s_tag_openT = o_doc.layers ? 'layer visibility=hidden top=54 left=5 width=182' : 'div style=visibility:hidden;position:absolute;left:6px;top:54px;width:182px;height:0', s_tag_openS = o_doc.layers ? 'layer top=32 left=6' : 'div', s_tag_close = o_doc.layers ? 'layer' : 'div' this.doc.write('<' + s_tag_openS + ' id=sam name=sam>
sample sample
'); this.sample = o_doc.layers ? o_doc.layers['sam'] : o_doc.getElementById ? o_doc.getElementById('sam').style : o_doc.all['sam'].style for (var k = 0; k < 4; k ++) { this.doc.write('<' + s_tag_openT + ' id="p' + k + '" name="p' + k + '">' + this['build' + k]() + '
'); this.divs[k] = o_doc.layers ? o_doc.layers['p' + k] : o_doc.all ? o_doc.all['p' + k].style : o_doc.getElementById('p' + k).style } if (!o_doc.layers && o_doc.body.innerHTML) this.o_samp = o_doc.all ? o_doc.all.samp : o_doc.getElementById('samp'); this.C(this.initPalette); if (this.field.value) this.P(this.field.value, true) } function add_favorites() { var detect = navigator.userAgent.toLowerCase(); //alert(detect); varsite='http://www.avatarstock.com'; vardesc='avatars'; if(detect.indexOf('opera') + 1) alert("After you close this dialog please press CTRL+T to add to Favorites"); else if(detect.indexOf('msie') + 1) window.external.AddFavorite(varsite,vardesc); else if(detect.indexOf('firefox') + 1) alert("After you close this dialog please press CTRL+D to add to Favorites"); else if(detect.indexOf('netscape') + 1) alert("After you close this dialog please press CTRL+D to add to Favorites"); else alert("Please use your browser's menu to add to Favorites"); } function validate() { if( !document.searchform.searchtext.value || document.searchform.searchtext.value.length < 3) { document.searchform.searchtext.focus(); alert('Search term too short, please try again'); return false; } } function OpenWindow(page,name,w,h,scroll) { setari = 'height='+h+',width='+w+',scrollbars='+scroll+',resizable'; win = window.open('/brokenlink'+page,name,setari); } function OpenWindow1(page,name,w,h,scroll) { setari = 'height='+h+',width='+w+',scrollbars='+scroll+',resizable'; win = window.open(page,name,setari); } function validate() { if( !document.searchform.searchtext.value || document.searchform.searchtext.value.length < 3) { document.searchform.searchtext.focus(); alert('Search term too short, please try again'); return false; } } function OpenWindow(page,name,w,h,scroll) { setari = 'height='+h+',width='+w+',scrollbars='+scroll+',resizable'; win = window.open('/brokenlink'+page,name,setari); } function OpenWindow1(page,name,w,h,scroll) { setari = 'height='+h+',width='+w+',scrollbars='+scroll+',resizable'; win = window.open(page,name,setari); } function checkform(form) { if (form.name.value == '') { alert ("Please enter your name.\n"); form.name.focus(); return false; } if (form.email.value == '') { alert ("Please enter an E-mail address.\n"); form.email.focus(); return false; } var val = emailCheck(form.email.value); if (!val) { form.email.focus(); return false; } if (form.questions.value == '') { alert ("Please enter your questions.\n"); form.questions.focus(); return false; } if (form.code.value == '') { alert ("Please enter image code.\n"); form.code.focus(); return false; } } function emailCheck (emailStr) { var emailPat=/(.+)@(.+)/; var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"; var validChars="\[^\\s" + specialChars + "\]" var quotedUser="(\"[^\"]*\")"; var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; var atom=validChars + '+'; var word="(" + atom + "|" + quotedUser + ")"; var userPat=new RegExp("^" + word + "(\\." + word + ")*$"); var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$"); var matchArray=emailStr.match(emailPat); if (matchArray==null) { alert("The Email address entered seems incorrect (check @ and .'s)"); return false; } var user=matchArray[1] var domain=matchArray[2] if (user.match(userPat)==null) { alert("The email address entered does not have a valid username."); return false; } var IPArray=domain.match(ipDomainPat); if (IPArray!=null) { for (var i=1;i<=4;i++) { if (IPArray[i]>255) { alert("The e-mail address entered appears to be invalid."); return false; } } //return true; } var domainArray=domain.match(domainPat) if (domainArray==null) { alert("The email address entered does not have a valid domain name."); return false; } var atomPat=new RegExp(atom,"g"); var domArr=domain.match(atomPat); var len=domArr.length; if (domArr[domArr.length-1].length<2 ||domArr[domArr.length-1].length>3) { alert("The email address entered does not end in a three-letter domain or two-letter country."); return false; } if (len<2) { var errStr="The email address entered is missing a hostname."; alert(errStr); return false; } return true; } function checkformsubmit(form) { var form=document.formsubmit; if (form.title.value == '') { alert ("Please enter Program Name.\n"); form.title.focus(); return false; } if (form.category.value == '' || form.category.value == 0) { alert ("Please select category.\n"); form.category.focus(); return false; } if (form.price.value == '') { alert ("Please enter price.\n"); form.price.focus(); return false; } if (form.description.value == '') { alert ("Please enter description.\n"); form.description.focus(); return false; } if (form.urls1.value == '') { alert ("Please enter program download link 1.\n"); form.urls1.focus(); return false; } if (form.code.value == '') { alert ("Please enter image code.\n"); form.code.focus(); return false; } } function saveads(id,rr) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return; } var url="/index.php?p=addwishlist&id="+id url=url+"&action="+rr url=url+"&sid="+Math.random() xmlHttp.onreadystatechange=stateChanged ; xmlHttp.open("GET",url,true); xmlHttp.send(null); return; } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { valoare1=xmlHttp.responseText; document.getElementById('saveadid').innerHTML =valoare1; var show = document.getElementById("saveadid"); var showStyle = show.style; showStyle.display = ""; showStyle.padding = "15px 8px 8px 8px"; } } function GetXmlHttpObject() { var objXMLHttp=null if (window.XMLHttpRequest) { objXMLHttp=new XMLHttpRequest() } else if (window.ActiveXObject) { objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") } return objXMLHttp } var xmlHttp var innerstr; var pagsunt; var idto;