var images = new Array();
var first = 0;
var last = 0;
var current = 1;
var curentOfAll = '';
var mypreloadImage=new Image();
function checkForm(form)
{
    // validation fails if the input is blank
    //  var itemsChecked = checkArray(form, "data[]");
    if(form.name.value == '') { alert("Error: Name is empty."); return false; }
    if(form.comment.value == '') { alert("Error: Comment is empty."); return false; }
    return true;
}
function trimAll(sString)
{
    while (sString.substring(0,1) == ' ')
    {
        sString = sString.substring(1, sString.length);
    }
    while (sString.substring(sString.length-1, sString.length) == ' ')
    {
        sString = sString.substring(0,sString.length-1);
    }
    return sString;
}

function searchText( search_text, element_id ){    
    search_text = trimAll(search_text);
    
    if( search_text == '' ){
        document.getElementById(element_id).disabled = true;    
    }
    else {
        document.getElementById(element_id).disabled = false;
    }
}
  
function showtab(active, passive, activeLink, passiveLink,active_class,passive_class) {
	document.getElementById(active).style.display='';
	document.getElementById(passive).style.display='none';
	
	document.getElementById(activeLink).className=active_class; 
	document.getElementById(passiveLink).className=passive_class; 
	return false;
	
	/*//lets hide everything
	document.getElementById('tab1').style.display='none';
	document.getElementById('tab2').style.display='none';
	document.getElementById('tab3').style.display='none';
	document.getElementById('tab4').style.display='none';
	document.getElementById('t'+'t1').className=''; 
	document.getElementById('t'+'t2').className=''; 
	document.getElementById('t'+'t3').className=''; 
	document.getElementById('t'+'t4').className=''; 
	//lets show active
	document.getElementById(ative).style.display=''; 
	document.getElementById('t'+ative).className='active'; 
	return false;*/
}

function resize(img, name) { 
img.width = getImgWidth(img.src)
if(img.width > 211) { 
  //img.style.height = parseInt(img.height - (img.width - 211 ) * (img.width / img.height)) + "px"; 
  //img.style.width = "211px"; 
  //document.images['show'].width = parseInt(img.height - (img.width - 211 ) * (img.width / img.height)); 
  document.images[name].width = 211;
} 
img.height = getImgHeight(img.src)
if(img.height > 160) { 
  //img.style.height = parseInt(img.height - (img.width - 211 ) * (img.width / img.height)) + "px"; 
  //img.style.width = "211px"; 
  document.images[name].height = 160;
  //document.images['show'].width = parseInt(img.width - (img.height - 160 ) * (img.height / img.width)); ;
}
img.style.position = "static"; 
img.style.visibility = "visible"; 
}

function getImgHeight(imgSrc){
	var newImg = new Image();
	newImg.src = imgSrc;
	var height = newImg.height;
	return height;
}
function getImgWidth(imgSrc){
	var newImg = new Image();
	newImg.src = imgSrc;
	var width = newImg.width;
	return width;
}

var pic = null
var popImg = null  // use this when referring to pop-up image
var picTitle = null
var imgCount = 0
var imgWinName = "popImg"

function openPopImg(picName, windowTitle, windowWidth, windowHeight){
  closePopImg()
  picTitle = windowTitle;
  imgWinName = "popImg" + imgCount++ //unique name for each pop-up window
  popImg = window.open(picName, "",
           "toolbar=no,scrollbars=no,resizable=no,width=" 
           + (parseInt(windowWidth)+30)  + ",height=" 
           + (parseInt(windowHeight)+20)) ;
	   
  	if(windowWidth ==0)
		popImg.resizeBy(700, 500);
	popImg.document.write('<html><head><title>'+windowTitle+'</title> <SCRIPT language="JavaScript"> pic1= new Image();  pic1.src="'+picName+'"; </SCRIPT> </head><body>') ;	
	popImg.document.write('<a href="http://www.pcthreat.com/download-spyhunter.html"><img style="border:0 px;" src="'+picName+'" alt="" /></a>') ;
	popImg.document.write('</body></html>') ;	
  }
function closePopImg(){    // close pop-up window if it is open 
  if (navigator.appName != "Microsoft Internet Explorer" 
      || parseInt(navigator.appVersion) >=4) //do not close if early IE
    if(popImg != null) if(!popImg.closed) popImg.close() 
  }
function setStatus(msg){
  status = msg;
  return true;
}


function getArray(img_array, first1, last1){
  first = first1;
  images = img_array;
  last = last1;
  current=1;
  if(last>1)
	setCurentOfAll();
}
function nextImg(img_name, dir, fullPath){
  if(current < last){
    current++;
    setCurentOfAll();
    document[img_name].src = dir + images[current-1];
    document['prev'].src = fullPath + 'left.gif';
  }
  if(current >= last){
    document['next'].src = fullPath + 'right_empty.gif';
  }
  
} 
function prevImg(img_name, dir, fullPath){
  if(current > first+1){
    current--;
    setCurentOfAll();
    document[img_name].src = dir + images[current-1];
    document['next'].src = fullPath + 'right.gif';
  }
  if(current <= first+1){
    document['prev'].src = fullPath + 'left_empty.gif';
  }
  
}
function setCurentOfAll(){
  curentOfAll = (current) + ' of '+ last+' ';
  document.getElementById('blabla').innerHTML = curentOfAll;
}


if(typeof YAHOO=="undefined"){var YAHOO={}}
YAHOO.namespace=function(){var a=arguments,b=null,d,e,c;for(d=0;d<a.length;d=d+1){c=a[d].split(".");b=YAHOO;for(e=(c[0]=="YAHOO")?1:0;e<c.length;e=e+1){b[c[e]]=b[c[e]]||{};b=b[c[e]]}}return b};YAHOO.log=function(b,a,c){var d=YAHOO.widget.Logger;if(d&&d.log){return d.log(b,a,c)}else{return false}};YAHOO.register=function(d,i,a){var e=YAHOO.env.modules;if(!e[d]){e[d]={versions:[],builds:[]}}var c=e[d],f=a.version,g=a.build,h=YAHOO.env.listeners;c.name=d;c.version=f;c.build=g;c.versions.push(f);c.builds.push(g);c.mainClass=i;for(var b=0;b<h.length;b=b+1){h[b](c)}if(i){i.VERSION=f;i.BUILD=g}else{YAHOO.log("mainClass is undefined for module "+d,"warn")}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(a){return YAHOO.env.modules[a]||null};YAHOO.env.ua=function(){var b={ie:0,opera:0,gecko:0,webkit:0};var c=navigator.userAgent,a;if((/KHTML/).test(c)){b.webkit=1}a=c.match(/AppleWebKit\/([^\s]*)/);if(a&&a[1]){b.webkit=parseFloat(a[1])}if(!b.webkit){a=c.match(/Opera[\s\/]([^\s]*)/);if(a&&a[1]){b.opera=parseFloat(a[1])}else{a=c.match(/MSIE\s([^;]*)/);if(a&&a[1]){b.ie=parseFloat(a[1])}else{a=c.match(/Gecko\/([^\s]*)/);if(a){b.gecko=1;a=c.match(/rv:([^\s\)]*)/);if(a&&a[1]){b.gecko=parseFloat(a[1])}}}}}return b}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var d=YAHOO_config.listener,a=YAHOO.env.listeners,b=true,c;if(d){for(c=0;c<a.length;c=c+1){if(a[c]==d){b=false;break}}if(b){a.push(d)}}}})();YAHOO.lang={isArray:function(b){if(b){var a=YAHOO.lang;return a.isNumber(b.length)&&a.isFunction(b.splice)&&!a.hasOwnProperty(b.length)}return false},isBoolean:function(a){return typeof a==="boolean"},isFunction:function(a){return typeof a==="function"},isNull:function(a){return a===null},isNumber:function(a){return typeof a==="number"&&isFinite(a)},isObject:function(a){return(a&&(typeof a==="object"||YAHOO.lang.isFunction(a)))||false},isString:function(a){return typeof a==="string"},isUndefined:function(a){return typeof a==="undefined"},hasOwnProperty:function(a,b){if(Object.prototype.hasOwnProperty){return a.hasOwnProperty(b)}return !YAHOO.lang.isUndefined(a[b])&&a.constructor.prototype[b]!==a[b]},_IEEnumFix:function(e,f){if(YAHOO.env.ua.ie){var c=["toString","valueOf"],a;for(a=0;a<c.length;a=a+1){var b=c[a],d=f[b];if(YAHOO.lang.isFunction(d)&&d!=Object.prototype[b]){e[b]=d}}}},extend:function(c,b,d){if(!b||!c){throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.")}var e=function(){};e.prototype=b.prototype;c.prototype=new e();c.prototype.constructor=c;c.superclass=b.prototype;if(b.prototype.constructor==Object.prototype.constructor){b.prototype.constructor=b}if(d){for(var a in d){c.prototype[a]=d[a]}YAHOO.lang._IEEnumFix(c.prototype,d)}},augmentObject:function(c,d){if(!d||!c){throw new Error("Absorb failed, verify dependencies.")}var a=arguments,e,b,f=a[2];if(f&&f!==true){for(e=2;e<a.length;e=e+1){c[a[e]]=d[a[e]]}}else{for(b in d){if(f||!c[b]){c[b]=d[b]}}YAHOO.lang._IEEnumFix(c,d)}},augmentProto:function(b,c){if(!c||!b){throw new Error("Augment failed, verify dependencies.")}var a=[b.prototype,c.prototype];for(var d=2;d<arguments.length;d=d+1){a.push(arguments[d])}YAHOO.lang.augmentObject.apply(this,a)},dump:function(d,h){var b=YAHOO.lang,a,i,f=[],e="{...}",c="f(){...}",g=", ",j=" => ";if(!b.isObject(d)){return d+""}else{if(d instanceof Date||("nodeType" in d&&"tagName" in d)){return d}else{if(b.isFunction(d)){return c}}}h=(b.isNumber(h))?h:3;if(b.isArray(d)){f.push("[");for(a=0,i=d.length;a<i;a=a+1){if(b.isObject(d[a])){f.push((h>0)?b.dump(d[a],h-1):e)}else{f.push(d[a])}f.push(g)}if(f.length>1){f.pop()}f.push("]")}else{f.push("{");for(a in d){if(b.hasOwnProperty(d,a)){f.push(a+j);if(b.isObject(d[a])){f.push((h>0)?b.dump(d[a],h-1):e)}else{f.push(d[a])}f.push(g)}}if(f.length>1){f.pop()}f.push("}")}return f.join("")},substitute:function(e,c,l){var o,p,q,i,h,f,a=YAHOO.lang,j=[],b,n="dump",k=" ",d="{",g="}";for(;;){o=e.lastIndexOf(d);if(o<0){break}p=e.indexOf(g,o);if(o+1>=p){break}b=e.substring(o+1,p);i=b;f=null;q=i.indexOf(k);if(q>-1){f=i.substring(q+1);i=i.substring(0,q)}h=c[i];if(l){h=l(i,h,f)}if(a.isObject(h)){if(a.isArray(h)){h=a.dump(h,parseInt(f,10))}else{f=f||"";var m=f.indexOf(n);if(m>-1){f=f.substring(4)}if(h.toString===Object.prototype.toString||m>-1){h=a.dump(h,parseInt(f,10))}else{h=h.toString()}}}else{if(!a.isString(h)&&!a.isNumber(h)){h="~-"+j.length+"-~";j[j.length]=b}}e=e.substring(0,o)+h+e.substring(p+1)}for(o=j.length-1;o>=0;o=o-1){e=e.replace(new RegExp("~-"+o+"-~"),"{"+j[o]+"}","g")}return e},trim:function(a){try{return a.replace(/^\s+|\s+$/g,"")}catch(b){return a}},merge:function(){var b={},a=arguments,c;for(c=0;c<a.length;c=c+1){YAHOO.lang.augmentObject(b,a[c],true)}return b},isValue:function(b){var a=YAHOO.lang;return(a.isObject(b)||a.isString(b)||a.isNumber(b)||a.isBoolean(b))}};YAHOO.util.Lang=YAHOO.lang;YAHOO.lang.augment=YAHOO.lang.augmentProto;YAHOO.augment=YAHOO.lang.augmentProto;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.3.1",build:"541"});(function(){var c=YAHOO.util,h,j,k=0,i={},m={};var b=YAHOO.env.ua.opera,g=YAHOO.env.ua.webkit,d=YAHOO.env.ua.gecko,l=YAHOO.env.ua.ie;var n={HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i};var f=function(p){if(!n.HYPHEN.test(p)){return p}if(i[p]){return i[p]}var o=p;while(n.HYPHEN.exec(o)){o=o.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase())}i[p]=o;return o};var e=function(o){var p=m[o];if(!p){p=new RegExp("(?:^|\\s+)"+o+"(?:\\s+|$)");m[o]=p}return p};if(document.defaultView&&document.defaultView.getComputedStyle){h=function(r,o){var p=null;if(o=="float"){o="cssFloat"}var q=document.defaultView.getComputedStyle(r,"");if(q){p=q[f(o)]}return r.style[o]||p}}else{if(document.documentElement.currentStyle&&l){h=function(s,q){switch(f(q)){case"opacity":var o=100;try{o=s.filters["DXImageTransform.Microsoft.Alpha"].opacity}catch(p){try{o=s.filters("alpha").opacity}catch(p){}}return o/100;case"float":q="styleFloat";default:var r=s.currentStyle?s.currentStyle[q]:null;return(s.style[q]||r)}}}else{h=function(p,o){return p.style[o]}}}if(l){j=function(q,p,o){switch(p){case"opacity":if(YAHOO.lang.isString(q.style.filter)){q.style.filter="alpha(opacity="+o*100+")";if(!q.currentStyle||!q.currentStyle.hasLayout){q.style.zoom=1}}break;case"float":p="styleFloat";default:q.style[p]=o}}}else{j=function(q,p,o){if(p=="float"){p="cssFloat"}q.style[p]=o}}var a=function(p,o){return p&&p.nodeType==1&&(!o||o(p))};YAHOO.util.Dom={get:function(p){if(p&&(p.tagName||p.item)){return p}if(YAHOO.lang.isString(p)||!p){return document.getElementById(p)}if(p.length!==undefined){var o=[];for(var q=0,r=p.length;q<r;++q){o[o.length]=c.Dom.get(p[q])}return o}return p},getStyle:function(q,o){o=f(o);var p=function(r){return h(r,o)};return c.Dom.batch(q,p,c.Dom,true)},setStyle:function(r,p,o){p=f(p);var q=function(s){j(s,p,o)};c.Dom.batch(r,q,c.Dom,true)},getXY:function(p){var o=function(u){if((u.parentNode===null||u.offsetParent===null||this.getStyle(u,"display")=="none")&&u!=document.body){return false}var v=null;var q=[];var t;var s=u.ownerDocument;if(u.getBoundingClientRect){t=u.getBoundingClientRect();return[t.left+c.Dom.getDocumentScrollLeft(u.ownerDocument),t.top+c.Dom.getDocumentScrollTop(u.ownerDocument)]}else{q=[u.offsetLeft,u.offsetTop];v=u.offsetParent;var r=this.getStyle(u,"position")=="absolute";if(v!=u){while(v){q[0]+=v.offsetLeft;q[1]+=v.offsetTop;if(g&&!r&&this.getStyle(v,"position")=="absolute"){r=true}v=v.offsetParent}}if(g&&r){q[0]-=u.ownerDocument.body.offsetLeft;q[1]-=u.ownerDocument.body.offsetTop}}v=u.parentNode;while(v.tagName&&!n.ROOT_TAG.test(v.tagName)){if(c.Dom.getStyle(v,"display").search(/^inline|table-row.*$/i)){q[0]-=v.scrollLeft;q[1]-=v.scrollTop}v=v.parentNode}return q};return c.Dom.batch(p,o,c.Dom,true)},getX:function(p){var o=function(q){return c.Dom.getXY(q)[0]};return c.Dom.batch(p,o,c.Dom,true)},getY:function(p){var o=function(q){return c.Dom.getXY(q)[1]};return c.Dom.batch(p,o,c.Dom,true)},setXY:function(r,o,p){var q=function(u){var v=this.getStyle(u,"position");if(v=="static"){this.setStyle(u,"position","relative");v="relative"}var s=this.getXY(u);if(s===false){return false}var t=[parseInt(this.getStyle(u,"left"),10),parseInt(this.getStyle(u,"top"),10)];if(isNaN(t[0])){t[0]=(v=="relative")?0:u.offsetLeft}if(isNaN(t[1])){t[1]=(v=="relative")?0:u.offsetTop}if(o[0]!==null){u.style.left=o[0]-s[0]+t[0]+"px"}if(o[1]!==null){u.style.top=o[1]-s[1]+t[1]+"px"}if(!p){var w=this.getXY(u);if((o[0]!==null&&w[0]!=o[0])||(o[1]!==null&&w[1]!=o[1])){this.setXY(u,o,true)}}};c.Dom.batch(r,q,c.Dom,true)},setX:function(o,p){c.Dom.setXY(o,[p,null])},setY:function(p,o){c.Dom.setXY(p,[null,o])},getRegion:function(p){var o=function(r){if((r.parentNode===null||r.offsetParent===null||this.getStyle(r,"display")=="none")&&r!=document.body){return false}var q=c.Region.getRegion(r);return q};return c.Dom.batch(p,o,c.Dom,true)},getClientWidth:function(){return c.Dom.getViewportWidth()},getClientHeight:function(){return c.Dom.getViewportHeight()},getElementsByClassName:function(s,o,r,q){o=o||"*";r=(r)?c.Dom.get(r):null||document;if(!r){return[]}var v=[],w=r.getElementsByTagName(o),p=e(s);for(var u=0,t=w.length;u<t;++u){if(p.test(w[u].className)){v[v.length]=w[u];if(q){q.call(w[u],w[u])}}}return v},hasClass:function(p,q){var r=e(q);var o=function(s){return r.test(s.className)};return c.Dom.batch(p,o,c.Dom,true)},addClass:function(p,q){var o=function(r){if(this.hasClass(r,q)){return false}r.className=YAHOO.lang.trim([r.className,q].join(" "));return true};return c.Dom.batch(p,o,c.Dom,true)},removeClass:function(p,q){var r=e(q);var o=function(t){if(!this.hasClass(t,q)){return false}var s=t.className;t.className=s.replace(r," ");if(this.hasClass(t,q)){this.removeClass(t,q)}t.className=YAHOO.lang.trim(t.className);return true};return c.Dom.batch(p,o,c.Dom,true)},replaceClass:function(p,r,s){if(!s||r===s){return false}var q=e(r);var o=function(t){if(!this.hasClass(t,r)){this.addClass(t,s);return true}t.className=t.className.replace(q," "+s+" ");if(this.hasClass(t,r)){this.replaceClass(t,r,s)}t.className=YAHOO.lang.trim(t.className);return true};return c.Dom.batch(p,o,c.Dom,true)},generateId:function(q,o){o=o||"yui-gen";var p=function(s){if(s&&s.id){return s.id}var r=o+k++;if(s){s.id=r}return r};return c.Dom.batch(q,p,c.Dom,true)||p.apply(c.Dom,arguments)},isAncestor:function(p,o){p=c.Dom.get(p);if(!p||!o){return false}var q=function(r){if(p.contains&&r.nodeType&&!g){return p.contains(r)}else{if(p.compareDocumentPosition&&r.nodeType){return !!(p.compareDocumentPosition(r)&16)}else{if(r.nodeType){return !!this.getAncestorBy(r,function(s){return s==p})}}}return false};return c.Dom.batch(o,q,c.Dom,true)},inDocument:function(p){var o=function(q){if(g){while(q=q.parentNode){if(q==document.documentElement){return true}}return false}return this.isAncestor(document.documentElement,q)};return c.Dom.batch(p,o,c.Dom,true)},getElementsBy:function(o,u,t,r){u=u||"*";t=(t)?c.Dom.get(t):null||document;if(!t){return[]}var s=[],p=t.getElementsByTagName(u);for(var q=0,v=p.length;q<v;++q){if(o(p[q])){s[s.length]=p[q];if(r){r(p[q])}}}return s},batch:function(r,o,p,t){r=(r&&(r.tagName||r.item))?r:c.Dom.get(r);if(!r||!o){return false}var s=(t)?p:window;if(r.tagName||r.length===undefined){return o.call(s,r,p)}var q=[];for(var u=0,v=r.length;u<v;++u){q[q.length]=o.call(s,r[u],p)}return q},getDocumentHeight:function(){var o=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;var p=Math.max(o,c.Dom.getViewportHeight());return p},getDocumentWidth:function(){var o=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;var p=Math.max(o,c.Dom.getViewportWidth());return p},getViewportHeight:function(){var p=self.innerHeight;var o=document.compatMode;if((o||l)&&!b){p=(o=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight}return p},getViewportWidth:function(){var p=self.innerWidth;var o=document.compatMode;if(o||l){p=(o=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth}return p},getAncestorBy:function(p,o){while(p=p.parentNode){if(a(p,o)){return p}}return null},getAncestorByClassName:function(p,q){p=c.Dom.get(p);if(!p){return null}var o=function(r){return c.Dom.hasClass(r,q)};return c.Dom.getAncestorBy(p,o)},getAncestorByTagName:function(p,q){p=c.Dom.get(p);if(!p){return null}var o=function(r){return r.tagName&&r.tagName.toUpperCase()==q.toUpperCase()};return c.Dom.getAncestorBy(p,o)},getPreviousSiblingBy:function(p,o){while(p){p=p.previousSibling;if(a(p,o)){return p}}return null},getPreviousSibling:function(o){o=c.Dom.get(o);if(!o){return null}return c.Dom.getPreviousSiblingBy(o)},getNextSiblingBy:function(p,o){while(p){p=p.nextSibling;if(a(p,o)){return p}}return null},getNextSibling:function(o){o=c.Dom.get(o);if(!o){return null}return c.Dom.getNextSiblingBy(o)},getFirstChildBy:function(q,o){var p=(a(q.firstChild,o))?q.firstChild:null;return p||c.Dom.getNextSiblingBy(q.firstChild,o)},getFirstChild:function(p,o){p=c.Dom.get(p);if(!p){return null}return c.Dom.getFirstChildBy(p)},getLastChildBy:function(q,o){if(!q){return null}var p=(a(q.lastChild,o))?q.lastChild:null;return p||c.Dom.getPreviousSiblingBy(q.lastChild,o)},getLastChild:function(o){o=c.Dom.get(o);return c.Dom.getLastChildBy(o)},getChildrenBy:function(q,o){var p=c.Dom.getFirstChildBy(q,o);var r=p?[p]:[];c.Dom.getNextSiblingBy(p,function(s){if(!o||o(s)){r[r.length]=s}return false});return r},getChildren:function(o){o=c.Dom.get(o);if(!o){}return c.Dom.getChildrenBy(o)},getDocumentScrollLeft:function(o){o=o||document;return Math.max(o.documentElement.scrollLeft,o.body.scrollLeft)},getDocumentScrollTop:function(o){o=o||document;return Math.max(o.documentElement.scrollTop,o.body.scrollTop)},insertBefore:function(o,p){o=c.Dom.get(o);p=c.Dom.get(p);if(!o||!p||!p.parentNode){return null}return p.parentNode.insertBefore(o,p)},insertAfter:function(o,p){o=c.Dom.get(o);p=c.Dom.get(p);if(!o||!p||!p.parentNode){return null}if(p.nextSibling){return p.parentNode.insertBefore(o,p.nextSibling)}else{return p.parentNode.appendChild(o)}}}})();YAHOO.util.Region=function(c,b,a,d){this.top=c;this[1]=c;this.right=b;this.bottom=a;this.left=d;this[0]=d};YAHOO.util.Region.prototype.contains=function(a){return(a.left>=this.left&&a.right<=this.right&&a.top>=this.top&&a.bottom<=this.bottom)};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left))};YAHOO.util.Region.prototype.intersect=function(b){var d=Math.max(this.top,b.top);var c=Math.min(this.right,b.right);var a=Math.min(this.bottom,b.bottom);var e=Math.max(this.left,b.left);if(a>=d&&c>=e){return new YAHOO.util.Region(d,c,a,e)}else{return null}};YAHOO.util.Region.prototype.union=function(b){var d=Math.min(this.top,b.top);var c=Math.max(this.right,b.right);var a=Math.max(this.bottom,b.bottom);var e=Math.min(this.left,b.left);return new YAHOO.util.Region(d,c,a,e)};YAHOO.util.Region.prototype.toString=function(){return("Region {top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}")};YAHOO.util.Region.getRegion=function(d){var b=YAHOO.util.Dom.getXY(d);var e=b[1];var c=b[0]+d.offsetWidth;var a=b[1]+d.offsetHeight;var f=b[0];return new YAHOO.util.Region(e,c,a,f)};YAHOO.util.Point=function(a,b){if(YAHOO.lang.isArray(a)){b=a[1];a=a[0]}this.x=this.right=this.left=this[0]=a;this.y=this.top=this.bottom=this[1]=b};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.3.1",build:"541"});YAHOO.util.CustomEvent=function(c,e,d,a){this.type=c;this.scope=e||window;this.silent=d;this.signature=a||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var b="_YUICEOnSubscribe";if(c!==b){this.subscribeEvent=new YAHOO.util.CustomEvent(b,this,true)}this.lastError=null};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(c,b,a){if(!c){throw new Error("Invalid callback for subscriber to '"+this.type+"'")}if(this.subscribeEvent){this.subscribeEvent.fire(c,b,a)}this.subscribers.push(new YAHOO.util.Subscriber(c,b,a))},unsubscribe:function(d,b){if(!d){return this.unsubscribeAll()}var c=false;for(var f=0,a=this.subscribers.length;f<a;++f){var e=this.subscribers[f];if(e&&e.contains(d,b)){this._delete(f);c=true}}return c},fire:function(){var l=this.subscribers.length;if(!l&&this.silent){return true}var i=[],j=true,a,h=false;for(a=0;a<arguments.length;++a){i.push(arguments[a])}var d=i.length;if(!this.silent){}for(a=0;a<l;++a){var e=this.subscribers[a];if(!e){h=true}else{if(!this.silent){}var f=e.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var c=null;if(i.length>0){c=i[0]}try{j=e.fn.call(f,c,e.obj)}catch(k){this.lastError=k}}else{try{j=e.fn.call(f,this.type,i,e.obj)}catch(k){this.lastError=k}}if(false===j){if(!this.silent){}return false}}}if(h){var g=[],b=this.subscribers;for(a=0,l=b.length;a<l;a=a+1){g.push(b[a])}this.subscribers=g}return true},unsubscribeAll:function(){for(var b=0,a=this.subscribers.length;b<a;++b){this._delete(a-1-b)}this.subscribers=[];return b},_delete:function(a){var b=this.subscribers[a];if(b){delete b.fn;delete b.obj}this.subscribers[a]=null},toString:function(){return"CustomEvent: '"+this.type+"', scope: "+this.scope}};YAHOO.util.Subscriber=function(c,b,a){this.fn=c;this.obj=YAHOO.lang.isUndefined(b)?null:b;this.override=a};YAHOO.util.Subscriber.prototype.getScope=function(a){if(this.override){if(this.override===true){return this.obj}else{return this.override}}return a};YAHOO.util.Subscriber.prototype.contains=function(a,b){if(b){return(this.fn==a&&this.obj==b)}else{return(this.fn==a)}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }"};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var h=false;var f=false;var g=[];var e=[];var i=[];var k=[];var b=0;var j=[];var c=[];var d=0;var a={63232:38,63233:40,63234:37,63235:39};return{POLL_RETRYS:4000,POLL_INTERVAL:10,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,startInterval:function(){if(!this._interval){var l=this;var m=function(){l._tryPreloadAttach()};this._interval=setInterval(m,this.POLL_INTERVAL)}},onAvailable:function(n,l,m,o){j.push({id:n,fn:l,obj:m,override:o,checkReady:false});b=this.POLL_RETRYS;this.startInterval()},onDOMReady:function(l,m,n){if(f){setTimeout(function(){var o=window;if(n){if(n===true){o=m}else{o=n}}l.call(o,"DOMReady",[],m)},0)}else{this.DOMReadyEvent.subscribe(l,m,n)}},onContentReady:function(n,l,m,o){j.push({id:n,fn:l,obj:m,override:o,checkReady:true});b=this.POLL_RETRYS;this.startInterval()},addListener:function(x,z,o,t,y){if(!o||!o.call){return false}if(this._isValidCollection(x)){var n=true;for(var s=0,q=x.length;s<q;++s){n=this.on(x[s],z,o,t,y)&&n}return n}else{if(YAHOO.lang.isString(x)){var u=this.getEl(x);if(u){x=u}else{this.onAvailable(x,function(){YAHOO.util.Event.on(x,z,o,t,y)});return true}}}if(!x){return false}if("unload"==z&&t!==this){e[e.length]=[x,z,o,t,y];return true}var l=x;if(y){if(y===true){l=t}else{l=y}}var w=function(A){return o.call(l,YAHOO.util.Event.getEvent(A,x),t)};var m=[x,z,o,w,l,t,y];var r=g.length;g[r]=m;if(this.useLegacyEvent(x,z)){var v=this.getLegacyIndex(x,z);if(v==-1||x!=i[v][0]){v=i.length;c[x.id+z]=v;i[v]=[x,z,x["on"+z]];k[v]=[];x["on"+z]=function(A){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(A),v)}}k[v].push(m)}else{try{this._simpleAdd(x,z,w,false)}catch(p){this.lastError=p;this.removeListener(x,z,o);return false}}return true},fireLegacyEvent:function(q,s){var o=true,u,m,n,l,p;m=k[s];for(var t=0,r=m.length;t<r;++t){n=m[t];if(n&&n[this.WFN]){l=n[this.ADJ_SCOPE];p=n[this.WFN].call(l,q);o=(o&&p)}}u=i[s];if(u&&u[2]){u[2](q)}return o},getLegacyIndex:function(n,m){var l=this.generateId(n)+m;if(typeof c[l]=="undefined"){return -1}else{return c[l]}},useLegacyEvent:function(n,m){if(this.webkit&&("click"==m||"dblclick"==m)){var l=parseInt(this.webkit,10);if(!isNaN(l)&&l<418){return true}}return false},removeListener:function(v,w,n){var s,p,l;if(typeof v=="string"){v=this.getEl(v)}else{if(this._isValidCollection(v)){var m=true;for(s=0,p=v.length;s<p;++s){m=(this.removeListener(v[s],w,n)&&m)}return m}}if(!n||!n.call){return this.purgeElement(v,false,w)}if("unload"==w){for(s=0,p=e.length;s<p;s++){l=e[s];if(l&&l[0]==v&&l[1]==w&&l[2]==n){e[s]=null;return true}}return false}var r=null;var q=arguments[3];if("undefined"===typeof q){q=this._getCacheIndex(v,w,n)}if(q>=0){r=g[q]}if(!v||!r){return false}if(this.useLegacyEvent(v,w)){var t=this.getLegacyIndex(v,w);var u=k[t];if(u){for(s=0,p=u.length;s<p;++s){l=u[s];if(l&&l[this.EL]==v&&l[this.TYPE]==w&&l[this.FN]==n){u[s]=null;break}}}}else{try{this._simpleRemove(v,w,r[this.WFN],false)}catch(o){this.lastError=o;return false}}delete g[q][this.WFN];delete g[q][this.FN];g[q]=null;return true},getTarget:function(m,n){var l=m.target||m.srcElement;return this.resolveTextNode(l)},resolveTextNode:function(l){if(l&&3==l.nodeType){return l.parentNode}else{return l}},getPageX:function(m){var l=m.pageX;if(!l&&0!==l){l=m.clientX||0;if(this.isIE){l+=this._getScrollLeft()}}return l},getPageY:function(l){var m=l.pageY;if(!m&&0!==m){m=l.clientY||0;if(this.isIE){m+=this._getScrollTop()}}return m},getXY:function(l){return[this.getPageX(l),this.getPageY(l)]},getRelatedTarget:function(m){var l=m.relatedTarget;if(!l){if(m.type=="mouseout"){l=m.toElement}else{if(m.type=="mouseover"){l=m.fromElement}}}return this.resolveTextNode(l)},getTime:function(m){if(!m.time){var n=new Date().getTime();try{m.time=n}catch(l){this.lastError=l;return n}}return m.time},stopEvent:function(l){this.stopPropagation(l);this.preventDefault(l)},stopPropagation:function(l){if(l.stopPropagation){l.stopPropagation()}else{l.cancelBubble=true}},preventDefault:function(l){if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}},getEvent:function(n,p){var o=n||window.event;if(!o){var m=this.getEvent.caller;while(m){o=m.arguments[0];if(o&&Event==o.constructor){break}m=m.caller}}if(o&&this.isIE){try{var q=o.srcElement;if(q){var r=q.type}}catch(l){o.target=p}}return o},getCharCode:function(m){var l=m.keyCode||m.charCode||0;if(YAHOO.env.ua.webkit&&(l in a)){l=a[l]}return l},_getCacheIndex:function(n,m,o){for(var p=0,q=g.length;p<q;++p){var l=g[p];if(l&&l[this.FN]==o&&l[this.EL]==n&&l[this.TYPE]==m){return p}}return -1},generateId:function(l){var m=l.id;if(!m){m="yuievtautoid-"+d;++d;l.id=m}return m},_isValidCollection:function(m){try{return(typeof m!=="string"&&m.length&&!m.tagName&&!m.alert&&typeof m[0]!=="undefined")}catch(l){return false}},elCache:{},getEl:function(l){return(typeof l==="string")?document.getElementById(l):l},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(m){if(!h){h=true;var l=YAHOO.util.Event;l._ready();l._tryPreloadAttach()}},_ready:function(m){if(!f){f=true;var l=YAHOO.util.Event;l.DOMReadyEvent.fire();l._simpleRemove(document,"DOMContentLoaded",l._ready)}},_tryPreloadAttach:function(){if(this.locked){return false}if(this.isIE){if(!f){this.startInterval();return false}}this.locked=true;var n=!h;if(!n){n=(b>0)}var o=[];var m=function(t,s){var u=t;if(s.override){if(s.override===true){u=s.obj}else{u=s.override}}s.fn.call(u,s.obj)};var r,l,p,q;for(r=0,l=j.length;r<l;++r){p=j[r];if(p&&!p.checkReady){q=this.getEl(p.id);if(q){m(q,p);j[r]=null}else{o.push(p)}}}for(r=0,l=j.length;r<l;++r){p=j[r];if(p&&p.checkReady){q=this.getEl(p.id);if(q){if(h||q.nextSibling){m(q,p);j[r]=null}}else{o.push(p)}}}b=(o.length===0)?0:b-1;if(n){this.startInterval()}else{clearInterval(this._interval);this._interval=null}this.locked=false;return true},purgeElement:function(p,o,m){var n=this.getListeners(p,m),q,l;if(n){for(q=0,l=n.length;q<l;++q){var r=n[q];this.removeListener(p,r.type,r.fn,r.index)}}if(o&&p&&p.childNodes){for(q=0,l=p.childNodes.length;q<l;++q){this.purgeElement(p.childNodes[q],o,m)}}},getListeners:function(r,t){var o=[],s;if(!t){s=[g,e]}else{if(t=="unload"){s=[e]}else{s=[g]}}for(var p=0;p<s.length;p=p+1){var l=s[p];if(l&&l.length>0){for(var n=0,m=l.length;n<m;++n){var q=l[n];if(q&&q[this.EL]===r&&(!t||t===q[this.TYPE])){o.push({type:q[this.TYPE],fn:q[this.FN],obj:q[this.OBJ],adjust:q[this.OVERRIDE],scope:q[this.ADJ_SCOPE],index:n})}}}}return(o.length)?o:null},_unload:function(m){var n=YAHOO.util.Event,p,q,s,l,r;for(p=0,l=e.length;p<l;++p){s=e[p];if(s){var o=window;if(s[n.ADJ_SCOPE]){if(s[n.ADJ_SCOPE]===true){o=s[n.UNLOAD_OBJ]}else{o=s[n.ADJ_SCOPE]}}s[n.FN].call(o,n.getEvent(m,s[n.EL]),s[n.UNLOAD_OBJ]);e[p]=null;s=null;o=null}}e=null;if(g&&g.length>0){q=g.length;while(q){r=q-1;s=g[r];if(s){n.removeListener(s[n.EL],s[n.TYPE],s[n.FN],r)}q=q-1}s=null;n.clearCache()}for(p=0,l=i.length;p<l;++p){i[p][0]=null;i[p]=null}i=null;n._simpleRemove(window,"unload",n._unload)},_getScrollLeft:function(){return this._getScroll()[1]},_getScrollTop:function(){return this._getScroll()[0]},_getScroll:function(){var l=document.documentElement,m=document.body;if(l&&(l.scrollTop||l.scrollLeft)){return[l.scrollTop,l.scrollLeft]}else{if(m){return[m.scrollTop,m.scrollLeft]}else{return[0,0]}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(n,m,o,l){n.addEventListener(m,o,(l))}}else{if(window.attachEvent){return function(n,m,o,l){n.attachEvent("on"+m,o)}}else{return function(){}}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(n,m,o,l){n.removeEventListener(m,o,(l))}}else{if(window.detachEvent){return function(n,m,l){n.detachEvent("on"+m,l)}}else{return function(){}}}}()}}();(function(){var c=YAHOO.util.Event;c.on=c.addListener;if(c.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var e,b=document,a=b.body;if(("undefined"!==typeof YAHOO_config)&&YAHOO_config.injecting){e=document.createElement("script");var d=b.getElementsByTagName("head")[0]||a;d.insertBefore(e,d.firstChild)}else{b.write('<script id="_yui_eu_dr" defer="true" src="//:"><\/script>');e=document.getElementById("_yui_eu_dr")}if(e){e.onreadystatechange=function(){if("complete"===this.readyState){this.parentNode.removeChild(this);YAHOO.util.Event._ready()}}}else{}e=null}else{if(c.webkit){c._drwatch=setInterval(function(){var f=document.readyState;if("loaded"==f||"complete"==f){clearInterval(c._drwatch);c._drwatch=null;c._ready()}},c.POLL_INTERVAL)}else{c._simpleAdd(document,"DOMContentLoaded",c._ready)}}c._simpleAdd(window,"load",c._load);c._simpleAdd(window,"unload",c._unload);c._tryPreloadAttach()})()}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(a,e,b,c){this.__yui_events=this.__yui_events||{};var d=this.__yui_events[a];if(d){d.subscribe(e,b,c)}else{this.__yui_subscribers=this.__yui_subscribers||{};var f=this.__yui_subscribers;if(!f[a]){f[a]=[]}f[a].push({fn:e,obj:b,override:c})}},unsubscribe:function(f,d,b){this.__yui_events=this.__yui_events||{};var a=this.__yui_events;if(f){var c=a[f];if(c){return c.unsubscribe(d,b)}}else{var g=true;for(var e in a){if(YAHOO.lang.hasOwnProperty(a,e)){g=g&&a[e].unsubscribe(d,b)}}return g}return false},unsubscribeAll:function(a){return this.unsubscribe(a)},createEvent:function(g,a){this.__yui_events=this.__yui_events||{};var d=a||{};var e=this.__yui_events;if(e[g]){}else{var f=d.scope||this;var i=(d.silent);var c=new YAHOO.util.CustomEvent(g,f,i,YAHOO.util.CustomEvent.FLAT);e[g]=c;if(d.onSubscribeCallback){c.subscribeEvent.subscribe(d.onSubscribeCallback)}this.__yui_subscribers=this.__yui_subscribers||{};var h=this.__yui_subscribers[g];if(h){for(var b=0;b<h.length;++b){c.subscribe(h[b].fn,h[b].obj,h[b].override)}}}return e[g]},fireEvent:function(d,e,a,f){this.__yui_events=this.__yui_events||{};var b=this.__yui_events[d];if(!b){return null}var g=[];for(var c=1;c<arguments.length;++c){g.push(arguments[c])}return b.fire.apply(b,g)},hasEvent:function(a){if(this.__yui_events){if(this.__yui_events[a]){return true}}return false}};YAHOO.util.KeyListener=function(a,b,f,e){if(!a){}else{if(!b){}else{if(!f){}}}if(!e){e=YAHOO.util.KeyListener.KEYDOWN}var d=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof a=="string"){a=document.getElementById(a)}if(typeof f=="function"){d.subscribe(f)}else{d.subscribe(f.fn,f.scope,f.correctScope)}function c(g,h){if(!b.shift){b.shift=false}if(!b.alt){b.alt=false}if(!b.ctrl){b.ctrl=false}if(g.shiftKey==b.shift&&g.altKey==b.alt&&g.ctrlKey==b.ctrl){var j;var k;if(b.keys instanceof Array){for(var i=0;i<b.keys.length;i++){j=b.keys[i];if(j==g.charCode){d.fire(g.charCode,g);break}else{if(j==g.keyCode){d.fire(g.keyCode,g);break}}}}else{j=b.keys;if(j==g.charCode){d.fire(g.charCode,g)}else{if(j==g.keyCode){d.fire(g.keyCode,g)}}}}}this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(a,e,c);this.enabledEvent.fire(b)}this.enabled=true};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(a,e,c);this.disabledEvent.fire(b)}this.enabled=false};this.toString=function(){return"KeyListener ["+b.keys+"] "+a.tagName+(a.id?"["+a.id+"]":"")}};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.register("event",YAHOO.util.Event,{version:"2.3.1",build:"541"});YAHOO.register("yahoo-dom-event",YAHOO,{version:"2.3.1",build:"541"});
if(typeof PCTHREAT=="undefined"){var PCTHREAT={}}
PCTHREAT.namespace=function(){var b=arguments,g=null,e,c,f;for(e=0;e<b.length;++e){f=b[e].split(".");g=PCTHREAT;for(c=(f[0]=="PCTHREAT")?1:0;c<f.length;++c){g[f[c]]=g[f[c]]||{};g=g[f[c]]}}return g};PCTHREAT.__log_enabled=null;PCTHREAT.log=function(d,a,c){var b=YAHOO.lang;if(PCTHREAT.__log_enabled===null){PCTHREAT.__log_enabled=(location.host.indexOf(".test")>-1||document.cookie.indexOf("debug")>-1||location.search.indexOf("debug")>-1);if(!PCTHREAT.__log_enabled){return}PCTHREAT.__log_type=null;if(YAHOO.widget.Logger&&YAHOO.widget.Logger.log){PCTHREAT.__log_type="yui"}else{if(YAHOO.env.ua.gecko&&typeof console!="undefined"&&(b.isFunction(console.log)||b.isObject(console.log))){PCTHREAT.__log_type="firebug"}else{if(YAHOO.env.ua.webkit&&b.isObject(window.console)&&b.isFunction(window.console.log)){PCTHREAT.__log_type="webkit"}else{if(YAHOO.env.ua.opera&&b.isObject(opera)&&b.isFunction(opera.postError)){PCTHREAT.__log_type="opera"}}}}}if(!PCTHREAT.__log_enabled){return}switch(PCTHREAT.__log_type){case"yui":return YAHOO.widget.Logger.log(d,a,c);break;case"firebug":if(a&&(b.isFunction(console[a])||b.isObject(console[a]))){console[a](d)}else{console.log((a?"["+a.toUpperCase()+"] ":"")+d)}break;case"webkit":window.console.log((a?"["+a.toUpperCase()+"] ":"")+d);break;case"opera":opera.postError((a?"["+a.toUpperCase()+"] ":"")+d);break}};PCTHREAT.register=function(a,f,e){var k=PCTHREAT.env.modules;if(!k[a]){k[a]={versions:[],builds:[]}}var c=k[a],j=e.version,h=e.build,g=PCTHREAT.env.listeners;c.name=a;c.version=j;c.build=h;c.versions.push(j);c.builds.push(h);c.mainClass=f;for(var d=0;d<g.length;d=d+1){g[d](c)}if(f){f.VERSION=j;f.BUILD=h}else{PCTHREAT.log("mainClass is undefined for module "+a,"warn")}};PCTHREAT.env=PCTHREAT.env||{modules:[],listeners:[]};PCTHREAT.env.getVersion=function(a){return PCTHREAT.env.modules[a]||null};PCTHREAT.namespace("util","user");PCTHREAT.util.Browser=function(){var a=navigator.userAgent.toLowerCase();var h=document.compatMode=="CSS1Compat";var d=a.indexOf("opera")>-1;var j=/webkit|khtml/.test(a);var e=a.indexOf("msie")>-1;var g=a.indexOf("msie 7")>-1;var b=!j&&a.indexOf("gecko")>-1;var k=e&&!h;var f=(a.indexOf("windows")!=-1||a.indexOf("win32")!=-1);var i=(a.indexOf("macintosh")!=-1||a.indexOf("mac os x")!=-1);var c=/x11|linux|freebsd|netbsd/.test(a);return{isStrict:h,isOpera:d,isSafari:j,isIE:e,isIE7:g,isGecko:b,isBorderBox:k,isWindows:f,isMac:i,isLinux:c}}();PCTHREAT.register("PCTHREAT",PCTHREAT,{version:"1.0.0",build:"1"});
PCTHREAT.namespace("navigation");
PCTHREAT.navigation.AutoDownload=function(){var b=YAHOO.util.Dom;var a=YAHOO.util.Event;a.on(window,"load",function(){b.getElementsByClassName("autodownload","A","",function(){location.href=this.href})})}();

/* scripts for responsive stuff by Robertas 2015-03 */

/* on ready helper, since there is no jQuery available */
(function() {
    var onDomReadyIdentifier = 'onDocumentReady';
    var isBound = false;
    var readyList = [];
    if (window[onDomReadyIdentifier] && typeof window[onDomReadyIdentifier] == 'function') {
        return;
    }
    var onReady = function() {
        // Make sure body exists, at least, in case IE gets a little overzealous.
        // This is taked directly from jQuery's implementation.
        if (!document.body) {
            return setTimeout(onReady, 13);
        }
        for (var i=0; i<readyList.length; i++) {
            readyList[i]();
        }
        readyList = [];
    };

    var bindReady = function() {
        // Mozilla, Opera and webkit nightlies currently support this event
        if (document.addEventListener) {
            var DOMContentLoaded = function() {
                document.removeEventListener("DOMContentLoaded", DOMContentLoaded, false);
                onReady();
            };
            document.addEventListener("DOMContentLoaded", DOMContentLoaded, false);
            window.addEventListener("load", onReady, false); // fallback
            // If IE event model is used
        } else if (document.attachEvent) {
            var onreadystatechange = function() {
                if (document.readyState === "complete") {
                    document.detachEvent("onreadystatechange", onreadystatechange);
                    onReady();
                }
            };
            document.attachEvent("onreadystatechange", onreadystatechange);
            window.attachEvent("onload", onReady); // fallback
            // If IE and not a frame, continually check to see if the document is ready
            var toplevel = false;
            try {
                toplevel = window.frameElement == null;
            } catch(e) {}
            // The DOM ready check for Internet Explorer
            if (document.documentElement.doScroll && toplevel) {
                var doScrollCheck = function() {
                    // stop searching if we have no functions to call
                    // (or, in other words, if they have already been called)
                    if (readyList.length == 0) {
                        return;
                    }
                    try {
                        // If IE is used, use the trick by Diego Perini
                        // http://javascript.nwbox.com/IEContentLoaded/
                        document.documentElement.doScroll("left");
                    } catch(e) {
                        setTimeout(doScrollCheck, 1);
                        return;
                    }
                    // and execute any waiting functions
                    onReady();
                }
                doScrollCheck();
            }
        }
    };

    window[onDomReadyIdentifier] = function(callback) {
        // Push the given callback onto the list of functions to execute when ready.
        // If the dom has alredy loaded, call 'whenReady' right away.
        // Otherwise bind the ready-event if it hasn't been done already
        readyList.push(callback);
        if (document.readyState == "complete") {
            onReady();
        } else if (!isBound) {
            bindReady();
            isBound = true;
        }
    };

    window['bindEvent'] = function(eventType, node, callback) {
        console.log(eventType, node, callback)
        // Mozilla, Opera and webkit nightlies currently support this event
        if (node.addEventListener) {
            node.addEventListener(eventType, callback);
        }
        // If IE event model is used
        else if (node.attachEvent) {
            node.attachEvent(eventType, callback);
        }
    };

    /**
     * Workaround for IE8 which does not have getElementsByClassName
     * Will use native function if available
     *
     */
    document.getElementsByClassNameCross = function(cn){
        if(document.getElementsByClassName) // Returns NodeList here
            return document.getElementsByClassName(cn);

        cn = cn.replace(/ *$/, '');

        if(document.querySelectorAll) // Returns NodeList here
            return document.querySelectorAll((' ' + cn).replace(/ +/g, '.'));

        cn = cn.replace(/^ */, '');

        var classes = cn.split(/ +/), clength = classes.length;
        var els = document.getElementsByTagName('*'), elength = els.length;
        var results = [];
        var i, j, match;

        for(i = 0; i < elength; i++){
            match = true;
            for(j = clength; j--;)
                if(!RegExp(' ' + classes[j] + ' ').test(' ' + els[i].className + ' '))
                    match = false;
            if(match)
                results.push(els[i]);
        }

        // Returns Array here
        return results;
    }
})();


(function() {
    var openClassIdentifier = 'toggle-open';

    onDocumentReady(function(){
        var i, nodes = document.getElementsByClassNameCross('toggle-control');

        for(i=0; i < nodes.length; i++)
        {
            bindEvent('click', nodes[i], function(){
                // this will always be element which has bound event and e.target might be any child of bound element
                var it,
                    hasClass = false,
                    container = document.getElementById(this.getAttribute('data-toggle-container')),
                    classes = container.className.split(' ');

                for(it=0; it < classes.length; it++)
                {
                    if(classes[it] == openClassIdentifier)
                    {
                        hasClass = true;
                        break;
                    }
                }

                if(hasClass)
                {
                    delete classes[it];
                    container.className = classes.join(' ');
                } else {
                    container.className += ' ' + openClassIdentifier;
                }
            })
        }

        // handle mobile search
        bindEvent('click', document.getElementById('search_button'), function(){
            console.log('clicked');
            document.getElementById('mobile-search-form').submit();
        })
    });
}());

(function(){
    // device viewport size
    var viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
    var reflowIdentifier = 'reflow';

    /**
     * Should only be used in extreme cases where regular css is not possible
     *
     * @param container - container which must be moved
     * @param destination - where to move it
     * @param width - width at which such reflow will happen, NOTE! it will also happen for smaller sizes than given one
     * @param options - additional options to pass
     */
    window[reflowIdentifier] = function(container, destination, width, options){
        // reflow can happen
        if(viewportWidth <= width)
        {
            var target = document.getElementById(container);
            var destination = document.getElementById(destination);

            if(target && destination)
            {
                destination.parentNode.insertBefore(target, destination.nextSibling);
            }
        }
    }
}());

(function(){
    onDocumentReady(function(){
        reflow('social-buttons', 'responsive-social-buttons', 1200);
        reflow('general-info', 'general-info-responsive', 1200);
        reflow('description-title', 'title-placeholder', 1200);
        reflow('danger-level-container', 'danger-level-placeholder', 1200);

    })

}())
var rotate_delay = 5000; // delay in milliseconds (5000 = 5 secs)
current = 0;


function nextas(title) {
    if (document.slideform.slide[current+1]) {
    	var img_data = document.slideform.slide[current+1].value.split( '|' );

        set_slide(img_data);
        document.slideform.slide.selectedIndex = ++current;
        document.getElementById('image_number').innerHTML = current+1;
    }
    else {
    	firstas(title);
    }
}
function previousas(title) {
	if (current-1 >= 0) {
		var img_data = document.slideform.slide[current-1].value.split( '|' );

		set_slide(img_data);
		document.slideform.slide.selectedIndex = --current;
		document.getElementById('image_number').innerHTML = current+1;
   	}
	else {
		lastas(title);
    }
}

function firstas(title) {
	var img_data = document.slideform.slide[current].value.split( '|' );

	set_slide(img_data);

	document.slideform.slide.selectedIndex = 0;
	document.getElementById('image_number').innerHTML = current+1;
}
function lastas(title) {
	current = document.slideform.slide.length-1;
	var img_data = document.slideform.slide[current].value.split( '|' );
    set_slide(img_data);
	document.slideform.slide.selectedIndex = current;
	document.getElementById('image_number').innerHTML = current+1;
}

function change() {
	current = document.slideform.slide.selectedIndex;
    var img_data = document.slideform.slide[current].value.split( '|' );

    set_slide(img_data)
}

function set_slide(img_data)
{
    var big = img_data[0],
		thumb = img_data[1];

    console.log('setting slide', big, thumb);
	// this is a bit messed up, #show is thumbnail, and #thumb1 is actual big image, go figure.
    document.images['show'].src = thumb;
    document.getElementById('thumb1').href = big;
}

function vote_article(direction, replacement, id, link){
  	var aa;
  	if(direction == "up")
  		getData(link, 'arating=up&amp;aid='+id, aa, replacement);
  	else
  		getData(link, 'arating=down&amp;aid='+id, aa, replacement);
}
  function getData(requestUrl, requestPost, requestResult, replacement) {
  	var xmlHttpReq = false;
  	var self = this;
  	if (window.XMLHttpRequest) {
  		self.xmlHttpReq = new XMLHttpRequest();
  		}
  	else if (window.ActiveXObject) {
  		self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
  		}
  	self.xmlHttpReq.open('POST', requestUrl, true);
  	self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  	self.xmlHttpReq.onreadystatechange = function() {
  		if (self.xmlHttpReq.readyState == 4) {
  			holder = document.getElementById(replacement);
  			holder.innerHTML = self.xmlHttpReq.responseText;
  			if (requestResult) window.setTimeout(requestResult+'()', 0);
  			}
  		}
  	self.xmlHttpReq.send(requestPost);
  	}
