var highres = true ;
var scrolling = false ;
var my_ie4 ;
var my_w3c ;

var left
var top
var width
var height

var clipLeft
var clipTop
var clipRight
var clipBottom

function detectRes()
{	if (screen.width <= 800)
		highres = false ;
}

function getIEVersion() 
{	var ua = navigator.userAgent
	var IEoffset = ua.indexOf('MSIE ')
	return parseFloat(ua.substring(IEoffset+5, ua.indexOf(';', IEoffset)))
}

function detectOS()
{	my_ie4 = navigator.appName.indexOf('Microsoft') == 0 && parseInt(getIEVersion()) == 4
	my_w3c = (document.documentElement) ? true : false
}

function putRightImage()
{	if (highres)
	{ document.write('<img src="images/right_f.gif" width="245" height="894">') ;
	} else
	{ document.write('<img src="images/right_3.gif" width="31" height="484">') ;
	}
}

function putTopImage()
{	if (highres)
	{	document.write('<img src="images/top_2.gif" width="733" height="92" border="0" usemap="#mLogoBig">') ;
	} else
	{	document.write('<img src="images/top_3.gif" width="733" height="59" border="0" usemap="#mLogoSmall">') ;
	}
}

function putLeftImage()
{	if (highres)
	{	document.write('<img src="images/left_2.gif" width="145" height="894">') ;
	} else
	{	document.write('<img src="images/left_3.gif" width="33" height="485">') ;
	}
}

function putFrameset(language, section, action)
{	if (highres)
	{	document.write('<frameset rows="122,*,8" frameborder="no" border="0" framespacing="0">\n')
		document.write('  <frame name="menu" src="index.php?language=' + language + '&section=menu" scrolling="no" noresize frameborder="no" border="0" framespacing="0">\n')
		document.write('  <frame name="main" id="mainFrame" src="index.php?language=' + language + '&section=' + section + '&action=' + action +'" scrolling="auto" noresize frameborder="no" border="0" framespacing="0">\n')
		document.write('  <frame name="bottom" src="bottom2.htm" scrolling="no" noresize frameborder="no" border="0" framespacing="0">\n')
		document.write('</frameset>\n')
	} else
	{	document.write('<frameset rows="89,*,8" frameborder="no" border="0" framespacing="0">\n')
		document.write('  <frame name="menu" src="index.php?language=' + language + '&section=menu" scrolling="no" noresize frameborder="no" border="0" framespacing="0">\n')
		document.write('  <frame name="main" id="mainFrame" src="index.php?language=' + language + '&section=' + section + '&action=' + action +'" scrolling="auto" noresize frameborder="no" border="0" framespacing="0">\n')
		document.write('  <frame name="bottom" src="bottom2.htm" scrolling="no" noresize frameborder="no" border="0" framespacing="0">\n')
		document.write('</frameset>\n')
	}
}

function setScrolling(val)
{	scrolling = val
}

function scrollToRight(name)
{	if (scrolling && (clipRight + 5) <= (left + (clipRight - clipLeft)))
	{	clipLeft += 5 ;
		clipRight += 5 ;	
		getElement(name).style.clip = "rect(" + clipTop + "px " + clipRight + "px " + clipBottom + "px " + clipLeft + "px)"
		getElement(name).style.left = left - clipLeft
		setTimeout("scrollToRight('" + name + "')", 50)
	}
}

function scrollToLeft(name)
{	if (scrolling && (clipLeft - 5) >= 0)
	{	clipLeft -= 5 ;
		clipRight -= 5 ;	
		getElement(name).style.clip = "rect(" + clipTop + "px " + clipRight + "px " + clipBottom + "px " + clipLeft + "px)"
		getElement(name).style.left = left - clipLeft
		setTimeout("scrollToLeft('" + name + "')", 50)
	}
}

function getElement(elt)
{	if (my_ie4)
		return document.all[elt]
	else
		return document.getElementById(elt)
}

function popup(href, width, height, name)
{	var theWindow = window.open(href, name ? name : 'win' + Math.random(), 'height=' + height + ',width=' + width + ',menubar=no,statusbar=no,scrollbars=no,locationbar=no,personalbar=no,toolbar=no')
	theWindow.moveTo(
		(screen.width - width) / 2
		, (screen.height - height) / 2)
	
	return theWindow
}

function roll(img, arr, index)
{	if (index < 0 || index > arr.length) return false
	else img.src = arr[index - 1].src
}

detectRes() ;
detectOS() ;