


function popupwindow(url, name, width, height){
	settings="left=100,top=100,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+width+",height="+height;
	MyNewWindow=window.open(url,name,settings);
}

function confirmSubmit(text){
	var agree=confirm(text);
	if(agree){
		return true;
	}else{
		return false;
	}	
}




function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}









function show(ID){
	document.getElementById(ID).style.display='';
}



function hide(ID){
	document.getElementById(ID).style.display='none';
}









function fadeIn(ID){
	var obj = document.getElementById(ID);
	opacity(ID,100,0,1);
	setTimeout(function(){ obj.style.display=''; },100);
	opacity(ID,0,100,750);
}


function fadeOut(ID){
	var obj = document.getElementById(ID);
	opacity(ID,100,0,500);
	setTimeout(function(){ obj.style.display='none'; },500);
}








	
function toggleDisplay(ID){
	var obj = document.getElementById(ID);
	if(obj.style.display=='none'){
		opacity(ID,100,0,10);
		setTimeout(function(){ obj.style.display=''; },200);
		opacity(ID,0,100,500);
	}else{
		opacity(ID,100,0,300);
		setTimeout(function(){ obj.style.display='none'; },200);
	}
}



function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac("+i+",'"+id+"')",(timer * speed));
            timer++;
        }
    }else if(opacStart < opacEnd){
        for(i = opacStart; i <= opacEnd; i++){
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}



function changeOpac(opacity,id){
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
} 










function findPos(obj) {
	var curleft = 0;
	var curtop = 0;
	if(obj.offsetParent){
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curtop,curleft];
}







function showModal(URL,WIDTH,HEIGHT){
	var DIV = document.createElement("div");
	DIV.innerHTML = "<div style=\"position:fixed; left:0px; top:0px; width:100%; height:100%; background-image:url('https://www.telestial.com/images/fade_75.png');\"><table align=\"center\" style=\"margin-top:175px;\" cellspacing=\"0\" cellpadding=\"0\"><tr bgcolor=\"#FFFFFF\"><td id=\"modal_content\" width=\"1\" height=\"1\"></td></tr><tr id=\"modal_close\" style=\"display:none;\"><td align=\"right\" nowrap=\"nowrap\" style=\"padding-top:4px;\"><a href=\"#none\" onClick=\"hideModal();\" style=\"color:#FFFFFF; text-decoration:none;\">close window</a></td></tr></table></div>";
	DIV.setAttribute('id','modal');
	document.body.appendChild(DIV);
	var timer = 0;
	setTimeout("document.getElementById('modal_content').innerHTML='<iframe id=\"modal_iframe\" src=\""+URL+"\" frameborder=\"0\" style=\"width:"+WIDTH+"px; height:"+HEIGHT+"px;\"></iframe>';",(timer+100));
	setTimeout("fadeIn('modal_close',500)",(timer+500));
}


function hideModal(){
	var DIV = document.getElementById('modal'); document.body.removeChild(DIV);
}


