/*
code just for jxtv2 version3.0
*/

/**
 * 隐藏或者显示一个id为obj的东东
 */
function ShowOrHide(obj){
  var obj = document.getElementById(obj);
  if(obj.style.display==''){
    obj.style.display='block';
  }else{
  	obj.style.display='';
  }
}

/**
 * 显示播放器，并且播放，并且隐藏图片，2011年2月21日10:15:04兼容原文章系统
 *
 * @author   	Zerolone
 * @version		2008年10月29日9:45:58
 * @param		id			Player的id
 * @param		type		类型，1为Flash，2为MediaPlayer，3为RealPlayer
 * @param		imgid		图片编号
  */	
function ShowPlayer(id, type, imgid){
  var ThePlayer	= document.getElementById(id);
  var TheImg    = document.getElementById(imgid);
  ThePlayer.style.display	= "block";
  TheImg.style.display		= "none";
  
  //Flash
  if(type==1) ThePlayer.play();
  //MediaPlayer
  if(type==2) ThePlayer.controls.play();
  //RealPlayer
  if(type==3) ThePlayer.DoPlay();
}

/**
 * 文章关键字搜索
 */
function checkKeyword(){
  var theKeyword = document.getElementById('keyword').value;
  var theKind    = document.getElementById('kind').value;
  var theCateid  = document.getElementById('cateid').value;
  if(theKeyword=='输入您的搜索关键字..' || theKeyword==''){
	  alert('输入您的搜索关键字..')
  }else{
    //访问一个URL
    window.open('/search_' + theCateid + '_' + encodeURI(theKeyword) + '_' + theKind+'_1.html');
  }
}

/**
 * 显示隐藏节目单
 */
window.addEvent('domready',function(){ 
  var idplaybilldom = $('Idplaybill');
  idplaybilldom.addEvents({
    'mouseenter': function(){
      $('Playbill').setStyle('display', 'block');
    },
    'mouseleave': function(){
      $('Playbill').setStyle('display', '');
    }
  });
});

/**
 * 显示提示信息框
*/
function show_ajax_message(state, txt){
  //设置显示位置
  $('message').setStyle('top',window.getScrollTop());
  
  //提交中
  if(state == 'request'){
    //显示
    $('message').set('text',txt);
    $('message').setStyles({'background-color':'#fffea1','display':'block','opacity':'100'});
  }
  //成功
  else if(state == 'success'){
    $('message').set('text',txt);

    var myMorph = new Fx.Morph('message',{'duration':2000});
    myMorph.start({'opacity': 0,'background-color': '#90ee90'});
  }
  //失败
  else if(state == 'failure'){
    $('message').set('text',txt);

    var myMorph = new Fx.Morph('message',{'duration':2000});
    myMorph.start({'opacity': 0,'background-color': '#ff0000'});
  }
  //取消
  else if(state == 'cancel'){
    $('message').set('text',txt);

    var myMorph = new Fx.Morph('message',{'duration':2000});
    myMorph.start({'opacity': 0,'background-color': '#fffea1'});
  }
}
