function chkDomSupport() {
	
	// Test minimal browser DOM support
	if(!document.getElementById || !document.appendChild || !document.createElement) {
		top.location.href = "/CourtesyPage.aspx?msg=domError";
	}

}

function chkFramesetting() {

	// test permitted standalone pages
	var isLogin = (document.getElementById('boxLogin')) ? true : false;
	var isMessage = (document.getElementById('boxMessage')) ? true : false;
	var isPopup = (document.getElementById('pnlWrapperAlarmHistoryPopup')) ? true : false;
	
	// avoid frameset nesting of login page
	if ( isLogin && top != self) { 
		top.location.href = location.href; 
		// alert('login check: error');
		// } else {
		// alert('login check: OK');	
	}

	// check correct frameset nesting [ menu + working area + status bar ] (excepted login)
	// (1) number of frames
	// (2) parent-child relationship
	// (3) frames that should exist in the index
	// (4) pages has been correctly loaded in frames (DON'T USE: if page loading of menu/statbar has not completed, this page can't find the body id !)
		
	var	frmTest = (top.frames.length == 3) && (top == parent) && (top.frames[0].name == "frmMenugeneral" && top.frames[1].name == "frmWorkingarea" && top.frames[2].name == "frmSystatusbar") // && (top.frames[0].document.body.id == "menuGeneral" && top.frames[3].document.body.id == "syStatusbar");
	if (!isLogin & !isMessage & !isPopup && !frmTest) {
		top.location.href = "/CourtesyPage.aspx?msg=frmError";
		// alert('page check: error');
		// } else {
		// alert('page check: OK');	
	}	

}


		var panel = null;
		var hidden = null;

        // color picker definition
		var colPicker = new Class({	
 
		    initialize: function() 
		    {		
 
                this.pickers = $$('.pnlColorPicker');
                this.ccolors = $$('#palette table.tblColors td');
                this.ccloser = $$('#palette p.closer a');

 
                // assign the behavior to the tabs
			    for (i=0; i<this.pickers.length; i++) 
			    { 
	                this.pickers[i].targetpanel = $('palette'); 
			        this.pickers[i].addEvent('click', this.showpalette.bindAsEventListener(this.pickers[i])); 
		        }
			    
 
                // assign the behavior to the color cells                 
                for (i=0; i<this.ccolors.length; i++) 
                {                 
                    this.ccolors[i].setStyle('cursor', 'pointer');         
		            this.ccolors[i].addEvent('click', this.setcolor.bindAsEventListener(this.ccolors[i]));
                }			    

			    // assign the behavior to the palette closer
                this.ccloser.addEvent('click', function() { $('palette').style.display = "none"; } );    
                   
	            this.ccloser.onclick = function(){return false;}	                
 
		    },

			showpalette: function(){
 
                // move & show color palette
     
	            this.targetpanel.style.left = "5px";   
     
                this.targetpanel.style.top = (this.getPosition().y - $('pnlWrapperHistoricalDataPlantView').getPosition().y) +"px";
     
                this.targetpanel.style.display = "block";

                // assign target objects
				//alert(">>> selected: "+this.id);
				//alert(">>> rel attr:"+this.getAttribute('rel'));
                cpicker = this.id;
 
                chidden = this.getAttribute('rel');
			}, 
 
		
			setcolor: function(){
 
                $(cpicker).style.backgroundColor = this.style.backgroundColor; 
                $(chidden).value = this.style.backgroundColor; 
                $('palette').style.display = "none";
			} 
	
		})