
function getOffsetLeft (el) {
      var ol = el.offsetLeft;
      while ((el = el.offsetParent) != null)
        ol += el.offsetLeft;
      return parseInt(ol);
    }
    function getOffsetTop (el) {
      var ot = el.offsetTop;
      while((el = el.offsetParent) != null)
       ot += el.offsetTop;
      return parseInt(ot);
    }


function showTip(mItem,mHeader,mText,mShowVideoText)
{


var defText="<b>Video compressed for internet hence low quality. Download recommended.</b>"

document.getElementById("divtooltip").style.left=getOffsetLeft(mItem) 
document.getElementById("divtooltip").style.top=(getOffsetTop(mItem)+30)



if(parseInt(mShowVideoText)==1)
{
	
	document.getElementById("tdTipVideoText").innerHTML=defText
	document.getElementById("tdTipVideoText").style.visibility="visible"

}else{
	document.getElementById("tdTipVideoText").innerHTML=""
	document.getElementById("tdTipVideoText").style.visibility="hidden"
}

document.getElementById("tdTipHead").innerHTML=mHeader
document.getElementById("tdTipText").innerHTML=mText
document.getElementById("divtooltip").style.visibility="visible"

}

function hideTip()
{
document.getElementById("tdTipVideoText").style.visibility="hidden" 
document.getElementById("divtooltip").style.visibility="hidden"
}

document.write("<div id='divtooltip' style='position:absolute;visibility:hidden; width:330px; height:42px; z-index:1'><table width='100%' border='0' cellspacing='1' cellpadding='2' bgcolor='#333399'> <tr> <td id='tdTipHead' class='tipTextHead'></td></tr><tr bgcolor='#a8c2ee'> <td id='tdTipText' class='bodytxt'></td></tr><tr bgcolor='#a8c2ee'> <td id='tdTipVideoText' class='bodytxt'></td></tr></table></div>")


//END T O O L T I P CODE



//Written by vivek
function launchInCenter(theURL,winName,mWidth,mHeight) { //v2.0
//alert("JKJ")
var win_HWND=null;
	var nLeft=0
        var nTop=0

	
	nLeft=((parseInt(screen.availWidth)-parseInt(mWidth))/2)
	
	if (parseInt(screen.availHeight)<=600)
	{
		mHeight=(parseInt(mHeight)+100)
		nTop=(((parseInt(screen.availHeight)-parseInt(mHeight))/2)-100)
	}else{
	
		nTop=((parseInt(screen.availHeight)-parseInt(mHeight))/2)
	}
	
	
	if (screen.availHeight<=600){
		nTop=0
	}
	//nTop=0

		

	win_HWND=window.open("",winName,"left="+nLeft+", top="+nTop +", width="+mWidth+", height="+mHeight+" status=no toolbar=no menubar=no resizable=no titlebar=no");

	//win_HWND=window.createPopup("",winName,"left="+nLeft+", top="+nTop +", width="+mWidth+", height="+mHeight+" status=no toolbar=no menubar=no resizable=no titlebar=no");	


	//win_HWND=window.showModalDialog("",winName,"left="+nLeft+", top="+nTop +", width="+mWidth+", height="+mHeight+" status=no toolbar=no menubar=no resizable=no titlebar=no");


	//win_HWND=window.open("",winName,"fullscreen=yes");
	

	win_HWND.location.href=theURL

	//nLeft=((parseInt(screen.availWidth)-parseInt(win_HWND.document.body.clientWidth))/2)

	//nTop=((parseInt(screen.availHeight)-parseInt(win_HWND.document.body.clientHeight))/2)
	
	//win_HWND.moveTo(nLeft,nTop)
	
    win_HWND.focus()

}//End Written by vivek


function doSearch(mURL)
{
	if(document.getElementById('txtSearch').value=='')
	{
		alert("Please enter keyword to search.")
		document.getElementById('txtSearch').focus()
			
	}else{
		location.href='search.asp?RETURN_URL='+mURL+'&target='+document.getElementById('txtSearch').value
	}	
}


function doASearch(mURL)
{
	var totalOptions=document.getElementById('lstASearch').length
	var ctrOpt=0
	var selCourses=''
	var arrSearchOptions=document.getElementById('lstASearch').options

	if(document.getElementById('txtASearch').value=='')
	{
		alert("Please enter keyword to search.")
		document.getElementById('txtASearch').focus()
		return(false)
	}
	
	if(document.getElementById('lstASearch').value=='')
	{
		alert("Please select at least one course to proceed.")
		document.getElementById('lstASearch').focus()
		return(false)
	}
	
	while(arrSearchOptions[ctrOpt])
	{
		if(arrSearchOptions[ctrOpt].selected==true)
		{
			if(selCourses=='')
			{
				selCourses=arrSearchOptions[ctrOpt].value
			}else{
				selCourses=selCourses+','+arrSearchOptions[ctrOpt].value
			}
		
		}
	
		ctrOpt++;
	}

	location.href='MySearch/Default.asp?RETURN_URL='+mURL+'&target='+document.getElementById('txtASearch').value +'&SEARCH_COURSES='+selCourses
		
}
