function flashWrite(url,w,h,id,bg,vars,win){
  var flashStr="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+"<param name='allowScriptAccess' value='always' />"+"<param name='movie' value='"+url+"' />"+"<param name='FlashVars' value='"+vars+"' />"+"<param name='wmode' value='"+win+"' />"+"<param name='menu' value='false' />"+"<param name='quality' value='high' />"+"<param name='bgcolor' value='"+bg+"' />"+"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+"</object>";document.write(flashStr);
}
function openBox(fileSrc,winWidth,winHeight)
{
  var w=(screen.availWidth-winWidth)/2;
  var h=(screen.availHeight-winHeight)/2;

  newParameter="width="+winWidth+",height="+winHeight+",addressbar=no,scrollbars=yes,toolbar=no,top="+h+",left="+w+", resizable=no";
  newWindow=window.open(fileSrc,"a",newParameter);
  newWindow.focus();
}
function modelessDialogShow(url,width,height)
{
  var w=(screen.availWidth-width)/2;
  var h=(screen.availHeight-height)/2;

  return window.showModalDialog(url,window,'dialogWidth:'+width+'px; dialogHeight:'+height+'px; center:1; dialogLeft:'+w+'px; dialogTop:'+h+'px; help:off; resizable:on; status:off;');
}
function newWindow(mypage,myname,w,h,scrolla)
{
  var winl=(screen.availWidth-w)/2;
  var wint=(screen.availHeight-h)/2;
  winprops='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scrolla+',resizable=1,toolbar=yes,statusbar=yes'
  win=window.open(mypage,myname,winprops);
}
function Set_Cookie(name,value,expires,path,domain,secure){
  expires=expires*60*60*24*1000;var today=new Date();var expires_date=new Date(today.getTime()+(expires));var cookieString=name+"="+escape(value)+
  ((expires)?";expires="+expires_date.toGMTString():"")+
  ((path)?";path="+path:"")+
  ((domain)?";domain="+domain:"")+
  ((secure)?";secure":"");document.cookie=cookieString;
}
function bookmark(title,url){
  if(window.sidebar){window.sidebar.addPanel(title,url,"");}
  else if(window.external){window.external.AddFavorite(url,title);}
  else if(window.opera&&window.print){return true;}
}
function getCookie(Name){
  var search=Name+"="
  var CookieString=document.cookie
  var result=null
  if(CookieString.length>0){offset=CookieString.indexOf(search)
  if(offset!=-1){offset+=search.length
  end=CookieString.indexOf(";",offset)
  if(end==-1){end=CookieString.length}
  result=unescape(CookieString.substring(offset,end))}}
  return result;
}
function deleteCookie(Name,Path){setCookie(Name,"Deleted",-1,Path)}
function checkNormalName(strIn)
{
    var str="1234567890@!#$~^%*()+-=\/_|`.,;:?";
    var ok=true;
    for(var j=0;j<strIn.length;j++)
    {
        if(str.indexOf(strIn.charAt(j))>=0)
        {
            ok=false;
            return ok;
        }
    }
    return ok;
}
function checkNormalTitle(strIn)
{
    var str="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghikjlmnopqrstuvwxyz0123456789";
    var ok=false;
    for(var j=0;j<strIn.length;j++)
    {
        if(str.indexOf(strIn.charAt(j))>=0)
        {
            ok=true;
            break;
        }
    }
    return ok;
}
function checkWord(strIn)
{
  var ok=true;
  var mang=strIn.split(" ");

  for(i=0;i<mang.length;i++)
  {
    if(mang[i].length>30)
    {
      ok=false;
      break;
    }
  }
  return ok;
}
function checkNormalAddress(strIn)
{
    var str="@!#$~^%*()+=\|`?";
    var ok=true;
    for(var j=0;j<strIn.length;j++)
    {
        if(str.indexOf(strIn.charAt(j))>=0)
        {
            ok=false;
            return ok;
        }
    }
    return ok;
}
function incHeight(objectName,objectName2,maxHeight)
{
  var currHeight=$(objectName).height();
  currHeight+=55;
  if(currHeight>=maxHeight)
  {
    currHeight=maxHeight;
    $(objectName).focus();
    return false;
  }
  if(objectName!="") $(objectName).height(currHeight);
  if(objectName2!="") $(objectName2).height(currHeight);
}
function decHeight(objectName,objectName2,minHeight)
{
  var currHeight=$(objectName).height();
  if(currHeight<=minHeight)
  {
    currHeight=minHeight;
    $(objectName).focus();
    return false;
  }
  currHeight-=55;
  if(objectName!="") $(objectName).height(currHeight);
  if(objectName2!="") $(objectName2).height(currHeight);
}
function docheck(status,from_)
{
  var list=$(".List :checkbox");
  jQuery.each(list, function(i,val) {
        val.checked=status;
  });
}
function docheckone()
{
  var list=$(".List :checkbox");
  var isChecked=true;
  var chkall=null;
  jQuery.each(list, function(i,val) {
       if(val.name=="chkall") chkall=val;
       else if(val.checked==false && val.name!="chkall")
       {
        isChecked=false;
       }
  });
  chkall.checked=isChecked;
}
function checkDelete()
{
      var list=$(".List :checkbox");
      var isChecked=false;
      jQuery.each(list, function(i,val) {
           if(val.checked==true)
           {
            isChecked=true;
           }
      });
      if(!isChecked)
      {
        alert("Bạn chưa chọn mục tin muốn xóa!!!");
        return false;
      }
      return confirm("Cảnh báo hành động xóa!!! Xóa tin chính sẽ kèm theo hành động xóa tất cả các comment của tin.\n\n Bạn có chắc muốn tiếp tục không?");
}
function returnString(pattern)
{
  var array_id="";
  var list=$(pattern);
  jQuery.each(list, function(i,val) {
       if(val.checked==true)
       {
        array_id+=val.value+",";
       }
  });
  return array_id;
}