function append(data){cur_content = document.getElementById(data.div).innerHTML; if(data.position == 'before'){ new_content = data.append+cur_content; }else if(data.position == 'after'){ new_content = cur_content+data.append; } document.getElementById(data.div).innerHTML = new_content; }; function fx(div,name,data){ var element = document.getElementById(div); this.move = null; this.div = div; var className = name; this.move_x = 0; this.move_y = 0; this.cur_size_x = 0; this.cur_size_y = 0; this.cur_opacity = 0; this.animation_length = data.length; this.frames_per_sec = data.fps; this.total_frame_count = Math.ceil((this.animation_length * this.frames_per_sec)); this.secs = 1000 * this.animation_length; this.anim_delay = (this.secs / this.total_frame_count); this.move = function(data){  start_x = document.getElementById(this.div).offsetLeft; start_y = document.getElementById(this.div).offsetTop; if(data.x_dir == 'pos'){ end_x = parseInt(start_x) + parseInt(data.x); }else if(data.x_dir = 'neg'){ end_x = parseInt(start_x) - parseInt(data.x); }else{ end_x = start_x; } if(data.y_dir == 'pos'){ end_y = parseInt(start_y) + parseInt(data.y); }else if(data.y_dir == 'neg'){ end_y = parseInt(start_y) - parseInt(data.y); }else{ end_y = start_y; } x_distance_per_frame = parseInt(data.x) / this.total_frame_count; y_distance_per_frame = parseInt(data.y) / this.total_frame_count; cur_pos_x = start_x; cur_pos_y = start_y; this.move.dir_y = data.y_dir; this.move.dir_x = data.x_dir; this.move.end_x = end_x; this.move.end_y = end_y; this.move.adj_x = Math.floor(x_distance_per_frame); this.move.adj_y = Math.floor(y_distance_per_frame); this.move_x = start_x; this.move_y = start_y; eval(className+".move_anim()"); };  this.move_anim = function(){ rerun = false; if(this.move.dir_x == 'pos'){ if(parseInt(this.move_x) < parseInt(this.move.end_x)){ this.move_x = parseInt(this.move_x) + parseInt(this.move.adj_x); rerun = true; } }else if(this.move.dir_x == 'neg'){ if(parseInt(this.move_x) > parseInt(this.move.end_x)){ this.move_x = parseInt(this.move_x) - parseInt(this.move.adj_x); rerun = true; } }else{ }	 if(this.move.dir_y == 'pos'){ if(parseInt(this.move_y) < parseInt(this.move.end_y)){ this.move_y = parseInt(this.move_y) + parseInt(this.move.adj_y); rerun = true; } }else if(this.move.dir_y == 'neg'){ if(parseInt(this.move_y) > parseInt(this.move.end_y)){ this.move_y = parseInt(this.move_y) - parseInt(this.move.adj_y); rerun = true; } }else{ } if(rerun == true){ document.getElementById(this.div).style.left = this.move_x+"px"; document.getElementById(this.div).style.top = this.move_y+"px"; setTimeout(className+".move_anim()",this.anim_delay); }else{ document.getElementById(this.div).style.left = this.move.end_x+"px"; document.getElementById(this.div).style.top = this.move.end_y+"px"; } }; this.resize = function(data){ start_x = parseInt(document.getElementById(this.div).style.width.replace("px")); start_y = parseInt(document.getElementById(this.div).style.height.replace("px")); end_x = parseInt(data.x); end_y = parseInt(data.y); if(start_x < end_x){ x_dir = 'pos';  }else if(start_x > end_x){  x_dir = 'neg'; }else{ x_dir = 'eq'; }  if(start_y < end_y){ y_dir = 'pos'; }else if(start_y > end_y){ y_dir = 'neg'; }else{ y_dir = 'eq'; }  if(x_dir == 'pos'){ x_distance_per_frame = (end_x - start_x) / this.total_frame_count; }else if(x_dir == 'neg'){ x_distance_per_frame = (start_x - end_x) / this.total_frame_count; }else{ x_distance_per_frame = 0; }  if(y_dir == 'pos'){  y_distance_per_frame = (end_y - start_y) / this.total_frame_count; }else if(y_dir == 'neg'){  y_distance_per_frame = (start_y - end_y) / this.total_frame_count; }else{  y_distance_per_frame = 0; } this.resize.dir_x = x_dir; this.resize.dir_y = y_dir; this.resize.end_x = end_x; this.resize.end_y = end_y; this.resize.adj_x = Math.ceil(x_distance_per_frame); this.resize.adj_y = Math.ceil(y_distance_per_frame); this.cur_size_x = start_x; this.cur_size_y = start_y; eval(className+".resize_anim()"); }; this.resize_anim = function(){ rerun = false; if(this.resize.dir_x == 'pos'){ if(parseInt(this.cur_size_x) < parseInt(this.resize.end_x)){ this.cur_size_x = parseInt(this.cur_size_x) + parseInt(this.resize.adj_x); rerun = true; } }else if(this.resize.dir_x == 'neg'){ if(parseInt(this.cur_size_x) > parseInt(this.resize.end_x)){ this.cur_size_x = parseInt(this.cur_size_x) - parseInt(this.resize.adj_x); rerun = true; } } if(this.resize.dir_y == 'pos'){ if(parseInt(this.cur_size_y) < parseInt(this.resize.end_y)){ this.cur_size_y = parseInt(this.cur_size_y) + parseInt(this.resize.adj_y); rerun = true; } }else if(this.resize.dir_y == 'neg'){ if(parseInt(this.cur_size_y) > parseInt(this.resize.end_y)){ this.cur_size_y = parseInt(this.cur_size_y) - parseInt(this.resize.adj_y); rerun = true; } } if(rerun == true){ document.getElementById(this.div).style.width = this.cur_size_x+"px"; document.getElementById(this.div).style.height = this.cur_size_y+"px"; try{ setTimeout(className+".resize_anim()",this.anim_delay); }catch(e){ alert(e); } }else{ document.getElementById(this.div).style.width = this.resize.end_x+"px"; document.getElementById(this.div).style.height = this.resize.end_y+"px"; } }; this.fade = function(data){ this.cur_opacity = data.start_opacity; if(data.callback != false){ this.callback = data.callback.name; this.callback_delay = data.callback.delay; }else{ this.callback = false; } if(data.start_opacity < data.end_opacity){ dir = 'in'; }else{ dir = 'out'; } eval(className+".transition('"+dir+"','"+data.end_opacity+"','"+data.start_opacity+"')"); }; this.transition = function(dir,end_opacity,start_opacity){ rerun = false; switch(dir){ case "in": o_adj = Math.floor((parseInt(end_opacity) - parseInt(start_opacity)) / this.total_frame_count); if(this.cur_opacity < end_opacity){ this.cur_opacity = parseInt(this.cur_opacity) + o_adj; rerun = true; } break; case "out": o_adj = Math.floor((parseInt(start_opacity) - parseInt(end_opacity)) / this.total_frame_count); if(this.cur_opacity > end_opacity){ this.cur_opacity = parseInt(this.cur_opacity) - o_adj; rerun = true; } break; }; if(rerun == true){ document.getElementById(div).style.MozOpacity = this.cur_opacity / 100; document.getElementById(div).style.opacity =  this.cur_opacity / 100; if(navigator.appName.indexOf("Explorer") != -1){ document.getElementById(div).filters.alpha.opacity = this.cur_opacity; } setTimeout(className+".transition('"+dir+"','"+end_opacity+"','"+start_opacity+"')",this.anim_delay); }else{ document.getElementById(div).style.MozOpacity = end_opacity / 100; document.getElementById(div).style.opacity =  end_opacity / 100; if(navigator.appName.indexOf("Explorer") != -1){ document.getElementById(div).filters.alpha.opacity = end_opacity; } if(this.callback != false){ eval('setTimeout("'+this.callback+'",'+this.callback_delay+');') } } } } function ajax(div,name){ var className = name; var element = div; var response = ''; function getHTTPObject(){ if (window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); }else if (window.XMLHttpRequest) { return new XMLHttpRequest();}else{ return null; } } this.post_response = function(data){  xmlhttp = getHTTPObject(); if (xmlhttp != null) { var post_data = data.data; xmlhttp.open(data.type, data.url, true); switch(data.type){ case "POST": xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.setRequestHeader("Content-length", post_data.length); xmlhttp.setRequestHeader("Connection", "close"); xmlhttp.send(post_data); xmlhttp.onreadystatechange = function(){ if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { if(data.update == true){  response = xmlhttp.responseText; eval(className+".update_element()"); } if(data.callback != false){ eval(data.callback);  } } }; break; case "GET": xmlhttp.send(null); xmlhttp.onreadystatechange = function(){ if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { if(data.update == ''){ response = xmlhttp.responseText; eval(className+".update_element()"); } if(data.callback != false){ eval(data.callback); } } }; break;  } } }; this.update_element = function(){ document.getElementById(element).innerHTML = response; }; } function form_values(form_name){ form_length = document.forms[form_name].elements.length; var params = ''; for(var i=0; i < form_length; i++){ fld_value = document.forms[form_name].elements[i].value; fld_nameValue = 'Enter '+document.forms[form_name].elements[i].name.replace("_"," "); if(fld_value.toLowerCase() == fld_nameValue.toLowerCase()){ field_value = ''; }else{ field_value = document.forms[form_name].elements[i].value; } field_value = escape(field_value); if(document.forms[form_name].elements[i].type == 'radio'){ if(document.forms[form_name].elements[i].checked == true){; params += "&"+document.forms[form_name].elements[i].name+"="+field_value } }else{ params += "&"+document.forms[form_name].elements[i].name+"="+field_value; } } return params; } function findPosX(obj) { var curleft = 0; if(obj.offsetParent) { while(1) { curleft += obj.offsetLeft; if(!obj.offsetParent) break; obj = obj.offsetParent; } } else if(obj.x) { curleft += obj.x; } obj.style.position = "static"; return curleft; } function findPosY(obj) { var curtop = 0; if(obj.offsetParent) { while(1) { curtop += obj.offsetTop; if(!obj.offsetParent) break; obj = obj.offsetParent; } } else if(obj.y) { curtop += obj.y; } return curtop;
}