
var host='http://www.mtgaddict.net';var mtga_popup_cache=new Array();var mtga_popup_timeouts=new Array();var mtga_ajax=null;var mtga_init=false;var _link=document.createElement("script");_link.type="text/javascript";_link.src=host+"/js/overlib_comp.js";var head=document.getElementsByTagName('head')[0];head.appendChild(_link);function fetch_object(idname){if(document.getElementById){return document.getElementById(idname);}else if(document.all){return document.all[idname];}else if(document.layers){return document.layers[idname];}else{return null;}}
function toggle_display(idname){var obj=fetch_object(idname);if(obj){if(obj.style.display=="none"){obj.style.display="";}else{obj.style.display="none";}}
return false;}
function mtga_cardpopup(name){if(!mtga_init){var _link=document.createElement("link");_link.rel="stylesheet";_link.type="text/css";_link.href=host+"/style/mtgalib.css";var head=document.getElementsByTagName('head')[0];head.appendChild(_link);mtga_init=true;}
if(mtga_popup_cache[name]){var item=mtga_popup_cache[name];var obj=fetch_object('overDiv');if(obj){nd();overlib(item,VAUTO,HAUTO,FULLHTML,STICKY);}
return true;}else{crossdomain_request(name);return false;}}
function createRequestObject(){var http;if(window.XMLHttpRequest){http=new XMLHttpRequest();}else if(window.ActiveXObject){http=new ActiveXObject("Microsoft.XMLHTTP");}
return http;}
function crossdomain_request(name){var s=document.createElement("script");s.type="text/javascript";s.src=host+'/ws/card?name='+name+'&html&callback=mtga_callback';document.body.appendChild(s);}
function mtga_callback(json){mtga_popup_cache[json.name]=json.responseText;var obj=fetch_object('overDiv');if(obj){nd();overlib(mtga_popup_cache[json.name],VAUTO,HAUTO,FULLHTML,STICKY);}}
function _nd(){var obj=fetch_object('overDiv');obj.parentNode.removeChild(obj);}
function mtga_show_popup(name,delay){var timeout=window.setTimeout('overlib(\'<img src=\\\''+host+'/images/lc.gif\\\' alt=\\\'Chargement...\\\' />\', HAUTO, VAUTO, FULLHTML, STICKY);mtga_cardpopup(\''+name.replace(/\'/g,"\\'")+'\');',delay);mtga_popup_timeouts[name]=timeout;}
function mtga_hide_popup(name){if(mtga_popup_timeouts[name]){window.clearTimeout(mtga_popup_timeouts[name]);_nd();}else{_nd();}}
function MTGACardPopup(){this.show=mtga_show_popup;this.hide=mtga_hide_popup;}
function addslashes(str){str=str.replace(/\'/g,'\\\'');str=str.replace(/\"/g,'\\"');str=str.replace(/\\/g,'\\\\');str=str.replace(/\0/g,'\\0');return str;}
function stripslashes(str){str=str.replace(/\\'/g,'\'');str=str.replace(/\\"/g,'"');str=str.replace(/\\\\/g,'\\');str=str.replace(/\\0/g,'\0');return str;}

