/*

==================================================================

字符串操作

Trim(string):去除字符串两边的空格

==================================================================

*/

 

/*

==================================================================

LTrim(string):去除左边的空格

==================================================================

*/

function LTrim(str)

{

    var whitespace = new String(" \t\n\r");

    var s = new String(str);

    

    if (whitespace.indexOf(s.charAt(0)) != -1)

    {

        var j=0, i = s.length;

        while (j < i && whitespace.indexOf(s.charAt(j)) != -1)

        {

            j++;

        }

        s = s.substring(j, i);

    }

    return s;

}

 

/*

==================================================================

RTrim(string):去除右边的空格

==================================================================

*/

function RTrim(str)

{

    var whitespace = new String(" \t\n\r");

    var s = new String(str);

 

    if (whitespace.indexOf(s.charAt(s.length-1)) != -1)

    {

        var i = s.length - 1;

        while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)

        {

            i--;

        }

        s = s.substring(0, i+1);

    }

    return s;

}

 

/*
==================================================================
Trim(string):去除前后空格
==================================================================
*/
function Trim(str){
    return RTrim(LTrim(str));
}


function openPlayWindow(url){
	if(url==''){		
		return;
	}
 	var popUpSizeX=805;
	var popUpSizeY=540;
	var popUpLocationX=Math.round((screen.width-popUpSizeX)/2);
	var popUpLocationY=Math.round((screen.height-popUpSizeY)/2);
	if (popUpLocationX<0) popUpLocationX=0;
	if (popUpLocationY<0) popUpLocationY=0;
	var splashWin = window.open(url,'MovieDetail','width='+popUpSizeX+',height='+popUpSizeY+',top='+popUpLocationX+',left='+popUpLocationY+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
	splashWin.focus();
}
function p(id){
 	var popUpSizeX=700;
	var popUpSizeY=500;
	var popUpLocationX=Math.round((screen.width-popUpSizeX)/2);
	var popUpLocationY=Math.round((screen.height-popUpSizeY)/2);
	if (popUpLocationX<0) popUpLocationX=0;
	if (popUpLocationY<0) popUpLocationY=0;
	var splashWin = window.open(id.value,'MovieDetail','width='+popUpSizeX+',height='+popUpSizeY+',top='+popUpLocationX+',left='+popUpLocationY+',toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0');
}

/*function findTopic(movid,movname,movfid,mimage,mplayer,mlang,mintro)
{
	var urlTopic="http://bbs.51tv.net/redirectmovieView.php?movid="+movid +"&movname="+movname+"&movfid="+movfid;
	urlTopic+= "image="+mimage+"&player="+mplayer+"&lang="+mlang+"&intro="+mintro;
	var splashWin = window.open(urlTopic,'_blank','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1');
//self.location.href="http://sb.viewtoo.com/t?/="+aname;
}*/
function findTopic(queryString)
{
	var urlTopic="http://bbs.51tv.net/redirectmovieView.php?"+queryString;
	var splashWin = window.open(urlTopic,'_blank','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1');
//self.location.href="http://sb.viewtoo.com/t?/="+aname;
}
