/* Clean up URL removing unnecessary ../'s from middle of it */ function WW_cleanupurl(url) { var pos,posone,postwo; posone=0; while( (pos=url.indexOf('/../',posone)) > 0 ) { if(url.charAt(pos-1) == '.' ) { posone = pos+4; continue; } postwo = url.lastIndexOf('/',pos-1) if( postwo < 0 ) { url = url.substring(pos+4,url.length); posone=0; continue; } url = url.substring(0,postwo+1) + url.substring(pos+4,url.length); } return(url); } // End WW_cleanupurl(url) /* Add stem to newurl if latter is a relative address */ /* stem must end with a slash and this is added if missing */ function WW_checkurl(inputstem,newurl) { var cleanedupurl,stem; if( inputstem == null ) return newurl; stem = inputstem; if(stem.charAt(stem.length-1) != '/') { stem = inputstem + '/'; } var len = newurl.length; // Property of string object if( len < 7 ) { cleanedupurl = WW_cleanupurl(stem + newurl); return (cleanedupurl); } // Input was not absolute var grab = newurl.substring(0,6); // Get first six characters if( (grab == "ftp://") || (grab == "http:/") ) return newurl; // input was definitely absolute cleanedupurl = WW_cleanupurl(stem + newurl); return (cleanedupurl); } // End WW_checkurl(inputstem,newurl) /* Get stem from a URL */ function WW_geturlstem(url) { var pos; pos = url.lastIndexOf('/'); if( pos < 0 ) { return( '' ); } return(url.substring(0,pos+1)); } // End WW_geturlstem(url) // Set of Cookie Processing Routines function WW_processcookie(cookiename,formentry) { var val = unescape(formentry.value); WW_setcookie(cookiename,val); return true; } // End WW_processcookie(cookiename,formentry) function WW_setcookie(name,value) { time = new Date(); var timevalue = time.getTime(); time.setTime(timevalue + 6000000); var cookietime = time.toGMTString(); document.cookie = "Wisdom" + name + "=" + escape(value) + "; expires=" + cookietime + ";path=/;"; return true; } // End WW_setcookie(name,value) // Get Cookie value using default if not there or defined as DEFAULT function WW_getCookie(Name,defaultvalue) { var search = "Wisdom" + Name + "=" if (document.cookie.length > 0) { // if there are any cookies offset = document.cookie.indexOf(search) if (offset != -1) { // if cookie exists offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset) // set index of end of cookie value if (end == -1) end = document.cookie.length var answer = unescape(document.cookie.substring(offset, end)) if( (answer == null) || (answer == '') || (answer == 'ASINPUT') || (answer == 'DEFAULT') || (answer == 'undefined') ) answer = defaultvalue; return answer; } } return defaultvalue; } // End WW_getCookie(Name,defaultvalue) function WW_isundefined(testv) { // Return true if object does not exist var testtype = typeof testv; if( testtype == 'undefined' ) return true; if( testv == null ) return true; return false; } // End WW_isundefined(testv) function WW_isdefined(testv) { var testtype = typeof testv; if( testtype == 'undefined' ) return false; if( testv == null ) return false; return true; } // End WW_isdefined(testv) function WW_isitawindow(windowp) { var testtype = typeof windowp; if( testtype == 'undefined' ) return false; if( windowp == null ) return false; var testtype2 = typeof windowp.self; if( testtype2 == 'undefined' ) return false; if( windowp.self == null ) return false; var testtype2 = typeof windowp.closed; if( testtype2 == 'undefined' ) return false; if( windowp.closed == null ) return false; if( windowp.closed ) return false; return true; } // End WW_isitawindow(windowp)