var ns4 = (document.layers)?true:false;
var ie = (document.styleSheets && document.all)?true:false;
var ns6 = (document.getElementById && !document.all)?true:false;
var opera = (document.all && !document.styleSheets)?true:false;
var os_win = (navigator.appVersion.indexOf('Win') != -1)?true:false;
var IE = document.all?true:false;

var MSPNet=new Object();
MSPNet.fadingTime=null;
var thePosH,dimxH,DimxH=Array(),timeH;
MSPNet.detailSearchFade=function(callObj){
	var divObj=document.getElementById("dvExtendedSearchBox");
	if(divObj.style.display=="none"){
		divObj.style.height="1px";
		divObj.style.display="block";
		if(callObj.firstChild.src){callObj.firstChild.src="images/buttons/btn_detailsearch_disabled.gif";}
		thePosH=(document.getElementById("dvExtendedSearchValues").offsetHeight + 10);
		DimxH["SearchFading"]=0;
		MSPNet.fadingTime = setTimeout("MSPNet.detailSearchFadeOut()",0);
	}else{
		if(callObj.firstChild.src){callObj.firstChild.src="images/buttons/btn_detailsearch.gif";}
		thePosH=0;
		DimxH["SearchFading"]=(document.getElementById("dvExtendedSearchValues").offsetHeight+10);
		MSPNet.fadingTime = setTimeout("MSPNet.detailSearchFadeIn()",0);
	}
}

MSPNet.detailSearchFadeOut=function(){
	var divObj=document.getElementById("dvExtendedSearchBox");
	var targetObj=document.getElementById("dvExtendedSearchValues");
	MSPNet.fadingTime	= setTimeout("MSPNet.detailSearchFadeOut()",0);		
	dimxH = (os_win) ? Math.round(DimxH["SearchFading"]+=((thePosH)-DimxH["SearchFading"])*3/10) : Math.round(DimxH["SearchFading"]+=((thePosH)-DimxH["SearchFading"])*3/5);
	divObj.style.height = dimxH+"px";
	if (thePosH == dimxH)	clearTimeout(MSPNet.fadingTime);
}
MSPNet.detailSearchFadeIn=function(){
	var divObj=document.getElementById("dvExtendedSearchBox");
	MSPNet.fadingTime	= setTimeout("MSPNet.detailSearchFadeIn()",0);		
	dimxH = (os_win) ? Math.round(DimxH["SearchFading"]+=((thePosH)-DimxH["SearchFading"])*3/15) : Math.round(DimxH["SearchFading"]+=((thePosH)-DimxH["SearchFading"])*3/5);
	divObj.style.height = dimxH+"px";
	if(divObj.offsetHeight == 0 || thePosH == dimxH){
		divObj.style.display="none";
		clearTimeout(MSPNet.fadingTime);
	}
}

var keylist="abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
MSPNet.giveMeTempName=function(intLen){
	var temp="";
	for (var i=0;i<intLen;i++){temp+=keylist.charAt(Math.floor(Math.random()*keylist.length));}
	return temp;
}
MSPNet.findPosX = function(obj){
	var curleft = 0;
	if (obj.offsetParent){while (obj.offsetParent){curleft += obj.offsetLeft;obj = obj.offsetParent;};}else if (obj.x){curleft += obj.x;}
	return curleft;
}
MSPNet.findPosY = function(obj){
	var curtop = 0;
	if (obj.offsetParent){while (obj.offsetParent){curtop += obj.offsetTop;obj = obj.offsetParent;};}else if (obj.y){curtop += obj.y;}
	return curtop;
}


MSPNet.imgDivObj=Array();
MSPNet.imgDefaultWidth=Array();
MSPNet.imgDivObjDefalutBottom=Array();
MSPNet.resizeTimer=null;
var lc=0;
MSPNet.doPreviewImage=function(callObjId,srcObj,authID,tstBool){
	var callObj=document.getElementById(callObjId);
  if(MSPNet.resizeTimer!=null){return false;}
	var parentObj=document.getElementById("dvContentContainer");
	var virtualObj=document.createElement("div");
	var tempStr=authID;
	if(!document.getElementById("ImagePreviewContainer_" + tempStr)){
		virtualObj.id="ImagePreviewContainer_" + tempStr;
		virtualObj.className="dvImageViewCont";
		virtualObj.style.display="block";
		virtualObj.innerHTML="<a href=\"#\" onclick=\"MSPNet.doMinimizeImage('ImagePreviewContainer_" + tempStr + "'," + callObj.offsetWidth + ",true);return false;\" onfocus=\"blur();\"><img src=\"" + srcObj + "\" border=\"0\" alt=\"\" id=\"img_" + tempStr + "\"><\/a>"; 
		document.getElementsByTagName("BODY")[0].appendChild(virtualObj);
	}
	if(document.getElementById("img_" + tempStr).complete == false){
		setTimeout("MSPNet.doPreviewImage('" + callObjId + "','" + srcObj + "','" + authID + "','true')",0);
	}else{
		MSPNet.imgDivObj[authID]=document.getElementById("ImagePreviewContainer_" + tempStr);
		MSPNet.imgDefaultWidth[authID]=MSPNet.imgDivObj[authID].firstChild.firstChild.offsetWidth;
		MSPNet.imgDivObj[authID].style.top=parseInt(MSPNet.findPosY(callObj)) + "px";
		MSPNet.imgDivObj[authID].style.left=parseInt(MSPNet.findPosX(callObj)) + "px";
		MSPNet.imgDivObj[authID].style.display="block";
		MSPNet.imgDivObjDefalutBottom[MSPNet.imgDivObj[authID].id]=(parseInt(MSPNet.findPosY(callObj)) + callObj.offsetHeight);
		MSPNet.imgDivObj[authID].firstChild.firstChild.style.width=callObj.offsetWidth + "px";
		thePosH=MSPNet.imgDefaultWidth[authID];
		DimxH["ResizeFading"]=callObj.offsetWidth;
		MSPNet.resizeTimer=setTimeout("MSPNet.doMaximizeImage('" + MSPNet.imgDivObj[authID].id + "'," + MSPNet.imgDefaultWidth[authID] + ",'img_" + tempStr + "')",0);
	}
}
MSPNet.doMaximizeImage=function(tObjId,tObjWidth,tImgObj){
	var targetObj=document.getElementById(tObjId);
	MSPNet.resizeTimer = setTimeout("MSPNet.doMaximizeImage('" + tObjId + "'," + tObjWidth + ",'" + tImgObj + "')",0);	
	dimxH = (os_win) ? Math.round(DimxH["ResizeFading"]+=((thePosH)-DimxH["ResizeFading"])*3/10) : Math.round(DimxH["ResizeFading"]+=((thePosH)-DimxH["ResizeFading"])*3/5);
	targetObj.firstChild.firstChild.style.width = dimxH+"px";
	targetObj.style.top=(MSPNet.imgDivObjDefalutBottom[tObjId] - targetObj.firstChild.firstChild.offsetHeight) + "px";
	if(targetObj.offsetWidth>=tObjWidth || thePosH == dimxH){
		clearTimeout(MSPNet.resizeTimer);
		MSPNet.resizeTimer=null;
	}
}
MSPNet.doMinimizeImage=function(tObjId,tObjWidth,isFirstLoop){
  if(isFirstLoop && MSPNet.resizeTimer!=null){return false;}
	var targetObj=document.getElementById(tObjId);
	MSPNet.resizeTimer = setTimeout("MSPNet.doMinimizeImage('" + tObjId + "'," + tObjWidth + ",false)",0);	
	if(targetObj.firstChild.firstChild.offsetWidth<=tObjWidth){
		clearTimeout(MSPNet.resizeTimer);
		MSPNet.resizeTimer=null;
		targetObj.style.display="none";
		document.getElementsByTagName("BODY")[0].removeChild(targetObj);
		return;
	}else if(isFirstLoop){
		thePosH=tObjWidth;
		DimxH["ResizeFading"]=targetObj.firstChild.firstChild.offsetWidth;
	}
	dimxH = (os_win) ? Math.round(DimxH["ResizeFading"]+=((thePosH)-DimxH["ResizeFading"])*3/15) : Math.round(DimxH["ResizeFading"]+=((thePosH)-DimxH["ResizeFading"])*3/5);
	targetObj.firstChild.firstChild.style.width = dimxH+"px";
	targetObj.style.top=(MSPNet.imgDivObjDefalutBottom[tObjId] - targetObj.firstChild.firstChild.offsetHeight) + "px";
}

	function getHeight(divID,divAct){
		
		divAct=(parseInt(document.getElementById(divID).style.height)==9) ? true : false;
		objDivID=divID;
		thePosH=(divAct) ? 259 : 9;
		dmxHeight();		
		document.getElementById(objDivID+"_IconDown").style.display=(divAct) ? "none" : "inline";
		document.getElementById(objDivID+"_IconUp").style.display=(divAct) ? "inline" : "none";
		
	}
	
	function dmxDown(){
		timeH	= setTimeout("dmxHeight()",0);		
		dimxH = (os_win) ? Math.round(DimxH[objDivID]+=((thePosH)-DimxH[objDivID])*3/35) : Math.round(DimxH[objDivID]+=((thePosH)-DimxH[objDivID])*3/5);
		document.getElementById(objDivID).style.height = dimxH+"px";
		if (thePosH == dimxH)	clearTimeout(timeH);
	}