var AdvancedSearch=new CAdvancedSearch();

function CAdvancedSearch() {
	
	this.Show=function(searchpanel, control) {
			var sz=this.getObjectSize(control);
			var pz=this.getObjectPosition(control);
			pz.y+=sz.y;
			this.showObject(searchpanel);
			this.moveTo(searchpanel, pz); 
	}

	this.isCSS=(document.body && document.body.style) ? true : false;
	
	this.isW3C = (this.isCSS && document.getElementById) ? true : false;
	this.isIE4 = (this.isCSS && document.all) ? true : false;
	this.isNN4 = (document.layers) ? true : false;
	this.isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? 
            true : false;


	
	this.getRawObject=function (obj) {
    	if (typeof obj == "string") { return document.getElementById(obj);
    		} else { return obj;}
	}

	// Retrieve the x coordinate of a positionable object
	this.getObjectPosition=function (obj)  {
    	var elem = this.getRawObject(obj);
		var pos=new Object();    
    	var offsetTrail = elem;
    	var offsetLeft = 0;
    	var offsetTop = 0;
    	// account for IE 6 CSS compatibility mode
   		while (offsetTrail) {
        	offsetLeft += offsetTrail.offsetLeft;
        	offsetTop += offsetTrail.offsetTop;
        	offsetTrail = offsetTrail.offsetParent;
    	}
   		if (navigator.userAgent.indexOf("Mac") != -1 && 
        	typeof document.body.leftMargin != "undefined") {
        	offsetLeft += document.body.leftMargin;
        	offsetTop += document.body.topMargin;
    	}
		pos.x=offsetLeft;
		pos.y=offsetTop;
    	return pos;
	}
	
	this.hideObject=function (obj) {
		var elem = this.getObject(obj);
		elem.display='none';
	}
	
	this.showObject=function (obj) {
		var elem = this.getObject(obj);
		elem.display='block';
	}	
   
   
	// Retrieve the rendered width of an element
	this.getObjectSize=function (obj)  {
    	var elem = this.getRawObject(obj);
		//alert(elem.name);
    	var size=new Object();
    	if (elem.offsetWidth) {
        	size.x = elem.offsetWidth;
			size.y = elem.offsetHeight;
    	} else if (elem.clip && elem.clip.width) {
        	size.x = elem.clip.width;
			size.y = elem.clip.height;
    	} else if (elem.style && elem.style.pixelWidth) {
        	size.x = elem.style.pixelWidth;
			size.y = elem.style.pixelHeight;
    	}
    	return size;
	}
   
   this.moveTo=function(obj, pos) {
   		var elem = this.getObject(obj);		
    	if (elem) {
        	if (this.isCSS) {
            elem.left = pos.x;
            elem.top = pos.y;
        	} 
    	}		
   }
   this.getObject=function (obj) {
    	var theObj = this.getRawObject(obj);
    	if (theObj && this.isCSS) {theObj = theObj.style;}
    	return theObj;
	}
}

DatePicker.Param.Months=["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
DatePicker.Param.WeekDay=["Sun","Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
DatePicker.Param.weekend=[0,6];
DatePicker.Param.dateformat="DD/MM/YYYY";
DatePicker.ShowYearButton=false;
datepicker_isHightlight=function(dt, mm, yy) {

var cd=new Date();
if (yy>cd.getFullYear()) {return (false);}
if (yy<cd.getFullYear()) {return (true);}

if (mm>cd.getMonth()) {return (false);}
if (mm<cd.getMonth()) {return (true);}


if (dt>=cd.getDate()) {return (false);}
if (dt<cd.getDate()) {return (true);}
return true;
}


