function docLoaded(){
	var tmpArr=window.location.href.split("/");
	var thisPageName=tmpArr[tmpArr.length-1];
	var tmpEl;
	thisPageName=thisPageName.split(".")[0];
	
	if (thisPageName=="")	thisPageName="Digital Contact";
	
	if (thisPageName=="Admin"){
		getEl("txtLevel").focus();	
	}
	if (thisPageName=="index"){
		tmpEl=getEl("tdNavInfo");
		tmpEl.innerText?tmpEl.innerText="HOME":tmpEl.textContent="HOME";	
	}else{
		tmpEl=getEl("tdNavInfo");
		tmpEl.innerText?tmpEl.innerText=thisPageName:tmpEl.textContent=thisPageName;
	}
	
	if (getEl("email")) getEl("email").focus();
	if (getEl("crt")) getEl("crt").focus();
}

function antiSpam(o){
	if (o.href.indexOf('AntiSpam')!=-1){
	    o.href='mailto:'+(o.innerText?o.innerText:o.textContent) +  '@';
		o.href+=location.hostname.replace('www.','');
		o.href=o.href.replace('localhost','');
        o.href=o.href.replace(' ','');
    }	
}

function initCloud(){
	var cl=getEl("CloudList");
	var c, theta, x, y, rx, ry, spokes,fs, cx,cy;
	
	cl.W=cl.clientWidth;
	cl.H=cl.clientHeight;
	c=cl.children;
	
	spokes=360/c.length;
	
	cx=cl.W/2;
	cy=cl.H/2;

	if(!cl.rotX){cl.rotX=0;cl.XSpeed=0;}
	rx=cl.rotX+=cl.XSpeed;
	if(rx>=360){cl.rotX=0;rx=0;}

	if(!cl.rotY){cl.rotY=0;cl.YSpeed=1;}
	ry=cl.rotY+=cl.YSpeed;
	if(ry>=360){cl.rotY=0;}
	
	
	for (var i=0;i<c.length;i++){
		theta=i*spokes;
		
		y=cy+Math.sin((theta+ry)*Math.PI/180)*cy;
		x=cx+Math.cos((theta-rx)*Math.PI/180)*(y/4);
		fs=60+Math.cos((theta+ry)*Math.PI/180)*50;
		c[i].style.top=y;
		c[i].style.left=x;
		c[i].style.zIndex=fs;
		c[i].style.fontSize=fs +"%"
		//c[i].innerText=x;
	}
	
	if(!cl.onmousemove){
		cl.onmousemove=function(){setRot(cl);};
	}
	
	setTimeout("initCloud()",25);
	
}

function setRot(o){
	o.XSpeed=(event.x-o.W/2)/(o.W/10);	
	o.YSpeed=(event.y-o.H/2)/(o.H/10);
}



function filterCloud(o){
	var clist=getEl("CloudList").children;
	var crt=o.value.toLowerCase();
	for (var i=0;i<clist.length;i++){
		if (clist[i].innerText.indexOf(crt)){
			clist[i].style.color="#FFFFFF";	
		}else{
			clist[i].style.color="#FF0000";
		}
	}
}

function setPreview(fName){
	var v=getEl("Preview");
	v.FileName=fName;
	v.data=fName;
}

function checkFormSub(theTD){
	if (theTD !=''){
		document.getElementById('tdContent').innerHTML=document.getElementById(theTD).innerHTML;
	}
}

function doMenuOver(o){
	var cont=getEl("contentDiv");
	var t=getEl("tblMenu");
	var f=getEl("divMenuFloater");
	
	cont.innerText=o.innerText;	
	
	var x1=t.offsetLeft;
	var y1=t.offsetTop;
	var h1=o.offsetHeight;
	var w1=o.offsetWidth;
	
	cont.innerText+="\nTable OffsetTop="+y1;
	cont.innerText+="\nTable OffsetLeft="+x1;
	cont.innerText+="\nThis Cell Hight="+h1;
	cont.innerText+="\nThis Cell width="+w1;
	cont.innerText+="\nThis cell offset left="+o.offsetLeft;
	//window.event.clientX--t.offsetLeft;
	
	f.style.top=y1;
	f.style.left=x1+o.offsetLeft;
	f.style.width=w1;
	f.style.height=setTimeout("getHeight("+h1+")",250);
	
	
	//-o.offsetLeft-tblMain.offsetLeft;
	//+document.body.scrollTop;
}

function getHeight(h){
	return h--;
	
}
