// JavaScript Document
function ShowHide(id)
{
	if (document.getElementById(id).style.display=="none")
	{
		document.getElementById(id).style.display="block";
	}
	else
	{
		document.getElementById(id).style.display="none";
	}
}
function Toggle(id,count,Prefix)
{
	
	for(var i=0;i<count;i++)
	{
		document.getElementById(Prefix+"title"+i).className="tdBgclsw";
		if ( $("#"+Prefix+i).is(':visible') )
		{
			//$("#"+Prefix+i).hide('fast');
			document.getElementById(Prefix+i).style.display="none";	
			if ( $("#"+Prefix+id).is(':hidden') )
			{
				//$("#"+Prefix+id).fadeIn(50);
				document.getElementById(Prefix+id).style.display="";
				document.getElementById(Prefix+"title"+id).className ="tdBgclsy";
			}	
		}
	}	
}
function GetJsonGqIndex()
{
	$("#GqList").html("<img src='/images/loadingAnimation.gif'/>");
    $.getJSON(
    "GqAshx.php?Rand="+Math.random(),
    function(json){
   	Gqi=0;
	GqStr="";
    $.each(json,function(i){
	GqStr=GqStr+"<li><a href='/"+SelectFolder(json[i].movietype)+"/Video_"+json[i].movietype+"_"+json[i].movieid+".shtml' target='_blank' title='"+json[i].moviename+"'><img src=\""+json[i].pic4+"\" width=\"102\" height='60' title='"+json[i].moviename+"'/></a><br /><a href='/"+SelectFolder(json[i].movietype)+"/Video_"+json[i].movietype+"_"+json[i].movieid+".shtml'>"+json[i].moviename+"</a></li>";
	$("#GqList").html(GqStr);
	Gqi++;	
    })
    });		
}
function SelectFolder(TypeId)
{
	result="movie";
	switch(TypeId)
	{
		case 1:
		{
			result="movie";
			break;
		}
		case 2:
		{
			result="tv";
			break;
		}
		case 3:
		{
			result="cartoon";
			break;
		}
		case 4:
		{
			result="zy";
			break;
		}
		case 5:
		{
			result="sport";
			break;
		}
		case 6:
		{
			result="hd";
			break;
		}
		case 7:
		{
			result="other";
			break;
		}		
	} 
	return result;	
}
var MyController = function(formId, method, url, type, dataType, ajaxError, ajaxSuccess) {
  var form = "#"+formId;
  var qs ="";
  if (window.location.href.indexOf("?")>0){
   qs = window.location.href.substring(location.href.indexOf("?")+1);
  }
  var queryString = "";
  if (formId !=null && formId!="") {
    queryString = $(form).serialize();
    queryString = queryString + "&MN="+method;
  }
  else if (method !=null && method != ""){
    queryString = "MN="+method;
  }
  
  if (qs != null && qs != ""){
    queryString = queryString + "&" + qs;
  }
  $.ajax({
    type: type,
    url: url,
    data: queryString,
    dataType: dataType,
    error: ajaxError,
    success: ajaxSuccess
  });
  
};