function addOnloadFunc(func)
{
	//setup onload function
	if(typeof window.addEventListener != 'undefined')
	{
		//.. gecko, safari, konqueror and standard
		window.addEventListener('load', func, false);
	}
	else if(typeof document.addEventListener != 'undefined')
	{
		//.. opera 7
		document.addEventListener('load', func, false);
	}
	else if(typeof window.attachEvent != 'undefined')
	{
		//.. win/ie
		window.attachEvent('onload', func);
	}

	//** remove this condition to degrade older browsers
	else
	{
		//.. mac/ie5 and anything else that gets this far
		
		//if there's an existing onload function
		if(typeof window.onload == 'function')
		{
			//store it
			var existing = onload;
			
			//add new onload handler
			window.onload = function()
			{
				//call existing onload function
				existing();
				
				//call func onload function
				func();
			};
		}
		else
		{
			//setup onload function
			window.onload = func;
		}
	}
}

v=Date;
x=false;
z=Array;
af=Math.floor;
ag=RegExp;
b=new z(10);
s=new z("null","home1","forums","mirc","search","ip","jvm","pcsupport","contact","mondial");
aa=new z(8);
ab=10;
t=0;
u=0;
n=0;
o=new v();
h=5;
m=385;
c=0;
w=x;
var firstHoverOccurred=x;
m=385;
p=0;
function d(ac){
	c=ac;
	o=new v();
	setTimeout("gidle()",20);
}

function e(ac){
	c=0;
	w=x;
	o=new v();
	setTimeout("gidle()",20);
}

function ae(){
	for(var j=1; j<b.length; j++){
		b[j]=30
	}
	for(i=0; i<b.length; i++){
		aa[i]=new Image();
		aa[i].src="/"+s[i+1]+".gif"
	}
	setTimeout("gidle()",20);
}

addOnloadFunc(ae);

function gidle(){
	var l=0;
	for(var i=1; i<b.length; i++){
		var imagename="image"+i;
		var imageElem=document.getElementById(imagename);
		if(c!=i){
			if(b[i]>30){
				b[i]-=h;
				if(b[i]<=30){
					b[i]=30;
					imageElem.src="/"+s[i]+"-sm.gif"
				}
				imageElem.width=b[i];
				imageElem.height=b[i];
				p=1
				}
				l+=b[i]
			}
		}
		if(c!=0&&b[c]<60){
			imagename="image"+c;
			imageElem=document.getElementById(imagename);
			if(w==x){
				w=true;
			}
			b[c]+=h;
			p=1;
			if(b[c]>60){
				b[c]=60
			}
			l+=b[c];
			if(l<m){
				b[c]+=m-l;
				if(b[c]>60){
					b[c]=60
				}
				l=m
				}
				imageElem.width=b[c];
				imageElem.height=b[c];
				document.getElementById(imagename).src="/"+s[c]+".gif"
			}
			m=l;
			var ad=new v();
			ab=ad.getTime()-o.getTime();
			o=ad;
			t+=ab;
			u++;
			n=t/u;
			h=5;
			if(u>4){
				if(n>30){
				h=10
			}
			if(n>60){
				h=15
			}
			if(n>90){
				h=20
			}
		}
		if(p){
			setTimeout("gidle()",20);
			p=0
		}
}


//Function to jump to another forum
function ForumJump(URL) {
	
	if (URL.options[URL.selectedIndex].value != "") self.location.href = URL.options[URL.selectedIndex].value;	
	return true;
}

function MainPageJump(URL) {
	if (URL.options[URL.selectedIndex].value != "") self.location.href = URL.options[URL.selectedIndex].value;	
	return true;
}

function getright(abc) {
 if (window.event.ctrlKey && window.event.shiftKey) {
 self.location.href = abc; 
 }
else {
 shake(15)
}
}

function shake(n) {
if (self.moveBy) {
for (i = 15; i > 0; i--) {
for (j = n; j > 0; j--) {
self.moveBy(0,i);
self.moveBy(i,0);
self.moveBy(0,-i);
self.moveBy(-i,0);
}}}}

function link_to_post(tid,pnid,poid)
{
 temp = prompt( "העתיקו ידנית את הלינק הבא, הלינק מקשר ישירות להודעה הנוכחית", "http://www.madd0g.co.il/forum/forum_posts.asp?TID=" + tid + "&TPN=" + pnid + "#" + poid);
 return false;
}



//Function to jump to another forum
function ForumJump(URL) {
	
	if (URL.options[URL.selectedIndex].value != "") self.location.href = URL.options[URL.selectedIndex].value;	
	return true;
}

//Function to open pop up window
function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}


//Function to open preview post window
function OpenPreviewWindow(targetPage, formName){
	
	now = new Date  
	
	//Open the window first 	
   	openWin('','preview','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=680,height=400')
   		
   	//Now submit form to the new window
   	formName.action = targetPage + "?ID=" + now.getTime();	
	formName.target = "preview";
	formName.submit();
}
function fixSize(w,mh,mw) {
    if( !document.images ) return;
    if(document.all) img = document.all[w]
    else if(document.layers) img = document.layers[w+'Div'].document.images[w]
    else if(document.getElementById) img = document.getElementById(w)
    if( img.width > mw ) img.width = mw
    if( img.height > mh ) img.height = mh
}

function maddogjstest(){
alert('your javascript works!')
}

var cm8cat="cm8int_maddog";
