// Make confirmation box with given 'message', then proceed to the given 'page'.
function popWin(page,message)
{ if (confirm(message)) { location.href = page; } }
// Delete a cookie
function delete_cookie(cookie_name)
{
var kill_time = new Date("November 30, 1975");
var kill_string = "client_name="+cookie_name+";expires=" + kill_time.toGMTString();
document.cookie = kill_string;
}
// Cross browser printing ------------------------
// --- Istvan - 25/05/2004
function printit()
{
if (window.print) { window.print(); }
else
{
var WebBrowser = '';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(6, 2); //Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = "";
}
}
// trim() function - Does what trim() does in, for example, ColdFusion or PHP. -------------------------
// Returns the trimmed string.
// --- Istvan - 25/05/2004
function trim(s)
{
if (typeof s != "string") { return s; }
else
{
// Remove leading spaces and carriage returns
while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r')) { s = s.substring(1,s.length); }
// Remove trailing spaces and carriage returns
while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r')) { s = s.substring(0,s.length-1); }
return s;
}
}
// --- Delayed pop-up-subscribe window --------------------------------------------------------------
// --- Istvan - 15/01/2004
function addslashes(str) {
str=str.replace(/\'/g,'\\\'');
str=str.replace(/\"/g,'\\"');
str=str.replace(/\\/g,'\\\\');
str=str.replace(/\0/g,'\\0');
return str;
}
// -- Optional feature to automatically close the pop-up window after a defined amount of time. --
closetime = 0; // '0' means don't close automatically.
function Start(url, width, height) {
// -- Creates the popup window with 'delay' seconds delay. --
windowprops = "left=50,top=50,width=" + width + ",height=" + height;
preview = window.open(url, "preview", windowprops);
if (closetime) setTimeout("preview.close();", closetime*1000);
}
function doPopup(url, width, height, delay) {
// -- Sets up to create the popup window. --
// These variables are sent through the "readPopupCookie()" function in the pagestart.cfm file.
// url = Link to the pop-up file. I.e.: '/popup.cfm'
// width = Width of window in pixels. I.e.: '300'
// height = Height of window in pixels. I.e.: '200'
// delay = Time in seconds before popup opens. I.e.: '10'
url1 = url;
width1 = width;
height1 = height;
timer = setTimeout("Start(url1, width1, height1)", delay*1000);
}
function getDaysExpiry(noDays){
// -- Calculate expiry time when days are used. --
var today = new Date();
var expr = new Date(today.getTime() + noDays*24*60*60*1000);
return expr.toGMTString();
}
function getHoursExpiry(noHours){
// -- Calculate expiry time when hours are used. --
var today = new Date();
var expr = new Date(today.getTime() + noHours*60*60*1000);
return expr.toGMTString();
}
function wwwPathToDomainName(www_path){
// -- Remove 'http://', 'www.' and 'www.members.' from 'www_path' --
var pattern1 = /\bhttp:\/\//ig; // anything that begins with 'http://'.
var pattern2 = /\bwww\./ig; // anything that begins with 'www.'.
var pattern3 = /\bmembers\./ig; // anything that begins with 'members.'.
siteDomainA = www_path.replace(pattern1,""); // replace 'http://' with nothing... ie: remove it.
siteDomainB = siteDomainA.replace(pattern2,""); // replace 'www.' with nothing... ie: remove it.
siteDomain = siteDomainB.replace(pattern2,""); // if after removing 'www.' the remaining string begins with 'members.', replace that with nothing as well... ie: remove it.
return siteDomain;
}
function readPopupCookie(siteID, url, width, height, delay, num_hours, www_path){
// -- Checks and/or makes pop-up cookie and runs pop-up function if no disabling cookies have been set. --
// -- Set in the 'pagestart.cfm' file. --
var siteDomain = wwwPathToDomainName(www_path); // Clean-up www_path.
var smShownPop = 'smShownPop' + siteID; // Make name of cookie.
var smSubscribed = 'smSubscribed' + siteID; // Make name of cookie.
var smShownPopC = document.cookie.indexOf(smShownPop); // This exists if popup has alredy appeared within 'num_hours'.
var smSubscribedC = document.cookie.indexOf(smSubscribed); // This exists if someone has already submitted through the popup within 'num_days' (set in the 'subscribed()' function below).
if (smShownPopC == -1 && smSubscribedC == -1) { // If no pop-up disabling cookies exist... then...
doPopup(url, width, height, delay); // Runs pop-up function, pop-up appears in 'delay' seconds... and...
document.cookie=smShownPop + "=shown; path=/; domain=" + siteDomain + "; expires=" + getHoursExpiry(num_hours); // Sets cookie to disable pop-up for 'num_hour' hours.
}
}
function subscribed(siteID, num_days, www_path){
// -- Sets cookie when submit button is pressed in the popup window. --
// -- Will disable the popup for 'num_days' days. --
// -- Set in the pop-up file's submit button with 'onClick'. --
var siteDomain = wwwPathToDomainName(www_path); // Clean-up www_path.
var smSubscribed = 'smSubscribed' + siteID; // Make name of cookie.
document.cookie = smSubscribed + "=subscribed; path=/; domain=" + siteDomain + "; expires=" + getDaysExpiry(num_days); // Set cookie.
}
// - P O P - U P W I N D O W F U N C T I O N S E N D H E R E ---------
// ---- Macromedia image rollover -------------------
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i= 0)
}
function is_object(v){
return (typeof(v)=="object");
}
function urlencode(str) {
str = escape(str);
str = str.replace('+', '%2B');
str = str.replace('%20', '+');
str = str.replace('*', '%2A');
str = str.replace('/', '%2F');
str = str.replace('@', '%40');
str = str.replace('&', '%26');
str = str.replace('=', '%3D');
return str;
}
function urldecode(str) {
str = str.replace('+', ' ');
str = unescape(str);
return str;
}
function http_build_query( formdata, numeric_prefix, key ) {
var numeric_prefix = (typeof(numeric_prefix)=="undefined") ? null : numeric_prefix;
var key = (typeof(key)=="undefined") ? null : key;
var res = new Array();
for (var k in formdata) {
var v = formdata[k];
if (typeof(v)=='function') continue; // skip this, it's not what we want
var tmp_key = encodeURI( is_int(k) ? new Number(numeric_prefix)+new Number(k) : k);
if (key) tmp_key = key+'['+tmp_key+']';
add_to_res = ( ( is_array(v) || is_object(v) ) ? http_build_query(v, key, tmp_key) : tmp_key+"="+escape(v) );
res.push(add_to_res);
}
separator = '&';
return res.join(separator);
}
function get_checked_radioObj_value(radioObj){
if(!radioObj)
return "";
var radioLength = radioObj.length;
if(radioLength == undefined)
if(radioObj.checked)
return radioObj.value;
else
return "";
for(var i = 0; i < radioLength; i++) {
if(radioObj[i].checked) {
return radioObj[i].value;
}
}
return "";
}
function text_select_change(show_select, select_field, text_field, change_butt){
if (show_select){
select_field.style.display='';
text_field.style.display='none';
change_butt.style.display='none';
select_field.disabled=false;
text_field.disabled=true;
} else {
select_field.style.display='none';
text_field.style.display='';
change_butt.style.display='';
select_field.disabled=true;
text_field.disabled=false;
}
}
in_array = function ( arr, obj ) {
var len = arr.length;
for ( var x = 0 ; x <= len ; x++ ) {
if ( arr[x] == obj ) return true;
}
return false;
}
function $(el) {
if (!el) {
return null;
}
if (el.htmlElement) {
return Garbage.collect(el);
}
if ([window, document].contains(el)) {
return el;
}
var type = $type(el);
if (type == "string") {
el = document.getElementById(el);
type = el ? "element" : false;
}
if (type != "element") {
return null;
}
if (el.htmlElement) {
return Garbage.collect(el);
}
if (["object", "embed"].contains(el.tagName.toLowerCase())) {
return el;
}
$extend(el, Element.prototype);
el.htmlElement = function () {};
return Garbage.collect(el);
}