// USAGE SYNTAX // register('unload', 'myfunc();'); // unregister('unload', 'myfunc();'); // execute_registered('unload'); var registered_routines = new Array(); function find_registered_object (obj) { var obj_index = -1; for ( var i = 0; i < registered_routines.length; i++ ) if ( registered_routines[i][0] == obj ) return i; return obj_index; } function register (obj, func) { var obj_index = find_registered_object (obj); if ( obj_index == -1 ) { registered_routines[registered_routines.length] = new Array(); obj_index = registered_routines.length - 1; registered_routines[obj_index][0] = obj; } registered_routines[obj_index][registered_routines[obj_index].length] = func; return true; } function unregister (obj, func) { var obj_index = find_registered_object (obj); var temp_array = new Array(); if ( obj_index == -1 ) return true; if ( ! ( func == null || func.length <= 0 ) ) for ( var i = 0; i < registered_routines[obj_index].length; i++ ) if ( registered_routines[obj_index][i] != func ) temp_array[temp_array.length] = registered_routines[obj_index][i]; registered_routines[obj_index] = temp_array; return true; } function execute_registered (obj) { var obj_index = find_registered_object (obj); if ( obj_index == -1 ) return true; for ( var i = 1; i < registered_routines[obj_index].length; i++ ) if ( ! eval(registered_routines[obj_index][i]) ) return false; return true; } function pcon (offer_id, offer_instance_id, offer_placement) { url = 'http:\/\/registration.musthavefreegifts.com/index.cfm/track/offer/offer_id/' + offer_id + '/offer_instance_id/' + offer_instance_id + '/offer_placement/' + offer_placement + '/refresh/54352578/'; win = window.open(unescape(url)); win.blur(); } function fcnPopUp(location, windowname, height, width, resize, location2, status) { winbowObject = window.open(location, windowname, 'toolbar=yes,alwaysRaised=yes,resizable='+resize+',location='+location2+',directories=no,scrollbars=yes,menubars=no,status='+status+',height='+height+',width='+width+',screenX=100,screenY=100,top=100,left=100'); } var popUpWin=0; function popUpWindow(URLStr, title, left, top, width, height) { if(popUpWin) { if(!popUpWin.closed) popUpWin.close(); } popUpWin = open(URLStr, title, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+''); } register('unload', 'unregister(\'page_unload\', \'\')');