// JavaScript Document
function getElementPosition(elemId)
{
    var elem = document.getElementById(elemId);
	
    var w = elem.offsetWidth;
    var h = elem.offsetHeight;
	
    var l = 0;
    var t = 0;
	
    while (elem)
    {
        l += elem.offsetLeft;
        t += elem.offsetTop;
        elem = elem.offsetParent;
    }

    return {"left":l, "top":t, "width": w, "height":h};
}

function getTagTopPos(tagNum)
{
	if (tagNum>9) {
		$tagname = "tag" + tagNum;
	} else {
		$tagname = "tag0" + tagNum;
	}
	pos = getElementPosition($tagname);
	return pos.top;
}

function show_fields(f_b)
{
	for(tagN in f_b)
	{
    	curobj = f_b[tagN];
		tagpos = getTagTopPos(curobj.tagNumber);
		curdiv = document.getElementById(curobj.Tid);
		curdiv.style.top = curobj.PosPrefix + tagpos + curobj.toppad;
		curdiv.style.visibility = 'visible';
	}	
}

function OverColor(elem,direction){
	if (direction=="in") { 
//		elem.style.background='#990000';
		elem.style.color = '#FFCC00';
		document.status = 'Нажмите для перехода';
		}
	if (direction=="out") {
//		elem.style.background='#CCCCFF';
		elem.style.color = '#FFFFFF';
		window.status = '';
		}
}

function welcometext() { 
	times--;
	if (times==0) { 
		if (started==false) { 
			started = true; 
			window.status = hellotext; 
			setTimeout("anim()",1); 
		} 
	thetext = hellotext; 
	} 
} 
function showstatustext(txt) { 
	thetext = txt; 
	setTimeout("welcometext()",4000); 
	times++;
} 
function anim(){ 
	step++;
	if (step==7) {step=1} 
	if (step==1) {window.status=">==="+thetext+"===<"} 
	if (step==2) {window.status="=>=="+thetext+"==<="} 
	if (step==3) {window.status=">=>="+thetext+"=<=<"} 
	if (step==4) {window.status="=>=>"+thetext+"<=<="} 
	if (step==5) {window.status="==>="+thetext+"=<=="} 
	if (step==6) {window.status="===>"+thetext+"<==="} 
	setTimeout("anim()",200); 
} 

function call_details(personID) {
	alert(personID);
}

function jsDelay(millis) 
{
	var date = new Date();
	var curDate = null;
	
	do { curDate = new Date(); } 
	while(curDate-date < millis);
}
