﻿// JScript 文件
function selectTag(showContent,selfObj){
	    
	    //初始
	    document.getElementById("Img_News").src='images/index_news.gif';
	    document.getElementById("Img_Active").src='images/index_act.gif';
	    
	    document.getElementById("tagContent0").style.display = "none";
	    document.getElementById("tagContent1").style.display = "none";
	    
	    if(selfObj=='Img_News')
	    {
	        document.getElementById("Img_News").src='images/index_news_s.gif';
	    }
	    else
	    {
	        document.getElementById("Img_Active").src='images/index_act_s.gif';
	    }
	   
	    document.getElementById(showContent).style.display = "block";
    }


function selectTags(showContent,selfObj){
	    
	    //初始
	    document.getElementById("Img_News").src='../images/dogfans_lb.gif';
	    document.getElementById("Img_Active").src='../images/dogfans_act.gif';
	    
	    document.getElementById("tagContent01").style.display = "none";
	    document.getElementById("tagContent02").style.display = "none";
	    document.getElementById("tagContent11").style.display = "none";
	    document.getElementById("tagContent12").style.display = "none";
	    
	    
	    if(selfObj=='Img_News')
	    {
	        document.getElementById("Img_News").src='../images/dogfans_lb_s.gif';
	    }
	    else
	    {
	        document.getElementById("Img_Active").src='../images/dogfans_act_s.gif';
	    }
	    document.getElementById(showContent+"1").style.display = "block";
	    document.getElementById(showContent+"2").style.display = "block";
    }

<!--
/****************************************************************************************
 * javascript 操作基础函数 
 * 
 * function getHttpRequest()//创建XmlHttpRequest对象
 *
 * function addLoadEvent(func) //多浏览器的页面加载事件
 * 
 * function createTagElement(tagname,father,tagId)
 * 创建一个TAG 
 * @param: tagname:标签名;father:父标签对像;tagId:新GAG的ID 
 * @return 成功时返回创建的对像
 *
 * function selectIsExitItem(objSelect,itemValue) //判断select选项中 是否存在Value="itemValue"的Item 
 * @param objSelect:Select对象 ; itemValue:值 
 * 
 * function addSelectItem(objSelect,itemValue,itemText)//添加select的Item
 * @param objSelect:Select对象 ; itemValue:值; itemText:显示文字
 *
 *****************************************************************************************/
 
//创建XmlHttpRequest对象
function getHttpRequest()
{
	var XmlHttp;

	//Creating object of XMLHTTP in IE
	try
	{
		XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp = null;
		}
	}
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp = new XMLHttpRequest();
	}
	return XmlHttp;
}


  //多浏览器的页面加载事件 
function addLoadEvent(func) {
   if (!window.__load_events) {
	  var init = function () {
		  // quit if this function has already been called
		  if (arguments.callee.done) return;
	 
		  // flag this function so we don't do the same thing twice
		  arguments.callee.done = true;
	 
		  // kill the timer
		  if (window.__load_timer) {
			  clearInterval(window.__load_timer);
			  window.__load_timer = null;
		  }
		 
		  // execute each function in the stack in the order they were added
		  for (var i=0;i < window.__load_events.length;i++) {
			  window.__load_events[i]();
		  }
		  window.__load_events = null;
	  };
  
	  // for Mozilla/Opera9
	  if (document.addEventListener) {
		  document.addEventListener("DOMContentLoaded", init, false);
	  }
	 
	  // for Internet Explorer
	  /*@cc_on @*/
	  /*@if (@_win32)
		  document.write("<scr"+"ipt id=__ie_onload defer src=//0><\/scr"+"ipt>");
		  var script = document.getElementById("__ie_onload");
		  script.onreadystatechange = function() {
			  if (this.readyState == "complete") {
				  init(); // call the onload handler
			  }
		  };
	  /*@end @*/
	 
	  // for Safari
	  if (/WebKit/i.test(navigator.userAgent)) { // sniff
		  window.__load_timer = setInterval(function() {
			  if (/loaded|complete/.test(document.readyState)) {
				  init(); // call the onload handler
			  }
		  }, 10);
	  }
	 
	  // for other browsers
	  window.onload = init;
	 
	  // create event function stack
	  window.__load_events = [];
   }
  
   // add function to event stack
   window.__load_events.push(func);
}

/***********************************************************
    以下为html标记的操作
************************************************************/
   /* 
    * 创建一个TAG 
    * tagname:标签名
    * father:父标签对像
    * tagId:新GAG的ID
    * 成功时返回创建的对像
    */
   function createTagElement(tagname,father,tagId)
   {
      //ID不能重复
      if(document.getElementById(tabId))
      {
    
         return null;
      }
      
      if(father)
      {
        try
        { 
           var newtag = document.createElement(tagname);
           newtat.id = tagId;
           father.appendChild(newtag);
           return newtag;
        }
        catch(exp)
        {            
            return null;
        }
      }
   }    
   
   //判断select选项中 是否存在Value="itemValue"的Item @param objSelect:Select对象 ; itemValue:值 
   function selectIsExitItem(objSelect,itemValue)
   {
        var result = false;
        for(var i = 0; i < objSelect.options.length; i++)
        {
            if(objSelect.options[i].value == itemValue )
            {
                result =true;
            }
        }
        
        return result;
   } 
   
   //添加select的Item @param objSelect:Select对象 ; itemValue:值; itemText:显示文字
   function addSelectItem(objSelect,itemValue,itemText)
   {
       if(objSelect && !selectIsExitItem(objSelect,itemValue))
       {
            var item = new Option(itemText,itemValue)
            if(item)
            {
                objSelect.options.add(item);
            }
       }
   } 
   
   //移除objSelect的值为itemValue的Item
   function removeItme(objSelect,itemValue)
   {
        if(objSelect)
        {
            for(var i = 0; i < objSelect.options.length ;i++)
            {
                if(objSelect.options[i].value == itemValue)
                {
                    objSelect.removeAt(i);
                }
            }
        }
   }
   
   //选中objSelect第一个value=itemValue的项
   function selectItemByValue(objSelect, itemValue)
   {
        if(objSelect)
        {
            for(var i = 0; i < objSelect.options.length; i++)
            {
                if(objSelect.options.value == itemValue)
                {
                    objSelect.options[i].select = "select";
                    break;
                }
            }
        }
   }                
                           
//-->
function getDomanNum()
    {
      return Math.round(Math.random()*500);
    }