//Publicly selectable styles var PublicSubs = new Array( new Array("tealish" , "none", "slick", "dangling", "polite"), new Array("power" , "none", "slick", "dangling"), new Array("mandipurple", "none", "slick", "dangling"), new Array("garish" , "none", "slick", "dangling"), new Array("revolution" , "none"), new Array("w3", "Oldstyle","Modernist","Midnight","Ultramarine","Swiss","Chocolate","Traditional","Steely") ); var LocalLocation = "file:///c|/My Documents/SiteXfer/styles/"; var RemoteLocation = "http://www.therevolution.net/james/styles/"; /////COOKIE CODE I STOLE///// function getCookieVal (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function SetCookie (name, value) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } function DeleteCookie (name) { var exp = new Date(); exp.setTime (exp.getTime() - 1); // This cookie is history var cval = GetCookie (name); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); } /////END-COOKIE CODE I STOLE-END///// function IndexOfTheme(SomeTheme) { var result = -1; for (var i=0; i=0 && iTheme =0); } function SubPublic(SomeTheme, SomeSub) { var iTheme = IndexOfTheme(SomeTheme); return ((SomeTheme!=null) && (IndexOfSub(iTheme, SomeSub)>=0)); } function GetThemeURL(SomeTheme) { var Result = "" if (SomeTheme=="w3") { Result = "http://www.w3.org/StyleSheets/Core/" } else { if (document.URL.substring(0, 4)=="file") Result = LocalLocation + SomeTheme + '/'; // Result = "file:///c|/temp/styles/" + SomeTheme + '/'; else Result = RemoteLocation + SomeTheme + '/'; } return Result; } function WriteStyles(SomeTheme, SomeSub) { if (SomeTheme=="w3") { if (SomeTheme !=null) { document.writeln( '' ); } } else { // document.writeln(''); document.writeln(''); if (SomeSub!=null) // document.writeln(''); document.writeln(''); } } function ThemeSelected() { var SomeTheme = document.forms.StyleBar.ThemeChoice.value; if (SomeTheme == 'default') DeleteCookie("theme"); else SetCookie("theme", SomeTheme); window.location.reload(); } function SubSelected() { var SomeSub = document.forms.StyleBar.SubChoice.value; if (SomeSub =='default') DeleteCookie("sub") else SetCookie("sub", SomeSub); window.location.reload(); } ////////////////////////////////////////////////////////////////// var TheTheme = null; var TheSub = null; var SubMsg = ""; var ThemeMsg = ""; var UserTheme = false; var UserSub = false; function InitGlobals() { //First try using the User's preferred Theme TheTheme = GetUserTheme(); if (TheTheme!=null) { UserTheme = true if (!ThemePublic(TheTheme)) { TheTheme=null; ThemeMsg="Couldn't get desired Theme" } } else TheTheme=GetDefaultTheme(); //Now determine the Sub-Style-thing if (TheTheme != null) { //Try user's prefered Theme TheSub = GetUserSub() //wether using User or Doc Sub, we don't set it to null because it may be //a "customization" -- a Sub that is not publically listed. So the most //we do is define a few warnings if (TheSub!=null) { UserSub = true; if ( !SubPublic(TheTheme, TheSub) ) SubMsg="Desired Sub doesn't exist" } else { TheSub=GetDefaultSub(); if (UserTheme && !SubPublic(TheTheme, TheSub)) SubMsg="Sub may not exist in Theme" } } //TheTheme != null } /////////////////////////////////////////////////////// function WriteSelectorControls() { var iTheme = IndexOfTheme(TheTheme); //THEME// document.write('Theme: '); //SUB// document.write('
Sub: '); //Write Errors if (ThemeMsg !="") document.write('
'+ ThemeMsg+''); if (SubMsg !="") document.write('
'+ SubMsg+''); } function SetPointers() { //Usings this function seems to cause horrendous screwups in mozilla, //so we do it by document.write("SELECTED") on the appropriate OPTION if (UserTheme) document.forms.StyleBar.ThemeChoice.value = TheTheme; else document.forms.StyleBar.ThemeChoice.value = 'default'; if (TheTheme==null) document.forms.StyleBar.SubChoice.value = 'error'; else if (UserSub) document.forms.StyleBar.SubChoice.value = TheSub; else document.forms.StyleBar.SubChoice.value = 'default'; } function UseStyleBar() { SetCookie("UseStyleBar", "YES"); window.location.reload(); } function UnUseStyleBar() { DeleteCookie("UseStyleBar"); window.location.reload(); } function WriteSelectorBar() { dis("DocTheme = " + GetDefaultTheme()); dis("DocSub = " + GetDefaultSub()); dis("UserTheme = " + GetUserTheme()); dis("UserSub = " + GetUserSub()); dis("TheTheme = " + TheTheme); dis("TheSub = " + TheSub); dis("ThemeMsg = " + ThemeMsg); dis("SubMsg = " + SubMsg); // document.write('
'); document.write('
'); if (GetCookie("UseStyleBar")!="YES") { // document.write('
'); document.write(''); document.write(''); document.write('
'); } else { // document.write('
'); document.write(''); document.write('
'); document.write('
'); // document.write('
'); document.write(''); WriteSelectorControls() document.write('
'); } document.write('
'); } /////DEBUG//////////////////////////////////////////////////////////// function dis(message) { //document.write('
'+message); } function WriteArray(comment, a) { document.write(''); var x=new Number(); for (x=0;x '); document.write(a[x]); } document.write('
'+comment+'
'); } function WriteArray2D(comment, a) { document.write(''); var x=new Number(); var y=new Number(); for (x=0;x'); document.write('
'+comment+'
array['+x+']'); for (y=0;y '); document.write(a[x][y]); } } document.write('
'); } ////////////////////////////////////////////////////////////////////// if (GetCookie("UseStyleBar")=="YES") { InitGlobals() WriteStyles(TheTheme , TheSub ); }