User:Documentalist/Utilities.js

/*Ruler--- 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

/***************************************************************************************** Ultitilies /*--*/ function CreateAttribute(Name, Value) { var Att = document.createAttribute(Name); Att.value = Value; return Att; } /*--*/ function GetCookie(Name) { var Value = document.cookie; var Start = Value.indexOf(" " + Name + "="); if (Start == -1) { Start = Value.indexOf(Name + "="); } if (Start == -1) { Value = null; } else { Start = Value.indexOf("=", Start) + 1; var End = Value.indexOf(";", Start); if (End == -1) { End = Value.length; }   Value = unescape(Value.substr(Start, End - Start)); } return Value; } /*--*/ function Search(SearchThis, In) { for (var Index = 0; Index < In.length; ++Index) { if (In.substr(Index, SearchThis.length) == SearchThis) return true; } return false; } /*--*/ function SetCookie(Name, Value, ExpiryDays) { var ExpiryDate = new Date; ExpiryDate.setDate(ExpiryDate.getDate + ExpiryDays); var CookieValue = escape(Value) + ((ExpiryDays == null)? "": "; expires="+ExpiryDate.toUTCString); document.cookie= Name + "=" + CookieValue; }