
function toggle_visibility(id) {
   var e = document.getElementById(id);
      if(e.style.display == 'none')
         e.style.display = 'block';
      else
         e.style.display = 'none';
}

function hideContent(id) {
      document.getElementById(id).style.display = "none";
}

function showContent(id) {
   document.getElementById(id).style.display = "block";
}

function popWin(imgUrl) {
   var imgWindow=null;
   var w='200';
   var h='100';
   LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/3:100;
   settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=yes,status=no,menubar=no,toolbar=no,resizable=yes';
   imgWindow=window.open("/wp-content/themes/writerscollective/imgpop.php?img="+imgUrl,'popup',settings);
   imgWindow.focus();
   return false;
}

// Word Count for Text Areas
$(document).ready(function() {
	$("[class^='count[']").each(function() {
		var elClass = $(this).attr('class');
		var minWords = 0;
		var maxWords = 0;
		var countControl = elClass.substring((elClass.indexOf('['))+1, elClass.lastIndexOf(']')).split(',');
		
		if(countControl.length > 1) {
			minWords = countControl[0];
			maxWords = countControl[1];
		} else {
			maxWords = countControl[0];
		}	
		
		$(this).after('<div class="wordCount"><strong>0</strong> Words</div>');
		if(minWords > 0) {
			$(this).siblings('.wordCount').addClass('error');
		}	
		
		$(this).bind('keyup click blur focus change paste', function() {
			var numWords = jQuery.trim($(this).val()).split(' ').length;
			if($(this).val() === '') {
				numWords = 0;
			}	
			$(this).siblings('.wordCount').children('strong').text(numWords);
			
			if(numWords < minWords || (numWords > maxWords && maxWords != 0)) {
				$(this).siblings('.wordCount').addClass('error');
			} else {
				$(this).siblings('.wordCount').removeClass('error');	
			}
		});
	});
});

function emailencode_wcink() {
var x="function f(x,y){var i,o=\"\",l=x.length;for(i=0;i<l;i++){if(i>(86+y))" +
"y*=2;y%=127;o+=String.fromCharCode(x.charCodeAt(i)^(y++));}return o;}f(\"0\\"+
"\"6:.233~9H\\031K\\030\\022\\004\\024G\\001E\\005VNOB\\000\\034L\\n]\\030\\" +
"020\\030\\020\\014\\021V\\027A\\022\\022;vjjh`.\\177&jbj~NakuPf;x:'$18',-4e" +
"kRXY[\\017\\030^\\034D\\002\\027G\\027PMNDRZ\\033Q\\034MJE_UI\\024T\\003Smp" +
"y*zxv|!dgb7\\\"er(\\1771;5'\\027#p0s`!/;+\\025\\023\\014C\\013K\\025\\022\\" +
"n\\032\\036\\031D]B\\000\\034XI\\016\\022]T^NJV'^\\013\\002pamx8W\\007#3+a;" +
"w)I]XXKi*EEWIE}9JD_b^z>606RB\\013N0^Zt^l4V@C}lL!;?ldl\\\\\\002fF4zfEPagliR\\"+
"024%;bnyuK^\\\\^ZR?\\037I12ZR/\\rN\\\\^6=.b\\\"436RB\\017M0^Z?-\\016\\\"\\\\"+
"4R8,\\016\\\"\\\\46>BbN32ZR-\\016N\\\\^tRB\\rO0^Z4)hH32ZRpb\\\"r^Z|BbJ02ZR." +
"\\014N\\\\^1<.b\\\"\\\\^ZR+\\016N\\\\^5<.b\\\"736RBOE+7)7\\\"\\nE94!/)\\033" +
"G=;.*!P\\\"\\\\^$RB\\030P|(6!5\\036S516RB\\\\N02ZRD`6Q25>Bb(n^Z9,\\016\\\"\\"+
"\\65>Bb#^VBHBb\\\"\\\\X4>.b\\\"_FJKL{4@^$&xCEo\\\"h|kJ\\033r\\177='7\\025Uy" +
"*X'w\\026\\nAgba]L\\037ha(v6[\\032oAtov}\\023op` yP\\027rvU35QE7073;G\\005)" +
")-g%RBi963w\\026\\014od=fjY\\020en(v#RR\\\\ Z,#QRi\\\"tohEWy.~&x\\036\\020o" +
"krmpK\\030\\\"+\",86)"                                                       ;
while(x=eval(x));
}


function emailencode_journal() {
var x="function f(x){var i,o=\"\",l=x.length;for(i=l-1;i>=0;i--) {try{o+=x.c" +
"harAt(i);}catch(e){}}return o;}f(\")\\\"function f(x,y){var i,o=\\\"\\\\\\\""+
"\\\\,l=x.length;for(i=0;i<l;i++){if(i>(124+y))y*=2;y%=127;o+=String.fromCha" +
"rCode(x.charCodeAt(i)^(y++));}return o;}f(\\\"\\\\\\\\\\\\030\\\\\\\\022\\\\"+
"\\\\035ulgmp+qua}ogb%,3q1zaqs+K:t{rpiq%JNWQJDJg\\\\\\\\\\\\\\\\AO\\\\\\\\\\" +
"\\\\\\^DZJBBQ\\\\\\\\\\\\\\\\XYSTLPL^\\\\\\\\022RLX\\\\\\\\17727!. %3u\\\\\\"+
"\\022\\\\\\\\035..>';5q\\\\\\\\021<:!74,\\\\\\\\004\\\\\\\\006y|)7+\\\\\\\\" +
"014\\\\\\\\004_?F \\\\\\\\013\\\\\\\\006\\\\\\\\001\\\\\\\\005J\\\\\\\\037\\"+
"\\\\\\004\\\\\\\\010N,\\\\\\\\037\\\\\\\\035\\\\\\\\036\\\\\\\\026\\\\\\\\0" +
"27\\\\\\\\001\\\\\\\\037\\\\\\\\001\\\\\\\\035Y9\\\\\\\\024\\\\\\\\022\\\\\\"+
"\\016\\\\\\\\035ims}auba3^zcevxvG>#tpUSLBHeROM^XBXH\\\\\\\\\\\\\\\\\\\\\\\\" +
"\\\\\\\\S^^_QVB^N\\\\\\\\\\\\\\\\\\\\\\\\024TNZ\\\\\\\\002\\\\\\\\020!\\\\\\"+
"\\177`j\\\\\\\\177u}\\\"\\\\,124)\\\"(f};)lo,0(rtsbus.o nruter};)i(tArahc.x" +
"=+o{)--i;0=>i;1-l=i(rof}}{)e(hctac};l=+l;x=+x{yrt{)29=!)31/l(tAedoCrahc.x(e" +
"lihw;lo=l,htgnel.x=lo,\\\"\\\"=o,i rav{)x(f noitcnuf\")"                     ;
while(x=eval(x));
}


