// JavaScript Document
var oTopMenuSelRight = null;
var oTopMenuSelLeft = null;

function topMenuUnsel() {
	if (oTopMenuSelRight) if (oTopMenuSelRight.className=='selected') oTopMenuSelRight.className='';
	if (oTopMenuSelLeft) if (oTopMenuSelLeft.className=='selected') oTopMenuSelLeft.className='';
}

function topMenuSel(id) {
	try {
		if (oTopMenuSelRight) if (oTopMenuSelRight.className=='selected') oTopMenuSelRight.className='';
		if (oTopMenuSelLeft) if (oTopMenuSelLeft.className=='selected') oTopMenuSelLeft.className='';
		obj = document.getElementById('tr0'+id+'r'); if (obj.className!='sel') obj.className='selected'; oTopMenuSelRight = obj;
		obj = document.getElementById('tr0'+id+'l'); if (obj.className!='sel') obj.className='selected'; oTopMenuSelLeft = obj;
	} catch(e) {}
}

function changeMainBackgroundImage(url, oLink) {
	var sImgId = 'mainBackgoundImage';
	var oImg = findObj(sImgId);
	if (oImg) {	oImg.style.backgroundImage = "url("+url+")"; /*oLink.className='NumSel';*/ }
}

// Example:
// simplePreload( '01.gif', '02.gif' );
function simplePreload() { 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++) {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}

// Example: obj = findObj("image1");

function findObj(theObj, theDoc){
  var p, i, foundObj;
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) foundObj = theDoc.forms[i][theObj];

  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);

  return foundObj;

}



//////////////////////////////////////////////////////////////////////////////////////////////////////

var popUpWin=0;
var arrPopups = new Array();

function messageWindow(title, msg)
{
  var width="300", height="125";
  var left = (screen.width/2) - width/2;
  var top = (screen.height/2) - height/2;
  var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top;
  var msgWindow = window.open("","msgWindow", styleStr);
  var head = '<head><title>'+title+'</title><link href="/inc/styles.css" rel="stylesheet" type="text/css"></head>';
  var body = '<body><center>'+msg+'<br><p><form><input type="button" value="   Ok   " onClick="self.close()"></form></body>';
  msgWindow.document.write(head + body);
}

function popUpWindow(URLStr, left, top, width, height, scrollbar)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  if (!scrollbar) scrollbar = 'scrollbar=no';
  else scrollbar = 'scrollbars';
  if (!left) left = (screen.width/2) - width/2;
  if (!top) top = (screen.height/2) - height/2;
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,'+scrollbar+',resizable=no,copyhistory=no,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

//////////////////////////////////////////////////////////////////////////////////////////////////////