pic1 = new Image();	pic1.src="http://www.cdn.actiontrip.com/gfx4/morenews.gif"; 
pic2 = new Image();	pic2.src="http://www.cdn.actiontrip.com/gfx4/lessnews.gif"; 

function showregbox(){
	var obj=document.getElementById("registerbox");
	if (obj.style.display=='block') { obj.style.display=''; } else { obj.style.display='block'; }
	return true;
	}

function bookmarksite(){
	var title='ActionTrip';
	var url='http://www.actiontrip.com/';
	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
		else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all)// ie
	window.external.AddFavorite(url, title);
	}




//----------------------------------- funkcije za ispisivanje svih platformi -----------------

var leftcor;
var topcor;

function showhidebox(platformbox,platformboxexpand,color) {
	var obj=document.getElementById(platformboxexpand);
	var obj2=document.getElementById(platformbox);

	findPos(obj2);
	topcor=topcor+obj2.offsetHeight;
	obj.style.position='absolute';
	obj.style.left=leftcor+'px';		// '690px';
	obj.style.top=topcor+'px';
	obj.style.width=obj2.offsetWidth-6+'px';


	if (obj.style.display=='block') { obj.style.display=''; obj2.style.background=color; } else { obj.style.display='block'; obj2.style.background='#000000'; }
	return true;
	}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
//		if (document.all) {
			while (obj = obj.offsetParent) {
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
				}
//		}
	}
	leftcor=curleft;
	topcor=curtop;
}




function position_multipage_comic_nav() {
	var obj=document.getElementById('comic');
	var obj2=document.getElementById('multipagenav');
	findPos(obj);
	leftcor-=10;
	topcor+=obj.offsetHeight-85;
	obj2.style.left=leftcor+'px';
	obj2.style.top=topcor+'px';
	obj2.style.visibility = 'visible';
	}







//------------------------------------- cheats funcije --------------------------------------

function cheats_compact_expand(button){

var obj=document.getElementById(button.replace('_text',''));

if (obj.style.display=='block') {					// obj.style.display=='' || 
	obj.style.display='none';
	var obj=document.getElementById(button);
	obj.innerHTML='EXPAND TO SEE ALL <img border="0" src="http://www.cdn.actiontrip.com/gfx4/cheatsexpand.gif">';
	} else {
	obj.style.display='block';
	var obj=document.getElementById(button);
	obj.innerHTML='COMPACT <img border="0" src="http://www.cdn.actiontrip.com/gfx4/cheatscompact.gif">';
	}
}


function var_compact_expand(button){

var obj=document.getElementById(button.replace('_text',''));

if (obj.style.display=='block') {					// obj.style.display=='' || 
	obj.style.display='none';
	var obj=document.getElementById(button);
	obj.innerHTML='<img border="0" src="/gfx4/cheatsexpand.gif"> EXPAND TO SEE ALL';
	} else {
	obj.style.display='block';
	var obj=document.getElementById(button);
	obj.innerHTML='<img border="0" src="/gfx4/cheatscompact.gif"> COMPACT';
	}
}




//------------------ show hide news ---------------------------------
function showhidenews_brisanje () {
var obj=document.getElementById("hiddennews");
var obj2=document.getElementById("hiddennewsbutton");
if (obj.style.display=='' || obj.style.display=='block') {
	obj.style.display='none';
	obj2.innerHTML='<img src="http://www.cdn.actiontrip.com/gfx4/morenews.gif" border="0"> MORE NEWS';
	} else {
	obj.style.display='block';
	obj2.innerHTML='<img src="http://www.cdn.actiontrip.com/gfx4/lessnews.gif" border="0"> COMPACT NEWS';
	}
}

function showhidenews () {
var obj=document.getElementById("hiddennews");
var obj2=document.getElementById("morenews");
var obj3=document.getElementById("lessnews");
if (obj.style.display=='' || obj.style.display=='block') {
	obj.style.display='none';
	obj2.style.display='block';
	obj3.style.display='none';
	} else {
	obj.style.display='block';
	obj2.style.display='none';
	obj3.style.display='block';
	}
}





//--------------------------- search stuff -------------------------------
function checkplatforms(name, clicked) {
var theForm = document.searchsection;
var allbox;
var numberofchecked=0;
for (i=0; i<theForm.elements.length; i++) {
    if (theForm.elements[i].type == 'checkbox' && theForm.elements[i].name == name && theForm.elements[i].value=='all') { allbox=theForm.elements[i]; }
    if (theForm.elements[i].type == 'checkbox' && theForm.elements[i].name == name && theForm.elements[i].checked && theForm.elements[i]!=allbox) {
	numberofchecked++;
	if (clicked && allbox.checked) { theForm.elements[i].checked=false; numberofchecked=0; }	// kliknuli smo na all, pa sve ostale brisemo
	}
    }
if (numberofchecked) { allbox.checked=false; } else { allbox.checked=true; } 
return false;
}



function setplatforms(name, platset) {
var theForm = document.searchsection;
var allbox;
var numberofchecked=0;
platset = ','+platset;
for (i=0; i<theForm.elements.length; i++) {
    if (theForm.elements[i].type == 'checkbox' && theForm.elements[i].name == name && theForm.elements[i].value=='all') { allbox=theForm.elements[i]; }
    if (theForm.elements[i].type == 'checkbox' && theForm.elements[i].name == name && platset.indexOf(theForm.elements[i].value+',')>0) {
	numberofchecked++;
	theForm.elements[i].checked=true;
	}
    }
if (numberofchecked) { allbox.checked=false; } else { allbox.checked=true; } 
}
// use setplatforms('platforms[]',platset);








function open_girl(doc_loc) {
	winLeft = (screen.width-980)/2;
	winTop = (screen.height-(720+110))/2; 
	window.open(doc_loc, 'loginWindow', 'width=980,height=720,screenX='+winLeft+',screenY='+winTop+',top='+winTop+',left='+winLeft+',resizable=yes,scrollbars=yes');
	}
function open_mail(doc_loc) {
	winLeft = (screen.width-620)/2;
	winTop = (screen.height-(280+110))/2; 
	window.open('/rei/send_email.phtml?id='+doc_loc, 'loginWindow', 'width=620,height=280,screenX='+winLeft+',screenY='+winTop+',top='+winTop+',left='+winLeft+',resizable=yes,scrollbars=no');
	}
function open_prof(doc_loc) {
	winLeft = (screen.width-400)/2;
	winTop = (screen.height-(240+110))/2; 
	window.open('/rei/show_profile.phtml?id='+doc_loc, 'loginWindow', 'width=400,height=240,screenX='+winLeft+',screenY='+winTop+',top='+winTop+',left='+winLeft+',resizable=yes,scrollbars=no');
	}
function open_dl(doc_loc) {
	winLeft = (screen.width-800)/2;
	winTop = (screen.height-(400+110))/2; 
	if (doc_loc.indexOf('phtml')>0) { window.open(doc_loc, 'loginWindow', 'width=800,height=400,screenX=180,screenX='+winLeft+',screenY='+winTop+',top='+winTop+',left='+winLeft+',resizable=yes,scrollbars=no'); } else { window.open('/link.phtml?'+doc_loc, '', ''); }
	}
function open_poll(doc_loc) {
	winLeft = (screen.width-300)/2;
	winTop = (screen.height-(400+110))/2; 
	window.open('/polls.phtml?poll='+doc_loc, 'loginWindow', 'width=300,height=400,screenX=180,screenX='+winLeft+',screenY='+winTop+',top='+winTop+',left='+winLeft+',resizable=yes,scrollbars=no');
	}
function open_editwindow(doc_loc) {
	winLeft = (screen.width-565)/2;
	winTop = (screen.height-(280+110))/2; 
	window.open(doc_loc, 'loginWindow', 'width=565,height=280,screenX='+winLeft+',screenY='+winTop+',top='+winTop+',left='+winLeft+',resizable=yes,scrollbars=yes');
	}


function popup_ac(loc) {
	var left = (screen.width - 400)/2;
	var top = (screen.height - 200)/2.1;
	window.open(loc, "_blank", "left = " + left + ", top = " + top + ", toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=400, height=200");
	return false;
	}


function pop_articles_vote(vote,id) {
	var left = (screen.width - 400)/2;
	var top = (screen.height - 200)/2.1;
	var loc = '/rei/article_save_vote.phtml?vote=' + vote + '&id=' + id;
	window.open(loc, "_blank", "left = " + left + ", top = " + top + ", toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=400, height=200");


	showhidebox('rateitbox','rateitboxexpand','#000000');
	return false;
	}





