﻿// JScript 文件
//window.onload = TXCMSStart;
//window.onresize=AutoHeight;

var ctr = 0;


function TXCMSStart()
{
    MaxWindow();
    //AutoHeight();
}

function MaxWindow()
{
    window.moveTo(0,0);   
	window.resizeTo(screen.width,screen.height);
}

function AutoHeight()
{
    alert(ctr);
    if(ctr > 0 )
    {
        return;
    }
    if(document.getElementById("manage_left") == null)
        return;
    var topheight = 30;
    if (navigator.appName != "Microsoft Internet Explorer")
    {
        if(document.body.scrollHeight < 40)
            return;
        document.getElementById("manage_left").style.height=document.body.scrollHeight+"px";
        document.getElementById("manage_main").style.height=(document.body.scrollHeight-topheight)+"px";
        
    }
    else
    {
        if(document.body.scrollHeight < 40)
            return;
        document.getElementById("manage_main").style.height=document.body.scrollHeight-topheight;
    }
    ctr=1;
}

function AddTitleImage()
{

    var oEditor = FCKeditorAPI.GetInstance('addinfo1_ctl00_fvCMS_content');
    var hfdTitleImage = document.getElementById("addinfo1_ctl00_fvCMS_hfdTitleImage");
    if(oEditor.EditorDocument == null || oEditor.EditorDocument.body.getElementsByTagName("img").length <= 0)
    {
        hfdTitleImage.value = "";
        return;
    }
    var imgobj = oEditor.EditorDocument.body.getElementsByTagName("img");
    var drpTitleImage = document.getElementById("addinfo1_ctl00_fvCMS_drpTitleImage");
    
    drpTitleImage.options.length = 0;
        
    drpTitleImage.options.add(new Option("请选择标题图片",""));
    for(i=0;i<imgobj.length;i++)
    {
        drpTitleImage.options.add(new Option(imgobj[i].src,imgobj[i].src));
    }
}

function AddTitleImage_()
{
    var oEditor = FCKeditorAPI.GetInstance('addinfo1_ctl00_fvCMS_content') ;
    var hfdTitleImage = document.getElementById("addinfo1_ctl00_fvCMS_hfdTitleImage");
    if(oEditor.EditorDocument == null || oEditor.EditorDocument.body.getElementsByTagName("img").length <= 0)
    {
        hfdTitleImage.value = "";
        return;
    }
    var imgobj = oEditor.EditorDocument.body.getElementsByTagName("img");
    var drpTitleImage = document.getElementById("addinfo1_ctl00_fvCMS_drpTitleImage");
    
    if (imgobj.length != 0)
        hfdTitleImage.value = drpTitleImage.options[drpTitleImage.selectedIndex].text;
//alert(drpTitleImage.options[drpTitleImage.selectedIndex].text);
}

function selectAll()   
{
  for(i=0;i<document.getElementsByTagName("*").length;i++)   
  {   
      //if(document.getElementsByTagName("input")[i].id == "showeditor" || document.getElementsByTagName("div")[i].id == "showeditor_")
      //{
        alert(document.getElementsByTagName("*")[i].id);
      //}
  }   
  return false;   
}

function ShowSleep()
{
    alert('asdf');
}

