﻿
hideOrShow = function(tagId)
{
    var tag = document.getElementById(tagId);
    //obj.classSave is the attribute to hold the normal css-class.
    //when a hidden folder is going to be expanded,this css-class could be used.
    if(tag!=null&&tag.id!="content1"&&tag.id!="content2"&&tag.id!="content3")
    {
	    if(tag.style.display=="")
	    {
		    tag.style.display = "none";
	    }
	    else
	    {
		    tag.style.display = "";
	    }
    }
	
	else if(tag!=null&&tag.id=="content1")
    {
	    if(tag.style.display=="")
	    {
		    tag.style.display = "";
	    }
	    else
	    {
		    tag.style.display = "";
			tag = document.getElementById('content2');
			tag.style.display = "none";
			tag = document.getElementById('content3');
			tag.style.display = "none";
	    }
    }
	
	 else if(tag!=null&&tag.id=="content2")
    {
	    if(tag.style.display=="")
	    {
		    tag.style.display = "";
			
	    }
	    else
	    {
		    tag.style.display = "";
		    tag = document.getElementById('content1');
			tag.style.display = "none";
			tag = document.getElementById('content3');
			tag.style.display = "none";
			
	    }
    }
	 else if(tag!=null&&tag.id=="content3")
    {
	    if(tag.style.display=="")
	    {
		    tag.style.display = "";
			
	    }
	    else
	    {
		    tag.style.display = "";
		    tag = document.getElementById('content2');
			tag.style.display = "none";
			tag = document.getElementById('content1');
			tag.style.display = "none";
	    }
    }
	

    else
    {
	    alert("the controller or the folder has not been assigned!");
    }	
}

function swaptab(tabid)
{
	 var tab = document.getElementById(tabid);
	 if(tab!=null)
	 {
		 if (tabid=="1")
		 {
			// tab.style.backgroundImage = "url(images/tab_f.jpg)"; 
			tab.style.background= "url(App_Themes/Default/images/index/bg_inx_2.gif)"; 
			var tab = document.getElementById('2');
			tab.style.background= "url(App_Themes/Default/images/index/bg_inx_1.gif)"; 
			var tab = document.getElementById('3');
			tab.style.background= "url(App_Themes/Default/images/index/bg_inx_1.gif)"; 
			hideOrShow('content1');
		}
		 if (tabid=="2")
		 { 
			 tab.style.background= "url(App_Themes/Default/images/index/bg_inx_2.gif)"; 
			 var tab = document.getElementById('1');
			 tab.style.background= "url(App_Themes/Default/images/index/bg_inx_1.gif)"; 
			 var tab = document.getElementById('3');
			 tab.style.background= "url(App_Themes/Default/images/index/bg_inx_1.gif)"; 

			 hideOrShow('content2');
		}
		 if (tabid=="3")
		 { 
			 tab.style.background= "url(App_Themes/Default/images/index/bg_inx_2.gif)";  
			 var tab = document.getElementById('1');
			 tab.style.background= "url(App_Themes/Default/images/index/bg_inx_1.gif)"; 
			 var tab = document.getElementById('2');
			 tab.style.background= "url(App_Themes/Default/images/index/bg_inx_1.gif)"; 
			 hideOrShow('content3');
		}
		
	}
	else
	{
		alert("the controller or the folder has not been assigned!");
	}
}

function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}

<!--
//图片按比例缩放
function DrawImage(ImgD){
var flag=false;
var image=new Image();
var iwidth = 100; //定义允许图片宽度
var iheight = 100; //定义允许图片高度
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= iwidth/iheight){
if(image.width>iwidth){ 
ImgD.width=iwidth;
ImgD.height=(image.height*iwidth)/image.width;
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}

ImgD.alt=image.width+"×"+image.height;
}
else{
if(image.height>iheight){ 
ImgD.height=iheight;
ImgD.width=(image.width*iheight)/image.height; 
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
}
} 
//调用：<img src="图片" onload="javascript:DrawImage(this)">
//-->