/*
credit to Stephen Chapman, About.com for pageWidth and pageHeight

pageWidth,pageHeight are self explanatory
*/
function pageWidth() { 
return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
} 
function pageHeight() {
return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
} 
//w=window.screen.width*0.7;
//w=pageWidth()*0.85;
w=pageWidth()*0.97;

/* OPENS PIC IN GALLERY */
function openpic(picid) {
height=screen.height-70;
width=screen.width-70;
if(width>1000)
	width=1000;
if(height>720)
	height=720;
LeftPosition=(screen.width-width)/2;
TopPosition=(screen.height-height)/2;
windop=window.open('galleryf.php?pid='+picid,'', 'fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width='+width+',height='+height+',left='+LeftPosition+',top='+TopPosition);
}
/*function showpic(picid) { AS AN OPTION
if(document.getElementById("rab").style.display=="none")
{
document.getElementById("rab").style.display="inline";
}
else{
document.getElementById("rab").style.display="none";
}
}*/


/* HIDES AND SHOWS ALTERNATELY THE GIVEN OBJ*/
	function hideShow(objId) {
			if(document.getElementById(objId).style.display=='none'){
				document.getElementById(objId).style.display='inline';
				window.scroll(0,document.getElementById(objId).offsetTop);

			}
			else {
				document.getElementById(objId).style.display='none';
			}
		}
		
function switchObjectsByIds(objid, num){ //switch between objects having the same id prefix plus an increasing number (such as rab1, rab2, rab3...)
i=1;
while(nowobj=document.getElementById(objid+i)){
	if(i==num)
		nowobj.style.display="block";
	else
		nowobj.style.display="none";
	i++;
}
return false;
}

function markSelectedBackground(objid, num, color){ //mark selected object with different background color. used in index news
i=1;
while(nowobj=document.getElementById(objid+i)){
	if(i==num)
		nowobj.style.backgroundColor=color;
	else
		nowobj.style.backgroundColor="";
	i++;
}
return false;
}
function markSelectedText(objid, num, color){ //mark selected object with different color. used in index news
i=1;
while(nowobj=document.getElementById(objid+i)){
	if(i==num)
		nowobj.style.color=color;
	else
		nowobj.style.color="";
	i++;
}
return false;
}
