var w=window,d=document,dom=d.getElementById, ie4=d.all&&!dom;
var ie=(d.all&&navigator.userAgent.toLowerCase().indexOf('opera')==-1)?1:0;

function On(id) 
{ 
	d.images[id.id].offSrc = d.images[id.id].src;
	d.images[id.id].src    = onImg[id.id].src;
}
function Off(id) 
{ 
	d.images[id.id].src = d.images[id.id].offSrc;
} 

function show_menu(id){
	with(getEl(id).style)
	{
		if(display==''||display=='none')display='block';else display='none';
	}
	return false;
}
var effect_on = "revealTrans(duration=.75, transition=6)";
var effect_off = "revealTrans(duration=.75, transition=7)";
var maxIndex = 3;			  
function zIndx(obj){
	obj.style.zIndex=parseInt(maxIndex+1)
	maxIndex=obj.style.zIndex;
}

function show_div(div)
{
	with(getEl(div))
	{
		maxIndex+=1
		style.zIndex=maxIndex;
		if(ie){
		style.filter=effect_on;
		filters[0].stop();
		filters[0].apply();}
		style.top=top()+10;
		style.visibility='visible';
		if(ie)
		filters[0].play();
	}
}
function close_div(div)
{
	with(getEl(div))
	{
		if(ie)
		{
		style.filter=effect_off;
		filters[0].stop();
		filters[0].apply();
		}
		style.visibility='hidden';
		if(ie)
		filters[0].play();
	}
}			

function open_print(url) {
	config='left=0,top=0,width=750,height=350,innerheight=350,innerwidth=400,scrollbars=yes,resizable=yes';
	ok=window.open('/print.php?s='+url,'',config);
}

function wopen(u,w,h,W)
{
	W=window.open(u,'','left=0,top=0,width='+w+',height='+h+',innerheight='+h+',innerwidth='+w+',resizable=yes')
	return!W.opener&&W.opener==self;
}
function showImg(u)
{
	var s = u.match(/([^#]+)#?([0-9]+)?,?([0-9]+)?/)
	if(s == null)return false;
	return wopen(s[1], s[2] || 800, s[3] || 600);
}

function go_url(url){location.href=url}

function setOnclickEvent(id)
{
	var imgs = getTag(getEl(id),'a');
	for(var i=0,c=imgs.length;i<c;i++)
	{
		if(getPar(imgs[i]).tagName.toLowerCase() == 'span' || getPar(imgs[i]).tagName.toLowerCase() == 'li')
		{
			imgs[i].onclick=function(){return showImg(this.href)}
		}
	}
}

function getTag(o,t){return ie4?t=='*'?o.all:o.all.tags(t):o.getElementsByTagName(t)}
function getEl(o){return ie4?d.all[o]:d.getElementById(o)}
function getPar(o){return dom?o.parentNode:ie4?o.parentElement:o}

/**********************************************************************
                           Simple marquee script
                      By Mark Wilton-Jones 25/6/2005
***********************************************************************/

var oMarquees = [], oMrunning,
	oMInterv =        30,     //interval between increments
	oMStep =          1,      //number of pixels to move between increments
	//oStopMAfter =     0,     //how many seconds should marquees run (0 for no limit)
	oResetMWhenStop = false,  //set to true to allow linewrapping when stopping
	oMDirection =     'left'; //'left' for LTR text, 'right' for RTL text

function doDMarquee() {
	if( oMarquees.length || !document.getElementsByTagName ) { return; }
	var oDiv = document.getElementById('marquee');
	if( !( oDiv.mchild = oDiv.getElementsByTagName('div')[0] ) ) {return;}
	oDiv.mchild.style.cssText += ';white-space:nowrap;';
	oDiv.mchild.style.whiteSpace = 'nowrap';
	oDiv.style.height = oDiv.offsetHeight + 'px';
	oDiv.style.overflow = 'hidden';
	oDiv.style.position = 'relative';
	oDiv.mchild.style.position = 'absolute';
	oDiv.mchild.style.top = '0px';
	oDiv.mchild.style[oMDirection] = oDiv.offsetWidth + 'px';
	oMarquees[oMarquees.length] = oDiv;
	oMrunning = setInterval('aniMarquee()',oMInterv);
	getEl('marqueeTable').style.visibility = 'visible'
}
function aniMarquee() {
	var oDiv, oPos;
	for( var i = 0; i < oMarquees.length; i++ ) {
		oDiv = oMarquees[i].mchild;
		oDiv.style.visibility = 'visible';
		oPos = parseInt(oDiv.style[oMDirection]);
		if( oPos <= -1 * oDiv.offsetWidth) {
			oDiv.style[oMDirection] = oMarquees[i].offsetWidth + 'px';
		} else {
			oDiv.style[oMDirection] = ( oPos - oMStep ) + 'px';
		}
	}
}
if( window.addEventListener ) {
	window.addEventListener('load',doDMarquee,false);
} else if( document.addEventListener ) {
	document.addEventListener('load',doDMarquee,false);
} else if( window.attachEvent ) {
	window.attachEvent('onload',doDMarquee);
}
