function Clip(topic,cat,subcat,city,uid)
{
  var t=topic;
  var c=cat;
  var s=subcat;
  var ci=city;
  var clip="clip";
  var me='1';
  if(uid!=0)
  {
	  var agree=confirm("Are you sure Clipped the topic?");
	  if(agree)
	  {
	    makeRequest(t,c,s,ci,me,clip);		
	  }else
	  {
	   return false;  
	  }
  }else
  {
	 window.location.href='../login.php?ids=class_clipdesc&fid='+t+'&cat='+c+'&subcat='+s+'&city='+ci;
	 window.submit();	
  }  
}

function displayElt(curobj,eid,uid,fid,cat,subcat,city)
{   
  var f=fid;
  var c=cat;
  var s=subcat;
  var ci=city;   
    hideElt(document.getElementById('olddsp').value);
    document.getElementById('olddsp').value=eid
   if(eid=='sreview')
   {
    hideElt('sreview1');
	hideElt('abuse');
   }else if(eid=='sreview1')
   {
     hideElt('sreview');
	 hideElt('abuse');
   }else if(eid=='abuse')
   {
     hideElt('sreview');
     hideElt('sreview1');
   }else
   {
     hideElt('sreview');
	 hideElt('sreview1');
	 hideElt('abuse');
   }
   if(uid==0)
   {
    window.location.href='../login.php?ids=classres&fid='+f+'&cat='+c+'&subcat='+s+'&city='+ci;   
   }else
   {
   if (document.getElementById){
	var subobj=document.getElementById(eid)
	//subobj.style.display=(subobj.style.display!="block")? "block" : "none"
	subobj.style.display="block";
	var xpos=getposOffset(curobj, "left",86,"minus")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0)
	var ypos=getposOffset(curobj, "top",16,"add")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
	subobj.style.left=xpos+"px"
	subobj.style.top=ypos+"px"
	return false
	}else
   return true    				
   }
}

function hideElt(eid)
{
      elt=document.getElementById(eid);
	  elt.style.display='none';
}

function getposOffset(overlay, offsettype,adjustoffset,sign){ //for positioning correctly

  var totaloffset=(offsettype=="left")? overlay.offsetLeft-115 : overlay.offsetTop;
  var parentEl=overlay.offsetParent;
	while (parentEl!=null){
      totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
 	  parentEl=parentEl.offsetParent;
   }
   if(sign=="minus"){
	    totaloffset = totaloffset - adjustoffset;
   }else{
   	 totaloffset = totaloffset + adjustoffset;
   }
    return totaloffset;
 }

var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
	alert(tipobj);
	return false;
	if (ns6||ie){
	if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
	if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
	tipobj.innerHTML=thetext
	enabletip=true
	return false
	}
}

function positiontip(e){
	if (enabletip){
	var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
	var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
	//Find out how close the mouse is to the corner of the window
	var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
	var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
	
	var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
	
	//if the horizontal distance isn't enough to accomodate the width of the context menu
	if (rightedge<tipobj.offsetWidth)
	//move the horizontal position of the menu to the left by it's width
	tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
	else if (curX<leftedge)
	tipobj.style.left="5px"
	else
	//position the horizontal position of the menu where the mouse is positioned
	tipobj.style.left=curX+offsetxpoint+"px"
	
	//same concept with the vertical position
	if (bottomedge<tipobj.offsetHeight)
	tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
	else
	tipobj.style.top=curY+offsetypoint+"px"
	tipobj.style.visibility="visible"
	}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}
function copy(text2copy) 
{
  if (window.clipboardData) 
  {
    window.clipboardData.setData("Text",text2copy);
  } 
  else 
  {
    var flashcopier = 'flashcopier';
    if(!document.getElementById(flashcopier)) 
	{
      var divholder = document.createElement('div');
      divholder.id = flashcopier;
      document.body.appendChild(divholder);
    }
    document.getElementById(flashcopier).innerHTML = '';
    var divinfo = '<embed src="../images/_clipboard.swf" FlashVars="clipboard='+escape(text2copy)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
    document.getElementById(flashcopier).innerHTML = divinfo;
  }
} 
function kickStart() 
{
	var myParent = document.getElementById("embedcode");
	var myDiv = myParent.value;
	copy(myDiv);
}
document.onmousemove=positiontip