isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;
var urlredirect;
var whichDog,hotDog;

function showPopup(url){	
	ajaxCall(url,"popup");	
	document.getElementById("popup").style.display="block";	
	return false;
}

function ddInit(e){
	topDog=isIE ? "BODY" : "HTML";
	whichDog=document.getElementById("popup");  
	if (window.event) e = window.event;
	hotDog=isIE ? e.srcElement : e.target;  	  
	if(hotDog.tagName=="H1") {		
		while (hotDog.id!="titleBar"){		    			
			hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
		}  		
		if (hotDog.id=="titleBar"){
			offsetx=isIE ? event.clientX : e.clientX;
			offsety=isIE ? event.clientY : e.clientY;
			nowX=parseInt(whichDog.style.left);
			nowY=parseInt(whichDog.style.top);			
			ddEnabled=true;
			document.onmousemove=dd;
		}

	}
}

function dd(e){
  if (!ddEnabled) return;
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;  
}

function ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isHot){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}
function hideMe(){  
  document.getElementById("popup").style.display="none";  
}
document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");

// Fade in/out
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++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}

// Ajax
function ajaxCall(url,output)
{		
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 		
	url+="&"+Math.random();		
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function() {
		if (xmlHttp.readyState==4) {
			document.getElementById(output).innerHTML=xmlHttp.responseText;
		}
	}	
	xmlHttp.send(null);		
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();  
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("MSXML2.XMLHTTP");	
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");	
    }
  }
return xmlHttp;
}