
function SetDesc(desc)
{
	var metatags = document.getElementsByTagName("meta");
	for (i=0;i < metatags.length;i++)
	{
		if (metatags[i].getAttribute("name") == "description")
		{
			metatags[i].setAttribute("content", desc);
		} 
		if (metatags[i].getAttribute("name") == "keywords")
		{
			metatags[i].setAttribute("content", desc);
		} 
	}	
}
function SetIds(objOne, posObjOne, objTwo, posObjTwo)
{
	document.getElementById('imgOneId').value = objOne;
	document.getElementById('imgOnePosId').value = posObjOne;
	document.getElementById('imgTwoId').value = objTwo;
	document.getElementById('imgTwoPosId').value = posObjTwo;
}
function Position()
{

	if((!document.getElementById('imgOneId')) || (!document.getElementById('imgOnePosId')) || (!document.getElementById('imgTwoId')) || (!document.getElementById('imgTwoPosId')))
	{
			return;
	}
	
	var objOne = document.getElementById('imgOneId').value;
	var posObjOne = document.getElementById('imgOnePosId').value;
	var objTwo = document.getElementById('imgTwoId').value;
	var posObjTwo = document.getElementById('imgTwoPosId').value;
	
	var posObjX;
    var posObjY;
	var topPos;	
	var objStyle;
	var leftPos;
	
	if(document.getElementById(objOne))
	{
		objStyle = document.getElementById(objOne);
		posObjX = findPosX(posObjOne);
		posObjY = findPosY(posObjOne);
		
		
		if(objStyle){
			leftPos = (posObjX + document.getElementById(posObjOne).width/2 + 10);
			topPos = (posObjY + 90);
			if(leftPos < 0)
				leftPos = 0;
			if(topPos < 0)
				topPos = 0;
			objStyle.style.left = leftPos;
			objStyle.style.top = topPos;
			objStyle.style.visibility = "visible";				
		}
	}
	
	if(document.getElementById(objTwo))
	{
		objStyle = document.getElementById(objTwo);
		posObjX = findPosX(posObjTwo);
		posObjY = findPosY(posObjTwo);
		
		
		if(objStyle){
			leftPos = (posObjX + document.getElementById(posObjTwo).width/2 + 10);
			topPos = (posObjY);
			if(leftPos < 0)
				leftPos = 0;
			if(topPos < 0)
				topPos = 0;
			objStyle.style.left = leftPos;
			objStyle.style.top = topPos;
			objStyle.style.visibility = "visible";
		}
	}
}


function findPosX(obj)
{
	obj = document.getElementById(obj);
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	obj = document.getElementById(obj);
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}


var clockID = 0;
var tDate = 0;

function SetDate(serverTime)
{
	tDate = new Date(serverTime);
}

function UpdateClock() {

	if(clockID) {
      clearTimeout(clockID);
      clockID  = 0;
   }
   if(tDate != 0)   
   {
		tDate.setSeconds(tDate.getSeconds()+1);
	  
		var tMin = tDate.getMinutes();
		tMin = tMin + '';
	   
		if(tMin.length == 1)
		{
			tMin = '0' + tMin;
		}
	   if(document.getElementById('theTime'))
		{
		
			if (typeof document.all['theTime'][0] == 'object')
				{
				var i
				for(i=0; i < document.all['theTime'].length; i++)
					{	
   							document.all['theTime'][i].value = '' 
											+ tDate.getHours() + ':' 
											+ tMin;                                                    
					}
				}
			else
				{
				
   				document.getElementById('theTime').value = '' 
									+ tDate.getHours() + ':' 
									+ tMin;
		                                                        
				}
		}
		clockID = setTimeout('UpdateClock()', 1000);
		
   }
}

function StartClock() {
   clockID = setTimeout('UpdateClock()', 500);
   }

function KillClock() {
   if(clockID) {
      clearTimeout(clockID);
      clockID  = 0;
   }
   function ScrollToTop(){
  window.scrollTo(0,0);
   }
}


