var xmlHttp;
function initfunction()
{
	var1=window.location.href;
	myvar=var1.split("?")
	//alert(myvar.length)
	if (myvar.length==2)
	{
		myvar2=myvar[1].split("=")
		vid=myvar2[1];
	}
	else
	{
		vid=0
	}
	setTimeout("whatsHot(1,1)", 1000);
	setTimeout("featuredVideos(1,1)", 1000);
	setTimeout("ajax_JustAdded(1,7)", 1000);
	setTimeout("showVideo1(vid)", 1000);
	setTimeout("handlebottom(0)", 1000);
	setTimeout("ajax_populatecategories(1)", 1000);
}

//=====================================================
// Populate Category
function ajax_populatecategories(section_id)
{
	//alert(section_id);	
	document.getElementById("getCategory_div").innerHTML="<div align='center'><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	if ((parseInt(section_id)!=3)&& (parseInt(section_id)!=5))
	{
		document.getElementById("getSubCategory_div").innerHTML="<div align='center' style='height:22px;'>Pick your category</div>";
	}
	else
	{
		document.getElementById("getSubCategory_div").innerHTML="<div align='center' style='height:22px;'> </div>";
	}
	
	var url="getCategory.asp?sid=" + Math.random() + "&section_id="+section_id
	//alert(url);
	xmlHttp_getCategory=GetXmlHttpObject(getCategory)
	xmlHttp_getCategory.open("GET", url , true)
	xmlHttp_getCategory.send(null)
	return true;
}
function getCategory()
{
	if ((xmlHttp_getCategory.readyState==4) || (xmlHttp_getCategory.readyState=="complete"))
	{
		document.getElementById("getCategory_div").innerHTML=xmlHttp_getCategory.responseText
		
	}
}


//=====================================================
// Populate Sub Category
function ajax_PopulateSubCategories(Cat_id)
{
	//alert(Cat_id);	
	document.getElementById("getSubCategory_div").innerHTML="<div align='center'><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	
	for (i=0;i<5;i++)
	{
		if(document.frm_populatecategories.section_category[i].checked)
		{
			section_id=document.frm_populatecategories.section_category[i].value;
		}
	}
	
	var url="getSubCategory.asp?sid=" + Math.random() + "&Cat_id="+Cat_id +"&section_id="+section_id
	//alert(url);
	xmlHttp_getSubCategory=GetXmlHttpObject(getSubCategory)
	xmlHttp_getSubCategory.open("GET", url , true)
	xmlHttp_getSubCategory.send(null)
	return true;
}
function getSubCategory()
{
	if ((xmlHttp_getSubCategory.readyState==4) || (xmlHttp_getSubCategory.readyState=="complete"))
	{
		document.getElementById("getSubCategory_div").innerHTML=xmlHttp_getSubCategory.responseText
		
	}
}

//=====================================================
// Just Added
function ajax_JustAdded(heading,vdo_limit)
{
	if (heading == 1)
	{
		heading_name = "Just Added"
	}
	//alert("section_id="+section_id)
	//alert("videoid="+videoid)
	document.getElementById("JustAdded_div").innerHTML="<div align='center'><br><br><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	//document.getElementById("dyn_heading_div").innerHTML="<div align='left'>"+heading_name+"</div>";

	var url="getJustAdded.asp?sid=" + Math.random() +"&vdo_limit="+vdo_limit
	xmlHttp_JustAdded=GetXmlHttpObject(getJustAdded)
	xmlHttp_JustAdded.open("GET", url , true)
	xmlHttp_JustAdded.send(null)
	return true;
}

function getJustAdded()
{
	if ((xmlHttp_JustAdded.readyState==4) || (xmlHttp_JustAdded.readyState=="complete"))
	{
		document.getElementById("JustAdded_div").innerHTML=xmlHttp_JustAdded.responseText
	}
}



//=====================================================
// Get Releated videos
function ajax_GetRelVideo(heading)
{
	if (heading == 1)
	{
		heading = "Related Videos"
	}
	//alert("here");
	if (document.frm_populatecategories.cat_id[document.frm_populatecategories.cat_id.selectedIndex].value==-1)
{
	alert("Pick Your Category");
	document.frm_populatecategories.cat_id.focus();
	return false;
}
	
	//section_id = document.frm_populatecategories.section_category.checked
	for (i=0;i<5;i++)
	{
		if(document.frm_populatecategories.section_category[i].checked)
		{
			section_id=document.frm_populatecategories.section_category[i].value;
		}
	}
	//alert("section_id="+section_id);
	cat_id =  document.frm_populatecategories.cat_id[document.frm_populatecategories.cat_id.selectedIndex].value
	if ((section_id !=3)&&(section_id !=5))
	{
		subcat_id = document.frm_populatecategories.subcat_id[document.frm_populatecategories.subcat_id.selectedIndex].value
	}
	else
	{
		subcat_id =-1
	}
		
	//alert(cat_id);
	document.getElementById("RelVideos_div").innerHTML="<div align='center'><br><br><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	//document.getElementById("dyn_heading_div").innerHTML="<div align='left'>"+heading+"</div>";

	var url="getRelVideos.asp?sid=" + Math.random() + "&section_id=" +section_id+ "&cat_id=" +cat_id+ "&subcat_id=" +subcat_id+"&vdo_limit=3"
	//alert (url)
	xmlHttp_RelVideos=GetXmlHttpObject(getRelVideos)
	xmlHttp_RelVideos.open("GET", url , true)
	xmlHttp_RelVideos.send(null)
	return true;
}

function getRelVideos()
{
	if ((xmlHttp_RelVideos.readyState==4) || (xmlHttp_RelVideos.readyState=="complete"))
	{
		document.getElementById("RelVideos_div").innerHTML=xmlHttp_RelVideos.responseText
	}
}

//=====================================================
// Get More Releated videos
function getMoreRelVdos(section_id,cat_id,subcat_id)
{
	//alert(subcat_id) 
	heading = "Related Videos"
	//section_id = document.frm_populatecategories.section_category.checked
	for (i=0;i<5;i++)
	{
		if(document.frm_populatecategories.section_category[i].checked)
		{
			section_id=document.frm_populatecategories.section_category[i].value;
		}
	}
	
	document.getElementById("RelVideos_div").innerHTML="<div align='center'><br><br><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	//document.getElementById("dyn_heading_div").innerHTML="<div align='left'>"+heading+"</div>";

	var url="getRelVideos_more.asp?sid=" + Math.random() + "&section_id=" +section_id+ "&cat_id=" +cat_id+ "&subcat_id=" +subcat_id+"&vdo_limit=3"
	//alert (url)
	xmlHttp_MoreRelVideos=GetXmlHttpObject(getMoreRelVideos)
	xmlHttp_MoreRelVideos.open("GET", url , true)
	xmlHttp_MoreRelVideos.send(null)
	return true;
}

function getMoreRelVideos()
{
	if ((xmlHttp_MoreRelVideos.readyState==4) || (xmlHttp_MoreRelVideos.readyState=="complete"))
	{
		document.getElementById("RelVideos_div").innerHTML=xmlHttp_MoreRelVideos.responseText
	}
}


//=====================================================
// Get Releated Paging
function ajax_GetRelVideo_page(subcat_id,page,heading,vdo_limit)
{
	//alert(cat_id);
	document.getElementById("rel_Videos_div").innerHTML="<div align='center'><br><br><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	//document.getElementById("dyn_heading_div").innerHTML="<div align='left'>"+heading+"</div>";

	var url="showthumbnails.asp?sid=" + Math.random() +"&vdo_limit=3&Page="+page
	//alert (url)
	xmlHttp_RelVideos_page=GetXmlHttpObject(getRelVideos_page)
	xmlHttp_RelVideos_page.open("GET", url , true)
	xmlHttp_RelVideos_page.send(null)
	return true;
}

function getRelVideos_page()
{
	if ((xmlHttp_RelVideos_page.readyState==4) || (xmlHttp_RelVideos_page.readyState=="complete"))
	{
		document.getElementById("rel_Videos_div").innerHTML=xmlHttp_RelVideos_page.responseText
	}
}


//=====================================================
// Get Releated subcat Paging
function ajax_GetRelVideo_subcatpage(subcat_id,page,heading,vdo_limit)
{
	if (heading == 1)
	{
		heading = "Related Videos"
	}
	//alert("before check="+subcat_id)
	//alert(page)
	
	//section_id = document.frm_populatecategories.section_category.checked
	for (i=0;i<5;i++)
	{
		if(document.frm_populatecategories.section_category[i].checked)
		{
			section_id=document.frm_populatecategories.section_category[i].value;
		}
	}
	
	cat_id =  document.frm_populatecategories.cat_id[document.frm_populatecategories.cat_id.selectedIndex].value
	/*if (section_id !=3)
	{
		subcat_id = document.frm_populatecategories.subcat_id[document.frm_populatecategories.subcat_id.selectedIndex].value
	}*/
			
	//alert("after check = "+subcat_id);
	document.getElementById("rel_Videos_div").innerHTML="<div align='center'><br><br><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	//document.getElementById("dyn_heading_div").innerHTML="<div align='left'>"+heading+"</div>";

	var url="getRelVideos_more.asp?sid=" + Math.random() + "&section_id=" +section_id+ "&cat_id=" +cat_id+ "&subcat_id=" +subcat_id+"&vdo_limit=3&Page="+page
	//alert (url)
	xmlHttp_RelVideos_page=GetXmlHttpObject(getRelVideos_page)
	xmlHttp_RelVideos_page.open("GET", url , true)
	xmlHttp_RelVideos_page.send(null)
	return true;
}

function getRelVideos_page()
{
	if ((xmlHttp_RelVideos_page.readyState==4) || (xmlHttp_RelVideos_page.readyState=="complete"))
	{
		document.getElementById("rel_Videos_div").innerHTML=xmlHttp_RelVideos_page.responseText
	}
}



//=====================================================
// Play Video
function showVideo_old(video_id)
{
	//alert(Cat_id);	
	document.getElementById("PlayVideo_div").innerHTML="<div align='center'><br><br><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	var url="PlayVideo.asp?sid=" + Math.random() + "&video_id="+video_id
	xmlHttp_PlayVideo=GetXmlHttpObject(getPlayVideo)
	xmlHttp_PlayVideo.open("GET", url , true)
	xmlHttp_PlayVideo.send(null)
	return true;
}
function getPlayVideo()
{
	if ((xmlHttp_PlayVideo.readyState==4) || (xmlHttp_PlayVideo.readyState=="complete"))
	{
		document.getElementById("PlayVideo_div").innerHTML=xmlHttp_PlayVideo.responseText
		
	}
}




//=====================================================
//whats hot section
function whatsHot(videoid,section_id)
{
	document.getElementById("whatshot_div").innerHTML="<div align='center'><br><br><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	var url="whatshot.asp?sid=" + Math.random() + "&videoid=" + videoid+"&section_id="+section_id
	xmlHttp_whatshot=GetXmlHttpObject(getWhatsHot)
	xmlHttp_whatshot.open("GET", url , true)
	xmlHttp_whatshot.send(null)
	return true;
}
function getWhatsHot()
{
	if ((xmlHttp_whatshot.readyState==4) || (xmlHttp_whatshot.readyState=="complete"))
	{
		document.getElementById("whatshot_div").innerHTML=xmlHttp_whatshot.responseText
		
	}
}
//end of what's hot section

//=====================================================
//Featuredvideos
function featuredVideos(videoid,section_id)
{
	//alert("section_id="+section_id)
	//alert("videoid="+videoid)
	document.getElementById("featured_videos_div").innerHTML="<div align='center'><br><br><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	var url="featuredvideos.asp?sid=" + Math.random() + "&videoid=" + videoid + "&section_id=" + section_id
	xmlHttp_featuredvideos=GetXmlHttpObject(getFeaturedVideos)
	xmlHttp_featuredvideos.open("GET", url , true)
	xmlHttp_featuredvideos.send(null)
	return true;
}

function getFeaturedVideos()
{
	if ((xmlHttp_featuredvideos.readyState==4) || (xmlHttp_featuredvideos.readyState=="complete"))
	{
		document.getElementById("featured_videos_div").innerHTML=xmlHttp_featuredvideos.responseText
	}
}

//============================================================
// Bottom Panel - onload

function handlebottom(limit_count)
{
	//alert("weekly")
	document.getElementById("bottomcontent").innerHTML="<div align='center' class=tx><br><br><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	var url="bottompanel.asp?sid=" + Math.random()+"&limit_count=0"
	xmlHttp_bottompanel=GetXmlHttpObject(getBottompanel)
	xmlHttp_bottompanel.open("GET", url , true)
	xmlHttp_bottompanel.send(null)
	return true;
}

function getBottompanel()
{
	if ((xmlHttp_bottompanel.readyState==4) || (xmlHttp_bottompanel.readyState=="complete"))
	{
		document.getElementById("bottomcontent").innerHTML=xmlHttp_bottompanel.responseText
	}
}
//=================================================
// For All time
function handlebottom_alltime(limit_count)
{
	//alert("alltime")
	document.getElementById("bottomcontent").innerHTML="<div align='center' class=tx><br><br><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	var url="bottompanel1.asp?sid=" + Math.random()+"&limit_count=0"
	xmlHttp_bottompanel_alltime=GetXmlHttpObject(getBottompanel_alltime)
	xmlHttp_bottompanel_alltime.open("GET", url , true)
	xmlHttp_bottompanel_alltime.send(null)
	return true;
}

function getBottompanel_alltime()
{
	if ((xmlHttp_bottompanel_alltime.readyState==4) || (xmlHttp_bottompanel_alltime.readyState=="complete"))
	{
		document.getElementById("bottomcontent").innerHTML=xmlHttp_bottompanel_alltime.responseText
	}
}



// for bottom panel most viewed commented etc

// Populate Category
function getmostpopular(criteria,limit_count)
{
	//alert(criteria);
	var url="bottompanel.asp?sid=" + Math.random() + "&criteria="+criteria+"&limit_count="+limit_count
	//alert(url);
	xmlHttp_getmostpopular=GetXmlHttpObject(getmostpopular2)
	xmlHttp_getmostpopular.open("GET", url , true)
	xmlHttp_getmostpopular.send(null)
	return true;
}
function getmostpopular2()
{
	if ((xmlHttp_getmostpopular.readyState==4) || (xmlHttp_getmostpopular.readyState=="complete"))
	{
		document.getElementById("bottomcontent").innerHTML=xmlHttp_getmostpopular.responseText

	}
}

//weekly top


// Populate Category
function getmostpopular1(criteria,limit_count)
{
	//alert(criteria);
	var url="bottompanel1.asp?sid=" + Math.random() + "&criteria="+criteria+"&limit_count="+limit_count
	//alert(url);
	xmlHttp_getmostpopular1=GetXmlHttpObject(getmostpopular3)
	xmlHttp_getmostpopular1.open("GET", url , true)
	xmlHttp_getmostpopular1.send(null)
	return true;
}
function getmostpopular3()
{
	if ((xmlHttp_getmostpopular1.readyState==4) || (xmlHttp_getmostpopular1.readyState=="complete"))
	{
		document.getElementById("bottomcontent").innerHTML=xmlHttp_getmostpopular1.responseText

	}
}




//=============================================================
// Search Videos
function ajax_GetSearchVideo(txt_search,pageno)
{
	//alert(pageno)
	heading_name = "You Searched"
	//alert("heading_name="+heading_name)
	document.getElementById("RelVideos_div").innerHTML="<div align='center'><br><br><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	//document.getElementById("dyn_heading_div").innerHTML="<div align='left'>"+heading_name+" - "+txt_search+"</div>";

	var url="getSearchVideo.asp?sid=" + Math.random() +"&txt_search=" + txt_search +"&vdo_limit=3&Page=" + pageno
	xmlHttp_SearchVideo=GetXmlHttpObject(getSearchVideo)
	xmlHttp_SearchVideo.open("GET", url , true)
	xmlHttp_SearchVideo.send(null)
	return true;
}

function getSearchVideo()
{
	if ((xmlHttp_SearchVideo.readyState==4) || (xmlHttp_SearchVideo.readyState=="complete"))
	{
		document.getElementById("RelVideos_div").innerHTML=xmlHttp_SearchVideo.responseText
	}
}

//=============================================================


//=============================================================
// Search Videos
function ajax_GetSearchVideo1(txt_search,pageno,txt_tags)
{
	//alert(pageno)
	heading_name = "You Searched"
	//alert("heading_name="+heading_name)
	document.getElementById("searchVideos_div").innerHTML="<div align='center'><br><br><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	//document.getElementById("dyn_heading_div").innerHTML="<div align='left'>"+heading_name+" - "+txt_search+"</div>";

	var url="getSearchVideo.asp?sid=" + Math.random() +"&txt_search=" + txt_search +"&vdo_limit=3&Page=" + pageno+"&txt_tags="+txt_tags
	xmlHttp_SearchVideo=GetXmlHttpObject(getSearchVideo)
	xmlHttp_SearchVideo.open("GET", url , true)
	xmlHttp_SearchVideo.send(null)
	return true;
}

function getSearchVideo()
{
	if ((xmlHttp_SearchVideo.readyState==4) || (xmlHttp_SearchVideo.readyState=="complete"))
	{
		document.getElementById("searchVideos_div").innerHTML=xmlHttp_SearchVideo.responseText
	}
}

//=============================================================

// Tags Videos

function ajax_GetTagVideo(txt_tags)
{
	hideMe();
	heading_name = "Tag Search - "
	//alert("txt_tags="+txt_tags)
	document.getElementById("RelVideos_div").innerHTML="<div align='center'><br><br><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	//document.getElementById("dyn_heading_div").innerHTML="<div align='left'>"+heading_name+" - "+txt_search+"</div>";

	var url="getSearchVideo.asp?sid=" + Math.random() +"&txt_tags=" + txt_tags +"&vdo_limit=3"
	xmlHttp_SearchVideo=GetXmlHttpObject(getSearchVideo)
	xmlHttp_SearchVideo.open("GET", url , true)
	xmlHttp_SearchVideo.send(null)
	return true;
}

function getSearchVideo()
{
	if ((xmlHttp_SearchVideo.readyState==4) || (xmlHttp_SearchVideo.readyState=="complete"))
	{
		document.getElementById("RelVideos_div").innerHTML=xmlHttp_SearchVideo.responseText
	}
}






//=============================================================
// Get video details


isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");  
  hotDog=isIE ? event.srcElement : e.target;  
  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
    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);
  }
}
//alert(screen.width)
screen_width = screen.width
//alert(screen_width)
function hideMe(){
  if (isIE||isNN) whichDog.style.visibility="hidden";
  else if (isN4) document.theLayer.visibility="hide";
}

function showMe(){
  if (isIE||isNN){ whichDog.style.visibility="visible";}
  else if (isN4) {document.theLayer.visibility="show";}
}

document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");

function showVideo1(vid)
{
	//alert(vid)
	var url="detect.asp?sid=" + Math.random() +"&videoid=" + vid +"&screen_width=" + screen_width
	//var url="playvideo.asp?sid=" + Math.random() +"&videoid=" + vid +"&screen_width=" + screen_width
	//alert(url)
	xmlHttp_PlayVideo=GetXmlHttpObject(getPlayVideo)
	xmlHttp_PlayVideo.open("GET", url , true)
	xmlHttp_PlayVideo.send(null)
	return true;
}


function showVideo_detect(vid,screen_width)
{
	//alert(vid)
	//return false;
	//var url="detect/detect.asp?sid=" + Math.random() +"&videoid=" + vid +"&screen_width=" + screen_width
	var url="playvideo.asp?sid=" + Math.random() +"&videoid=" + vid +"&screen_width=" + screen_width
	//alert(url)
	xmlHttp_PlayVideo=GetXmlHttpObject(getPlayVideo)
	xmlHttp_PlayVideo.open("GET", url , true)
	xmlHttp_PlayVideo.send(null)
	return true;
}



function showVideo(vid)
{
	//alert(vid)
	var url="playvideo.asp?sid=" + Math.random() +"&videoid=" + vid+"&play_status=yes"+"&screen_width=" + screen_width
	//alert(url)
	window.location.href=url
	//window.scrollTo(0,0);
	//alert("here");
	//xmlHttp_PlayVideo=GetXmlHttpObject(getPlayVideo)
	//xmlHttp_PlayVideo.open("GET", url , true)
	//xmlHttp_PlayVideo.send(null)
	//return true;
}

function getPlayVideo()
{
	if ((xmlHttp_PlayVideo.readyState==4) || (xmlHttp_PlayVideo.readyState=="complete"))
	{
		document.getElementById("videoplayer").innerHTML=xmlHttp_PlayVideo.responseText
	}
}

//=====================================================
// Upload Populate Category
function upload_populatecategories(section_id)
{
	//alert(section_id);	
	//document.getElementById("getCategory_div").innerHTML="<div align='center'><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	//document.getElementById("upload_getSubCategory_div").innerHTML="<div align='center' style='height:22px;'>Pick your category</div>";
	var url="upload_getCategory.asp?sid=" + Math.random() + "&section_id="+section_id
	//alert(url);
	xmlHttp_upload_getCategory=GetXmlHttpObject(upload_getCategory)
	xmlHttp_upload_getCategory.open("GET", url , true)
	xmlHttp_upload_getCategory.send(null)
	return true;
}
function upload_getCategory()
{
	if ((xmlHttp_upload_getCategory.readyState==4) || (xmlHttp_upload_getCategory.readyState=="complete"))
	{
		document.getElementById("upload_getCategory_div").innerHTML=xmlHttp_upload_getCategory.responseText
		
	}
}


//=====================================================
// Populate Sub Category
function upload_PopulateSubCategories(Cat_id)
{
	//alert(Cat_id);	
	//document.getElementById("getSubCategory_div").innerHTML="<div align='center'><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
		
	var url="getSubCategory.asp?sid=" + Math.random() + "&Cat_id="+Cat_id +"&section_id=3"
	xmlHttp_upload_getSubCategory=GetXmlHttpObject(upload_getSubCategory)
	xmlHttp_upload_getSubCategory.open("GET", url , true)
	xmlHttp_upload_getSubCategory.send(null)
	return true;
}
function upload_getSubCategory()
{
	if ((xmlHttp_upload_getSubCategory.readyState==4) || (xmlHttp_upload_getSubCategory.readyState=="complete"))
	{
		document.getElementById("upload_getSubCategory_div").innerHTML=xmlHttp_upload_getSubCategory.responseText
		
	}
}













//=====================================================
// Get Direct link
function onload_GetRelVideo(section_id,cat_id,heading)
{
	//alert("in")
	setTimeout("whatsHot(1,1)", 1000);
	setTimeout("featuredVideos(1,1)", 1000);
	setTimeout("ajax_JustAdded(1,7)", 1000);
	setTimeout("showVideo1(vid)", 1000);
	setTimeout("handlebottom(0)", 1000);
	setTimeout("ajax_populatecategories(1)", 1000);
	if (heading == 1)
	{
		heading = "Related Videos"
	}
	
	subcat_id =-1	
	//alert(cat_id);
	document.getElementById("RelVideos_div").innerHTML="<div align='center'><br><br><img src='images/loading1.gif' alt='' width='45' height='5' border='0'></div>";
	//document.getElementById("dyn_heading_div").innerHTML="<div align='left'>"+heading+"</div>";

	var url="getRelVideos.asp?sid=" + Math.random() + "&section_id=" +section_id+ "&cat_id=" +cat_id+ "&subcat_id=" +subcat_id+"&vdo_limit=3"
	//alert (url)
	xmlHttp_RelVideos=GetXmlHttpObject(getRelVideos)
	xmlHttp_RelVideos.open("GET", url , true)
	xmlHttp_RelVideos.send(null)
	return true;
}

function getRelVideos()
{
	if ((xmlHttp_RelVideos.readyState==4) || (xmlHttp_RelVideos.readyState=="complete"))
	{
		document.getElementById("RelVideos_div").innerHTML=xmlHttp_RelVideos.responseText
	}
}




/************************************************************************/
//do not change this code
function GetXmlHttpObject(handler)
{
	//alert(handler);
    var objXmlHttp=null
 
    if (navigator.userAgent.indexOf("Opera")>=0)
    {
        alert("Opera not supported...")
        return;
    }
    if (navigator.userAgent.indexOf("MSIE")>=0)
    {
        var strName="Msxml2.XMLHTTP"
        if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
        {
            strName="Microsoft.XMLHTTP"
        }
        try
        {
            objXmlHttp=new ActiveXObject(strName)
            objXmlHttp.onreadystatechange=handler
            return objXmlHttp
        }
        catch(e)
        {
            alert("Error. Scripting for ActiveX might be disabled")
            return
        }
    }
    if (navigator.userAgent.indexOf("Mozilla")>=0)
    {
        objXmlHttp=new XMLHttpRequest()
        objXmlHttp.onload=handler
        objXmlHttp.onerror=handler
        return objXmlHttp
    }
}




//for enter key

function kp_enterkey()
{
	if (document.layers) document.captureEvents(Event.KEYPRESS); // needed if you wish to cancel the key

document.onkeypress = keyhandler;
function keyhandler(e) 
{
    if (document.layers)
        Key = e.which;
    else
        Key = window.event.keyCode;
    if (Key != 0)
	{
        //alert("Key pressed! ASCII-value: " + Key);
		if (Key==13)
			return false;
		else
			return true;
	}
		
}

} 