// JavaScript Document
function CreateElement(tagName,parent,point,size){
	var e=document.createElement(tagName);
	if(parent)parent.appendChild(e);
	with(e.style){
		if(point){
			position="absolute";
			left=Math.round(point.x)+"px";
			top=Math.round(point.y)+"px";
		}
		if(size){
			width=Math.round(size.width)+"px";
			height=Math.round(size.height)+"px"
		}
	}
	return e;
}
function getElementPosition(elm){
	var p=new Point(elm.offsetLeft,elm.offsetTop);//&& elm.tagName!="BODY"
	elm=elm.offsetParent;
	while(elm ){
		if(elm.offsetLeft)
			p.x+=elm.offsetLeft-elm.scrollLeft;
		if(elm.offsetTop)
			p.y+=elm.offsetTop-elm.scrollTop;	
		elm=elm.offsetParent;
	}
	return p;
}
function FindInChildsTag(tagName,elem){
	if (elem)
		for (var oSrc = elem; oSrc && oSrc!=document.body; oSrc = document.all ? oSrc.parentElement : oSrc.parentNode)
			if (oSrc.tagName==tagName) return oSrc;
	return null;
}
function NoEvent(){	if(window.event){window.event.cancelBubble=true;window.event.returnValue=false;}}
String.prototype.trim = function(){return this.replace(/(^\s*)|(\s*$)/g, "");}
/*var url=msnWebSearchUrl.replace(/\{0\}/,msnSearchDomain);
url=url.replace(/\{1\}/,IOSec.EncodeUrl(what));
url=url.replace(/\{2\}/,IOSec.EncodeUrl(where));
url=url.replace(/\{3\}/,IOSec.EncodeUrl(lat));
url=url.replace(/\{4\}/,IOSec.EncodeUrl(lon));*/
////////////Class Size ////////
function Size(a,b){
	this.width=a;
	this.height=b
}
Size.ZERO=new Size(0,0);
Size.prototype.toString=function(){	return"("+this.width+", "+this.height+")"};
Size.prototype.equals=function(a){
	if(!a)return false;
	return a.width==this.width&&a.height==this.height
}

////////////Class Point ////////
function Point(a,b){
	this.x=a;
	this.y=b
}
Point.ORIGIN=new Point(0,0);
Point.prototype.toString=function(){return"("+this.x+", "+this.y+")"};
Point.prototype.equals=function(p){
	if(!p)return false;
	return p.x==this.x&&p.y==this.y
};

////////////Class Unit ////////
function Unit(){}
Unit.Pixsel=function(a){return Math.round(a)+"px"};
Unit.Point=function(a){return Math.round(a)+"pt"};
Unit.Pica=function(a){return Math.round(a)+"pc"};
Unit.Inch=function(a){return Math.round(a)+"in"};
Unit.Mm=function(a){return Math.round(a)+"mm"};
Unit.Cm=function(a){return Math.round(a)+"cm"};
Unit.Percentage=function(a){return Math.round(a)+"%"};           
Unit.Em=function(a){return Math.round(a)+"em"};           
Unit.Ex=function(a){return Math.round(a)+"ex"};           
Unit.toInt=function(a){parseInt(a)};  

////////////Class EventObject ////////
function EventObject(){}
EventObject.fnk_apply=function(a,fnk){return function(){return fnk.apply(a,arguments)}}
EventObject.fnk_call=function(elem,fnk){return function(e){if(!e)e=window.event;fnk.call(elem,e)}}
EventObject.prototype.addEvent=function (msgtype,elem,callback){
		var c=EventObject.fnk_apply(elem,callback);
		var d="ev__"+msgtype;
		if(this[d])
			this[d].push(c);
		else
			this[d]=[c];
};
EventObject.prototype.attachEvent=function(elem,msgtype,callback){
		 if(elem.attachEvent || elem.addEventListener){
			var e=EventObject.fnk_call(this,callback);
			var d=function(){return e.apply(elem,arguments)};
			if (document.all)
				elem.attachEvent(msgtype,d);
			else
			{
				if(msgtype.length > 0 && msgtype.substring(0,2) == "on")
					msgtype = msgtype.substring(2);
				//elem.addEventListener(msgtype, callback, false); 
				elem.addEventListener(msgtype, d, false); 
			}
				
		}
	}
function CopyTo(arr,stindex,length){
	var narr=new Array();
	if(!length || length==-1 || length>arr.length)
		length=arr.length;
	for(var h=stindex;h<length;h++){
			narr.push(arr[h]);
	}
	return narr;
}
EventObject.prototype.fire=function(msgtype){
	var e="ev__"+msgtype;
	var f=this[e];
	if(f&&f.length>0)
		for(var h=0;h<f.length;h++){
			var i=f[h];
			var arr=CopyTo(arguments,1);
			if(i)try{i.apply(this,arr)}catch(j){}
		}
}	

////////////Class Draging ////////
function Draging(elem,b,c,d){
	this.element=elem;
	this.disabled=false;
	this.draging=false;
	this.lastPoint=new Point(0,0);
	
	this.lastcursor=elem.style.cursor;
	elem.style.position="absolute";
	this.setPos(elem.offsetLeft,elem.offsetTop);
	this.attachEvent(elem,"onmousedown",this.mousedown);
	this.attachEvent(elem,"onmouseup",this.mouseup);
	this.attachEvent(elem,"onmousemove",this.mousemove);
}
Draging.prototype=new EventObject();
Draging.prototype.setPos=function(x,y){
	x=Math.round(x);y=Math.round(y);
	if(this.left!=x||this.top!=y){
		this.left=x;this.top=y;
		with(this.element.style){
			left=Math.round(x)+"px";
			top=Math.round(y)+"px";
		}
		this.fire("move")
	}
};
Draging.prototype.mousedown=function(e){
	if(this.disabled)return false;
	this.draging=true;
	this.fire("mousedown");
	if(e.cancelDrag)return;
	this.lastPoint.x=e.clientX;
	this.lastPoint.y=e.clientY;
	
	this.lastcursor=this.element.style.cursor;
	this.element.style.cursor="move";
	if(this.element.setCapture)
		this.element.setCapture();
	this.fire("dragstart");
	window.event.cancelBubble=true;
	window.event.returnValue=false
};
Draging.prototype.mousemove=function(e){
	if(!this.draging)return;
	var b=this.left+(e.clientX-this.lastPoint.x);
	var c=this.top+(e.clientY-this.lastPoint.y);
	this.setPos(b,c);
	this.lastPoint.x=e.clientX;
	this.lastPoint.y=e.clientY;
	this.fire("drag");
};
Draging.prototype.mouseup=function(a){
	this.fire("mouseup");
	this.draging=false;
	//detachEvent(this.mouseMoveListener);
	//detachEvent(this.mouseUpListener);
	//this.ab=false;
	//Z(this.element,this.he);
	this.element.style.cursor=this.lastcursor;
	if(document.releaseCapture){
		document.releaseCapture()
	}
	this.fire("dragend");
	/*var b=(new Date()).getTime();
	if(b-this.Vc<=500&&Math.abs(this.za.x-a.clientX)<=2&&Math.abs(this.za.y-a.clientY)<=2){
		fire(this,"click",a)
	}*/
};
Draging.prototype.SetTimeout=function(b,c){
	var f=EventObject.fnk_apply(this,b);
	return window.setTimeout(f,c);
}
Draging.prototype.pan=function(sz){
	if(this.iTimerID)return;
	this.sz=sz;
	this.spt=new Point(this.left,this.top);
	var c=Math.sqrt(sz.width*sz.width+sz.height*sz.height);
	var d=Math.max(5,Math.round(c/20));
	this.grow=new GrowEnumerator(d);
	this.grow.reset();
	this.MoveStep();
}
Draging.prototype.MoveStep=function(){
	var a=this.grow.next();
	
	this.setPos(this.spt.x+this.sz.width*a,this.spt.y+this.sz.height*a);
	if(this.grow.more()){
		this.iTimerID=this.SetTimeout(this.MoveStep,10)
	}else{
		this.iTimerID=null;
		this.sz=null;
		this.spt=null;
		this.grow==null;
	}
};
////////////Class GrowEnumerator  //////// 
function GrowEnumerator(a){
	this.ticks=a;
	this.tick=0
}
GrowEnumerator.prototype.reset=function(){this.tick=0};
GrowEnumerator.prototype.next=function(){
	this.tick++;
	var a=Math.PI*(this.tick/this.ticks-0.5);
	return(Math.sin(a)+1)/2
};
GrowEnumerator.prototype.more=function(){return this.tick<this.ticks};

function Cit_WebDropDownList(){
	this.Element=null;
}
Cit_WebDropDownList.prototype=new EventObject();
Cit_WebDropDownList.prototype.initFilters=function(){
	this.Element.style.filter = "progid:DXImageTransform.Microsoft.Fade(duration=0.1);"
	this.Element.style.filter += " progid:DXImageTransform.Microsoft.Shadow(Direction=135, Strength=3,color=#404040);"
	this.Element.style.zIndex=10000;
}
Cit_WebDropDownList.prototype.IsChild=function(elm){ 
		var e=elm;
		while(e!=null)
		{
			if(this.Element==e)	return true;
			e=e=document.all ? e.parentElement : e.parentNode;
		}
		return false;
	}
Cit_WebDropDownList.prototype.getSize=function(){return new Size(this.Element.offsetWidth,this.Element.offsetHeight)};
Cit_WebDropDownList.prototype.Show=function(){
	if (document.all) {
		var f=this.Element.filters[0];
		if(f)f.Apply(); 
		this.Element.style.display = "";
		if(f)f.Play();
	}
	else
		this.Element.style.display = "";
}
Cit_WebDropDownList.prototype.Hide=function(){this.Element.style.display = "none";}
Cit_WebDropDownList.prototype.setSelectedItem=function(item){}
Cit_WebDropDownList.prototype.getSelectedItem=function(){}
Cit_WebDropDownList.prototype.getText=function(item){}
Cit_WebDropDownList.prototype.getValue=function (item){}
Cit_WebDropDownList.prototype.SelectedNext=function(){}
Cit_WebDropDownList.prototype.SelectedLast=function(){}
Cit_WebDropDownList.prototype.SelectedFirst=function(){}
Cit_WebDropDownList.prototype.SelectedPrev=function(){}
Cit_WebDropDownList.prototype.FindItem=function (itemText){}

