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);
}

function test()
{
	alert("test");
}


// Rating images

function ajax_RatingImg(rate_status, reg_id)
{
	//alert("rate_status="+rate_status)
	//alert("reg_id="+reg_id)
	//document.getElementById("rating_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="rate_process.asp?sid=" + Math.random() +"&rate_status=" + rate_status +"&reg_id=" + reg_id 
	xmlHttp_RatingImg=GetXmlHttpObject(getRatingImg)
	xmlHttp_RatingImg.open("GET", url , true)
	xmlHttp_RatingImg.send(null)
	return true;
}

function getRatingImg()
{
	if ((xmlHttp_RatingImg.readyState==4) || (xmlHttp_RatingImg.readyState=="complete"))
	{
		document.getElementById("rating_div").innerHTML=xmlHttp_RatingImg.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;
	}
		
}

} 