/* ---------------------Begin(sre_autocomplete)---------------------------------- *\
 * eMiliue v1.0 Copyright (c) 2010 Sreejon LLC 
 * Contact us at sreejon2006@msn.com
 * This copyright notice MUST stay intact for use.
 *
 * $Revision: 1.0 $

Dependency :	[Meant to work with Sreejon message structure ]
				No dependency

Description :	 

Usage: 
\* ---------------------------------------------------------------------- */
//var sretreelist=new Array();
var sre_autocomplete = {
	Settings: function() {
		this.PageName=SRESelectedPage;
		this.objId='';
		this.tableName='';
		this.fieldName='';
		this.formName='';
		this.autocId='';
		this.List;
		this.addFlag = 0;
		this.addList = function(list) {
			this.List = list;
		};
	},
	
	config: new Array(),
	setSettings: function(n, settings) {
		if(typeof(settings) != "object") {
			this.config[n] = new this.Settings();
		} else {
			this.config[n] = settings;
		}
		this.config[n].autocId = n;
	},
	setPopularity: function(id,strva,func,ajxid){
		//popularity
		//alert(strva);
		msgint='';
		msgint +='<match>'+strva+'</match>';
		msgint +='<table>'+this.config[id].tableName+'</table>';
		msgint +='<field>'+this.config[id].fieldName+'</field>';
		
		action = "/srp/srp_system/sub/sub_autocomplete_popularity.srp";
		srePHPAsyncSubmit(msgint,action,func,true,ajxid,'Y');
		
	},	
	insertNewStr: function(id,strval,func,ajxid){
		if(this.config[id].addFlag != 2){
			msgint='';
			msgint +='<match>'+strval+'</match>';
			msgint +='<table>'+this.config[id].tableName+'</table>';
			msgint +='<field>'+this.config[id].fieldName+'</field>';
			action = "/srp/srp_system/sub/sub_autocomplete_add.srp";
			srePHPAsyncSubmit(msgint,action,func,true,ajxid,'Y');
		}
	},
	checkMatch: function(id,settings,strval,func,ajxid,datacnt) {
		this.setSettings(id, settings);
		this.config[id].addFlag = 0;
		msgint='';
		msgint +='<menuid>'+id+'</menuid>';
		msgint +='<datacount>'+datacnt+'</datacount>';
		dv= this.config[id].formName+'_'+this.config[id].autocId+'_ac';
		msgint +='<divid>'+dv+'</divid>';
		msgint +='<match>'+strval+'</match>';
		msgint +='<table>'+this.config[id].tableName+'</table>';
		msgint +='<field>'+this.config[id].fieldName+'</field>';
		msgint +='<objnum>'+this.config[id].autocId+'</objnum>';
		action = "/srp/srp_system/sub/sub_autocomplete.srp";
		srePHPAsyncSubmit(msgint,action,func,true,ajxid,'Y');
	},	
	autoCompleteLoad: function(respstr,id) {
		mnuList = new Array();
		var done=0;var pos=0;var word="";var ret = 1;var indx=0;
		var wordarray = new Array();
		len = respstr.length;
		sre_core.initializeList(mnuList);
		for(i=pos; i < len && done == 0; i++)	{
			if(respstr.slice(i,i+1)==';')		{
				word = respstr.slice(pos,i);
				if(word !=''){	
					mnuList[mnuList.length] = word;
				}
				pos = i + 1;
				if (word)			{
					wordarray[indx] = word;
					indx++;
				} else {
					ret = 0;
				}
				word=""; 
			}
		}
		word = respstr.slice(pos,i-1);
		if(word !=''){	
			mnuList[mnuList.length] = word;
		}
		wordarray[indx] = word;
		done = 1;
		this.config[id].addList(mnuList);
	
		dv= this.config[id].formName+'_'+this.config[id].autocId+'_ac';
		ht='';
		if(this.config[id].addFlag != 2){
			//alert(this.config[id].addFlag);
		ht +='<div style="position:absolute;z-index:2" >'
			ht +='<table border="0" cellpadding="0" cellspacing="0" style="background-color:rgb(235,235,255)">';
				ht +='<tr>';
					ht +='<td nowrap align="left" style="cursor:pointer;">';	
		ht +='<table>';
			for(xx=0; xx < mnuList.length; xx++){
				if(mnuList[xx] !='') {
					ht +='<tr><td class="menuReg" onclick="sre_autocomplete.nodeClicked(\''+id+'\',\''+mnuList[xx]+'\')"><a href="#">'+mnuList[xx]+'</a></td></tr>';
				}
			}
		ht +='</table>';
					ht +='</td>';				
				ht +='</tr>';
			ht +='</table>';
		ht +='</div>';
		$(dv).innerHTML = ht;
		}
		mnuList = null;
	},
	nodeClicked: function (id,val) {
		//this.setSettings(id, settings);
		dv= this.config[id].formName+'_'+this.config[id].autocId+'_ac';
		$(dv).innerHTML = '';
		this.config[id].addFlag = 2;
		pagename = this.config[id].PageName;
		var str ="";
		str += '_AutoSelect("';
		str += id;
		str += '","';
		str += val;
		str += '")';
		eval( pagename + str);
	}
};
/* -----------------------END(sre_autocomplete)---------------------------------- */



/* ---------------------Begin(sre_scrollpage)---------------------------------- *\
 * eMiliue v1.0 Copyright (c) 2010 Sreejon LLC 
 * Contact us at sreejon2006@msn.com
 * This copyright notice MUST stay intact for use.
 *
 * $Revision: 1.0 $

Dependency :	[Meant to work with Sreejon message structure ]
				No dependency

Description :	 

Usage: 
\* ---------------------------------------------------------------------- */
//var sretreelist=new Array();
var sre_scrollpage = {
	Settings: function() {
		this.PageName=SRESelectedPage;
		this.DivId='';
		this.scrollPageId='';
		this.scrollHeight='';
		this.displayHeight='';
		this.displayWidth='';
		this.backColor='rgb(255,255,255)';
		
	},
	config: new Array(),
	setSettings: function(n, settings) {
		if(typeof(settings) != "object") {
			this.config[n] = new this.Settings();
		} else {
			this.config[n] = settings;
		}
		this.config[n].scrollPageId = n;
	},
	drawScrollPage: function (div,id,setting) {
		this.setSettings(id, setting);
		chhtml='';
		if(this.config[id].displayHeight > this.config[id].scrollHeight) {
		chhtml +='<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" >';
			chhtml +='<tr>';
			w1 = parseInt(this.config[id].displayWidth) +parseInt(20);
				chhtml +='<td colspan="1" valign="top" align="left" width="'+this.config[id].scrollHeight+'"  >';
				    chhtml +='<div id="sreprofclip'+id+'" style="border:0px solid white;height:'+this.config[id].scrollHeight+';overflow:hidden">';
					    chhtml +='<table border="0" cellpadding="0" cellspacing="0" width="'+w1+'" >';//w+20
						    chhtml +='<tr>';
								w2 = parseInt(this.config[id].displayWidth) +parseInt(75);
							    chhtml +='<td width="'+w2+'"  >';//w+75
								    chhtml +='<div id="srepromocontainer'+id+'" style="height:'+this.config[id].scrollHeight+';width:'+this.config[id].displayWidth+';margin-left:auto;margin-right:auto;">';
									    chhtml +='<div id="srepromocontent'+id+'"  style="position:relative;height:'+this.config[id].displayHeight+';width:'+this.config[id].displayWidth+';margin-left:auto;margin-right:auto;"></div>';
								    chhtml +='</div>';
							    chhtml +='</td>';
						    chhtml +='</tr>';
					    chhtml +='</table>';
				    chhtml +='</div>';
				chhtml +='</td>';
				chhtml +='<td valign="top" style="background-color:'+this.config[id].backColor+'">';
					chhtml +='<div id="scrollholderportdash'+id+'" class="scrollholder" style="scrollbar-3dlight-color:#0d1300;scrollbar-arrow-color:#999999;scrollbar-darkshadow-color:#0d1300;scrollbar-face-color:#0d1300;scrollbar-highlight-color:#999999;scrollbar-shadow-color:#999999;scrollbar-track-color:#0d1300;">';
					chhtml +='<div id="scrollportdash'+id+'" class="scroll">';
						chhtml +='<div id="dummycontent'+id+'" style="height:'+this.config[id].displayHeight+'"></div>';
					chhtml +='</div>';
					chhtml +='</div>';
				chhtml +='</td>';					    
			chhtml +='</tr>';
		chhtml +='</table>';
		
		
		$(div).innerHTML=chhtml;
		holder="scrollholderportdash"+id;
		port = "scrollportdash"+id
		ScrollLoad (holder,port , false);
		} else {
			chhtml +='<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" >';
			chhtml +='<tr>';
				chhtml +='<td colspan="1" valign="top" align="left" width="'+this.config[id].scrollHeight+'"  >';
					chhtml +='<div id="srepromocontent'+id+'"  style="position:relative;height:'+this.config[id].displayHeight+';width:'+this.config[id].displayWidth+';margin-left:auto;margin-right:auto;"></div>';
				chhtml +='</td>';					    
			chhtml +='</tr>';
		chhtml +='</table>';
		$(div).innerHTML=chhtml;
		}
	},
	nodeClicked: function (id,indx,foundchild) {
		elem = this.TreeElements[indx];
	//	alert(elem.Desc+'--'+foundchild);
		
		pagename = this.config[id].PageName;
		var str ="";
		str += '_MenuClick("';
		str += id;
		str += '","';
		str += indx;
		str += '","';
		str += foundchild; //Does it have a child
		str += '","';
		str += elem.Desc;
//		str += '","';
//		str += this.config[num].scrollMenucount;
//		str += '","';
//		str += this.config[num].scrollMenuIndex;
		str += '")';
//		//alert(SRESelectedPage+pagename + str);
		eval( pagename + str);
	}
};
/* -----------------------END(sre_scrollpage)---------------------------------- */


/* ---------------------Begin(sre_tree)---------------------------------- *\
 * eMiliue v1.0 Copyright (c) 2010 Sreejon LLC 
 * Contact us at sreejon2006@msn.com
 * This copyright notice MUST stay intact for use.
 *
 * $Revision: 1.0 $

Dependency :	[Meant to work with Sreejon message structure ]
				No dependency

Description :	All Menu rountines needed throughout the system 

Usage: 
\* ---------------------------------------------------------------------- */
//var sretreelist=new Array();
var sre_tree = {
	Settings: function() {
/*		
		
		this.MenuType = 'N';
		this.DivId;
		this.MenuArraySet;
		this.TreeElement;
		this.MenuName = "";
		this.MenuHeader= '';
		this.PageName='';
		this.ShowHeader = 0;
		this.MenuWidth = "200";
		this.MenuHeight = "auto";
		this.BackColor = "ffffee";
		this.HovColor = "DDDDDD";
		this.DropDownPic = "../../../EN/SRESYS/Pic/commonstyle/childc.gif";
		this.hyperDropDownPic = "../../../EN/SRESYS/Pic/commonstyle/childc.gif";
		this.SelectedMenu = "-1";
		this.IconHeight = "12";
		this.IconWidth = "12";
		this.Top=0;
		this.Left=0;
		this.Layer=0;
		this.MenuSelectedCls = "sidemenuSel";
		this.MenuNoChld = "formctl";
		this.MenuChld = "formctl";
		this.MenuHvr = "formctl";
		this.MenuHdr = "formctl";
		this.MenuBk = "formctl";
		this.MenuSubHdr = "formctl";
*/
		this.TreeHeader= '';
		this.ShowHeader = 0;
		this.HeaderCls = 'blkHeader';
		this.showIcon=1;
		this.rowClsArray='';
		this.backclrH='ffffff'; 
		this.TreeId;
		this.MaxLevel=1; 
		this.PageName='';
		this.DivId='';
		this.numElements=0;
		this.TreeArraySet;
		this.TreeElementList;
		this.addTreeArray = function(treeArray) {
				this.TreeArraySet = treeArray;
				this.numElements=this.TreeArraySet.length;
		};
		this.getElementCount=function (){
			return this.numElements;
		};
	},
	config: new Array(),
	TreeElements:  new Array(),
	//TreeExpanded:  new Array(),
	setSettings: function(n, settings) {
		
		if(typeof(settings) != "object") {
			this.config[n] = new this.Settings();
		}
		else {
			this.config[n] = settings;
			
		}
		this.config[n].TreeId = n;
		//sretreelist[sretreelist.length]=n;
	},
	drawTreeObj: function (div,id,setting) {
		if(!this.config[id]){
			this.setSettings(id, setting);
		}
		this.config[id].DivId = div;
		
		this.iniState(id,setting);
		this.fullDrawTree(div,id,setting);
	},
	iniState: function (id,setting){
		this.setSettings(id, setting);
		Words = new Array();
		this.TreeElementList = new Array();
		this.TreeElementList = this.config[id].TreeArraySet;
		if(this.TreeElementList =='undefined') return;
		if(!this.TreeElementList) return;
		
		for(a1 = 0; a1 < this.TreeElementList.length; a1++){
			sre_core.breakWords(this.TreeElementList[a1],Words);
			this.TreeElements[a1] = {
				Indx: a1,
				Code: Words[0],
				Parent: Words[1],
				Desc: Words[2],
				Expanded: Words[3],
				PicPath: Words[4],
				deep: 1
			};
		}
		
	},
	fullDrawTree: function (div,id,setting) {
		htmlt='';rhtml='';dp=0;
		this.setSettings(id, setting);
		
		dsboard = document.getElementById(div);
		//alert(this.config[id].ShowHeader);
		for(var b1 = 0; b1 < this.TreeElementList.length; b1++){
			elem = this.TreeElements[b1];
			if (elem.Parent == '-1'){ // parent node found
				elem.deep = 1;
				dp = this.recurseNode(id,setting,b1,elem.deep,dp);
				//alert(dp);
			}
		}
		this.config[id].MaxLevel = dp;
		//this.config[id].headerDrawn=0; //alert(this.config[id].headerDrawn);
		
		htmlt +='<table border="0"  cellpadding="0" cellspacing="0" width="100%">';
		if (this.config[id].ShowHeader==1){
			htmlt +='<tr class="'+this.config[id].HeaderCls+'"><td colspan="'+(this.config[id].MaxLevel +1 )+'" >';
				htmlt +=this.config[id].TreeHeader;
				htmlt +='</td></tr>';
		}
		
		rhtml =this.recursiveDraw(-1,div,id,setting,rhtml);
		htmlt += rhtml;
		htmlt +='</table>';
		if(dsboard) dsboard.innerHTML = htmlt;
	},
	recurseNode: function (id,setting,nodeindx,de,dpmax) {
		var elem;
		this.setSettings(id,setting);
		for(var p = 0; p < this.TreeElementList.length; p++){
			elem = this.TreeElements[p];
			if (elem.Parent == nodeindx){ // parent node found
				elem.deep = de + 1;
				if(elem.Expanded == 1){
					this.recurseNode(id,setting,p,elem.deep,dpmax)
				}
			}
			if (dpmax < elem.deep) {
				dpmax = elem.deep;
			}
		}
		return dpmax;
	},
	flipExpanded: function (rid,cont,id) {
		//this.setSettings(id,setting);
		for(var q = 0; q < this.TreeElementList.length; q++){
			elem1 = this.TreeElements[q];
			if (this.config[id].MaxLevel < elem1.deep) {
				this.config[id].MaxLevel = elem1.deep;
			}
		}		
		elem = this.TreeElements[rid];
		if (elem.Expanded == 1) {
			elem.Expanded = 0;
		} else {
			elem.Expanded = 1;
		}
		//alert(elem.Expanded);
		this.fullDrawTree (cont,id,this.config[id]);
	},
	nodeClicked: function (id,indx,foundchild) {
		elem = this.TreeElements[indx];
	//	alert(elem.Desc+'--'+foundchild);
		
		pagename = this.config[id].PageName;
		var str ="";
		str += '_MenuClick("';
		str += id;
		str += '","';
		str += indx;
		str += '","';
		str += foundchild; //Does it have a child
		str += '","';
		str += elem.Desc;
//		str += '","';
//		str += this.config[num].scrollMenucount;
//		str += '","';
//		str += this.config[num].scrollMenuIndex;
		str += '")';
//		//alert(SRESelectedPage+pagename + str);
		eval( pagename + str);
	},
/*
function POR_SCROLL_UP_PROFILE(){
	inn = $("sreprofileoutertable");
	contentheight  = inn.style.height;
	if( (sreConvertPxToInt(contentheight) + contenttop) > (winV + 40)  ){
		contenttop = contenttop - 40;
		$("sreprofcontent").style.top = contenttop;
	}
}
function POR_SCROLL_DOWN_PROFILE(){
	inn = $("sreprofcontent");
	if  (sreConvertPxToInt(inn.style.top) < 0) {
		$("sreprofcontent").style.top = parseInt($("sreprofcontent").style.top) + parseInt(40);
		contenttop = sreConvertPxToInt($("sreprofcontent").style.top);
	} 	
}
*/
	recursiveDraw: function (nodeindx,cont,id,setting,htmlrr) {
		var rwid = 0; foundchild=0;
		
		this.setSettings(id,setting);
		htmlrr='';
		for(var q = 0; q < this.TreeElementList.length; q++){
			elem1 = this.TreeElements[q];
			if (this.config[id].MaxLevel < elem1.deep) {
				this.config[id].MaxLevel = elem1.deep;
			}
		}
		for(var i = 0; i < this.TreeElementList.length; i++){
			elem = this.TreeElements[i];
			if(elem.deep == this.config[id].MaxLevel) { //lowest level
				elem.Expanded = 1;
			}
			//foundchild= 0;
			//alert(nodeindx);
			if (elem.Parent == nodeindx){
				//alert(elem.Indx+'--'+i);
				rwid++;
				if (rwid % 2 == 0) {
					backclrH="ffffff";
				} else {
					backclrH="ffffff";			
				}
				htmlrr +='<tr   style="cursor:pointer;font-size:10pt;" id="'+ rwid +'" onclick="sre_tree.flipExpanded('+ elem.Indx +',\'' +cont  +'\',\'' +id  +'\')">';
				//if(elem.Expanded == 1){
					for(var x = 0; x < this.TreeElementList.length; x++){
						elem5 = this.TreeElements[x];
						if (elem5.Parent == i){
							foundchild= 1;
							break;
						}
					}
				//	if((foundchild==1) ){
				//		htmlrr +=this.recursiveDraw(i,cont,id,setting,htmlrr);
				//	} else {
				//	}
				//}
				for(j =1; j < elem.deep + 1 ; j++){
					if (j % 2 == 0) {
						backclrV="ffffff";
					} else {
						backclrV="ffffff";			
					}
					if( j < elem.deep  - 1 ) {
					} else {
						if( j < elem.deep  ) {
							if( j == elem.deep -1 ) {
							}
						} else {
							if( j > elem.deep ) {
							} else {
								for(k =1; k < elem.deep + 1 ; k++){
									htmlrr +='<td width="5">';
									htmlrr +='</td>';
								}
								if(elem.PicPath=='') {
									htmlrr +='<td  colspan ="'+ (parseInt(this.config[id].MaxLevel,10) - parseInt(elem.deep,10) + 1) +'" onclick="sre_tree.nodeClicked(\''+id+'\',\''+elem.Indx+'\','+foundchild+')">';
									if(this.config[id].showIcon == 1){
										if (elem.Expanded == 0){
											htmlrr +='<img src="/EN/SRESYS/Pic/commonstyle/plus.jpg" height="10" width="10">&nbsp;&nbsp;'+  elem.Desc;
										} else {
											htmlrr +='<img src="/EN/SRESYS/Pic/commonstyle/minus.jpg" height="10" width="10">&nbsp;&nbsp;'+  elem.Desc;
										}
									} else {
										if (elem.Expanded == 0){
											htmlrr +='&nbsp;&nbsp;'+  elem.Desc;
										} else {
											htmlrr +='&nbsp;&nbsp;'+  elem.Desc;
										}
									}
									htmlrr +='</td>';
								} else {
									if(elem.PicPath=='undefined'){
										htmlrr +='<td colspan ="'+ (parseInt(this.config[id].MaxLevel,10) - parseInt(elem.deep,10) + 1) +'" onclick="sre_tree.nodeClicked(\''+id+'\',\''+elem.Indx+'\','+foundchild+')">';
										htmlrr +='<span style="width:10;height:10;">&nbsp;</span>&nbsp;&nbsp;'+ elem.Desc;	
										htmlrr +='</td>';										
									} else {
										htmlrr +='<td  colspan ="'+ (parseInt(this.config[id].MaxLevel,10) - parseInt(elem.deep,10) + 1) +'" onclick="sre_tree.nodeClicked(\''+id+'\',\''+elem.Indx+'\','+foundchild+')">';
										htmlrr +='<img src="'+elem.PicPath+'"  style="width:10;height:10;">&nbsp;&nbsp;'+ elem.Desc;
										htmlrr +='</td>';
									}
								}
							}
						}
					}
				}
				htmlrr +='</tr>';
				if(elem.Expanded == 1){
				//	for(var x = 0; x < this.TreeElementList.length; x++){
				//		elem5 = this.TreeElements[x];
				//		if (elem5.Parent == i){
				//			foundchild= 1;
				//			break;
				//		}
				//	}
					if((foundchild==1) ){
						htmlrr +=this.recursiveDraw(i,cont,id,setting,htmlrr);
				//	} else {
					}
				}
			} else {
			}
		}
		//alert(htmlrr);
		return htmlrr;
	}	
};
/* -----------------------END(sre_tree)---------------------------------- */

/* ---------------------Begin(sre_menu)---------------------------------- *\
 * eMiliue v1.0 Copyright (c) 2010 Sreejon LLC 
 * Contact us at sreejon2006@msn.com
 * This copyright notice MUST stay intact for use.
 *
 * $Revision: 1.0 $

Dependency :	[Meant to work with Sreejon message structure ]
				No dependency

Description :	All Menu rountines needed throughout the system 

Usage: 

<div id="area1" style="width:150px;height:300px;"></div>
 ------------
var full = new sre_menu.Settings();
full.MenuHeight = "250px";
full.MenuNoChld = 'blkSmall';
full.MenuChld = 'blkSmall';
full.MenuHeader = 'Imagine';
full.MenuName = 'Menu name';
full.MenuWidth = "250px";
full.MenuHvr = 'Control';
full.PageName = 'test';

var SREDropMenuList = new Array();
SREDropMenuList[0] ="SRV|-1|Services|../../../EN/SRESYS/Pic/cancel.gif";
SREDropMenuList[1] ="FAQ|-1|FAQ|../../../EN/SRESYS/Pic/cancel.gif";
SREDropMenuList[2] ="CON|-1|Contact|../../../EN/SRESYS/Pic/cancel.gif";
SREDropMenuList[3] ="SRV2|1|Services2|../../../EN/SRESYS/Pic/cancel.gif";
SREDropMenuList[4] ="FAQ2|1|FAQ2|../../../EN/SRESYS/Pic/cancel.gif";
SREDropMenuList[5] ="CON2|1|Contact2|../../../EN/SRESYS/Pic/cancel.gif";
SREDropMenuList[6] ="SRV3|2|Services3|../../../EN/SRESYS/Pic/cancel.gif";
SREDropMenuList[7] ="FAQ3|1|FAQ3|../../../EN/SRESYS/Pic/cancel.gif";
SREDropMenuList[8] ="CON3|3|Contact3|../../../EN/SRESYS/Pic/cancel.gif";

full.addMenuArray(SREDropMenuList);

sre_menu.display("area1",'1st',full);  // second param is the menu name

Following events will be supported 
[num manu name, index menu index, code is menu code ]
function [pagename]_MenuCancel(menuname){}
function [pagename]_MenuDblClick(menuname,menuidx,menuCode){}
function [pagename]_MenuOut(num,indx){}
function [pagename]_MenuOver(num,indx){}
function [pagename]_MenuClick(num,indx,code,desc){}

\* ---------------------------------------------------------------------- */
var sremenulist=new Array();
var sremenutypelist=new Array();
var sre_menu = {
	Settings: function() {
		this.MenuId;
		this.MenuType = 'N';
		this.DivId;
		this.MenuArraySet;
		this.TreeElement;
		this.MenuName = "";
		this.MenuHeader= '';
		this.PageName='';
		this.ShowHeader = 0;
		this.MenuWidth = "200";
		this.MenuHeight = "auto";
		this.BackColor = "transparent";
		this.HovColor = "transparent";
		this.DropDownPic = "../../../EN/SRESYS/Pic/commonstyle/drop.gif";
		this.hyperDropDownPic = "../../../EN/SRESYS/Pic/commonstyle/drop.gif";
		this.SelectedMenu = "-1";
		this.SelectedCode = "";
		this.SelectedDesc = "";

		this.IconHeight = "12";
		this.IconWidth = "12";
		this.noPic=0;
		this.Top=0;
		this.Left=0;
		this.Layer=0;
		this.MenuSelectedCls = "menuHyperHeader";
		this.MenuNoChld = "menuHyperHeader";
		this.MenuChld = "menuHyperHeader";
		this.MenuHvr = "menuHyperHeader";
		this.MenuHdr = "menuHyperHeader";
		this.MenuBk = "menuHyperHeader";
		this.MenuSubHdr = "menuHyperHeader";
		this.MenuDropDowndCls = "menuHyperHeader";
		this.picMenuReturn = "../../../EN/SRESYS/Pic/commonstyle/arrow-left.png";
		this.PicPath=' ';
		this.DblClkActive = 1;
		this.hyperDisplay='';
		this.hyperBackCls='';
		this.hyperDisplayCls='menuHyper';
		this.hyperDisplayHdrCls='menuHyperHeader';
		this.dropStatus = 0;
		this.hyperOpacity = 100;
		this.scrollableData = 1;
		this.scrollMenuIndex = 0;
		this.scrollMenucount =5;
		this.pageScroll=0;
		this.fixedScroll=0;
		this.ExpandDiv=0;
		this.ExpandSelective=0;/*need column to have flag*/
		this.ExpandPic="../../../EN/SRESYS/Pic/commonstyle/drop.gif";
		this.ExpandPicWidth=18;
		this.LastExpand=-1;
		this.Sideways=0;
		this.ShowDesc=0;
		//for dataarray
		
		this.msg ='';
		this.action = '';
		this.func ='';
		this.ajxid='';
		this.prev=0;
		this.nxt=0;
		this.totcnt=0;
		this.menuele;
		//this.pagecnt=0;
		this.currsetting;
		this.addMenuArray = function(mnuArray) {
				this.MenuArraySet = mnuArray;
		};
	},
	config: new Array(),
	MenuElements:  new Array(),
	setSettings: function(n, settings) {
		if(typeof(settings) != "object") {
			this.config[n] = new this.Settings();
		}
		else {
			this.config[n] = settings;
			this.config[n].currsetting = settings;
		}
		sremenulist[sremenulist.length]=n;
		sremenutypelist[sremenutypelist.length]='MENU';
	},
	parentClicked:	function (num,cont,objid)	{
		this.refresh(num);
		var parid = -1;
		if(objid == -1) { //go to root
		} else {
			parid = this.MenuElements[objid].Parent;//Parent[objid];
		}
		if(parid > -2)		{	
			if(parid == -1){
				if(this.config[num].Sideways==1){
					this.buildSideTree(cont.id,this.config[num].MenuName,parid,num);
				} else {
					this.buildTree(cont.id,this.config[num].MenuName,parid,num);
				}
				
			} else {
				if(this.config[num].Sideways==1){
					this.buildSideTree(cont.id,this.MenuElements[parid].Desc,parid,num);
				} else {
					this.buildTree(cont.id,this.MenuElements[parid].Desc,parid,num);
				}
			}
		}
	},
	childClicked: function (num,cont,objid)	{
		var Ch=new Array();
		sre_core.initializeList(Ch);
		this.refresh(num);
		for(b=0; b < this.TreeElement.length; b++)	{
			if(this.config[num].menuele[b].Parent == objid)	{
				Ch[Ch.length] = b;
			}
		}
		this.menuCallFunction(num,objid);
		
		if(Ch.length > 0) {
			if(objid >= -2)			{	
				if(objid == -1){
					if(this.config[num].Sideways==1){
						this.buildSideTree(cont.id,this.config[num].MenuName,objid,num);
					} else {
						this.buildTree(cont.id,this.config[num].MenuName,objid,num);
					}
				} else {
					if(this.config[num].Sideways==1){
						this.buildSideTree(cont.id,this.config[num].menuele[objid].Desc,objid,num);
					} else {
						this.buildTree(cont.id,this.config[num].menuele[objid].Desc,objid,num);
					}
				}
			}
		}
	},
	menuCallFunction: function (num,indx)	{
		//alert("menu call   -" + num);
		prv = this.config[num].SelectedMenu;
		
		objc = num; objc +='_'; objc +=prv; //alert(objc);//alert(this.config[num].MenuNoChld);
			if($(objc)){
				$(objc).className=this.config[num].MenuNoChld;
			}
		indx1=0;
		indx1 = parseInt(indx) + parseInt(this.config[num].scrollMenuIndex);
		//alert(indx1);
		//this.config[num].SelectedMenu
		//alert(this.config[num].scrollMenuIndex);
		//	if(this.config[num].Sideways==1){
		//alert(indx1);
		objc1 = num; objc1 +='_'; objc1 +=indx1;
		//objc2 = num; objc2 +='_'; objc2 +=indx;
		//alert(indx+'----'+indx1+'----'+objc);
		if(!this.config[num].PageName) {this.config[num].PageName = SRESelectedPage; }

		indx1 -=parseInt(this.config[num].scrollMenuIndex);
		
		this.config[num].SelectedMenu=indx1;
		obj1 = document.getElementById(objc1);
		//alert(obj1);
		if(obj1) obj1.className=this.config[num].MenuSelectedCls;
		pagename = this.config[num].PageName;
		//alert("---"+this.MenuElements[indx].Code+"---");
		//alert("-+-"+this.MenuElements[indx].Code+"-+-");
		//alert(this.config[num].SelectedMenu);
		cde='';
		if(indx !=-1){
			words = new Array();
			sre_core.breakWords(this.config[num].MenuArraySet[indx1],words);
			//alert(words[0]);
			
		cde = sre_core.ltrim(this.config[num].menuele[indx].Code);
		cde = sre_core.rtrim(cde);
		
		//alert(this.config[num].scrollMenuIndex);
		//indx1 -=parseInt(this.config[num].scrollMenuIndex);

			var str ="";
			str += '_MenuClick("';
			str += num;
			str += '","';
			str += indx1;
			str += '","';
			str += words[0];//cde;
			str += '","';
			str += words[2];//this.config[num].menuele[indx].Desc;
		
		
			str += '","';
			str += this.config[num].scrollMenucount;
			str += '","';
			str += this.config[num].scrollMenuIndex;
			
			
			str += '")';
			//alert(SRESelectedPage+pagename + str);
			eval( pagename + str);
		this.config[num].SelectedMenu =indx1;
		this.config[num].SelectedCode = cde;
		this.config[num].SelectedDesc =this.config[num].menuele[indx].Desc;
			
		}
		//alert(this.config[num].MenuType);
		
		if(this.config[num].MenuType =='L') {
			dv = document.getElementById(this.config[num].DivId);
			dv.innerHTML='';
		} else if(this.config[num].MenuType =='H') { // need to close hyper menu
			var drp = "hpdrop" + this.config[num].MenuId;
			v = document.getElementById(drp);
//			//alert("closing");
			if(v) v.innerHTML ='';
			this.config[num].dropStatus = 0 ;
			var dlpy = "hpdisplay" + this.config[num].MenuId;
//			//alert($(dlpy).inner);

			if($(dlpy)) {
				if(indx !=-1){
					$(dlpy).value = this.config[num].menuele[indx].Desc;
				}
//				$(dlpy).disabled=false;
			}
//alert(this.MenuElements[indx].Desc);
			//this.drawHyper(drp,this.config[num].MenuId);
		}
	},
	menuDoubleClk: function (num,indx)	{
		if(this.config[num].DblClkActive == 1) {
			
		indx1=0;
		indx1 = parseInt(indx) + parseInt(this.config[num].scrollMenuIndex);
		//alert(this.config[num].scrollMenuIndex);
			//if(this.config[num].Sideways==1){
			
			objc = num; objc +='_'; objc +=indx1;
			if(!this.config[num].PageName) {this.config[num].PageName = SRESelectedPage; }
			this.config[num].SelectedMenu=indx1;
			obj1 = document.getElementById(objc);
			obj1.className=this.config[num].MenuSelectedCls;
			pagename = this.config[num].PageName;
			var str ="";
			str += '_MenuDblClick("';
			str += num;
			str += '","';
			str += indx1;
			str += '","';
			str += this.MenuElements[indx].Code;
		str += '","';
		str += this.MenuElements[indx].Desc;
			
		str += '","';
		str += this.config[num].scrollMenucount;
		str += '","';
		str += this.config[num].scrollMenuIndex;
			
			str += '")';
			eval( pagename + str);
		}
	},
	mnuOver: function  (obj,classname,num,ch){
		//return;
		//if(this.config[num].Sideways==1){
		//	obj = parseInt(obj) + parseInt(this.config[num].scrollMenuIndex);
		//}
		objc = num; objc +='_'; objc +=obj;

		var str;
		if(!this.config[num].PageName) {this.config[num].PageName = SRESelectedPage; }
		obj1 = document.getElementById(objc);
		//alert(objc);
		obj1.className=this.config[num].MenuHvr;
		//alert(obj1.className);
		if(ch == 0){
			if(obj == this.config[num].SelectedMenu){
				obj1.className=this.config[num].MenuSelectedCls;
			} else {
				obj1.className=classname;
			}
			pagename = this.config[num].PageName;
			str ="";
			str += '_MenuOver("';
			str += num;
			str += '","';
			str += objc;
			
		str += '","';
		str += this.config[num].scrollMenucount;
		str += '","';
		str += this.config[num].scrollMenuIndex;
			
			
			str += '")';
			eval( this.config[num].PageName + str);
		} else {
			obj1.className=classname;
		}
	},
	mnuOut: function (obj,classname,num){
		//return;
		//if(this.config[num].Sideways==1){
		//	obj = parseInt(obj) + parseInt(this.config[num].scrollMenuIndex);
		//}
		
		objc = num; objc +='_'; objc +=obj;
		if(!this.config[num].PageName) {this.config[num].PageName = SRESelectedPage; }
		obj1 = document.getElementById(objc); 
		if(this.hasChild(obj)) {
			obj1.className=this.config[num].MenuChld;
		} else {
			obj1.className=this.config[num].MenuNoChld;
		}
		
		if(obj == this.config[num].SelectedMenu){
			obj1.className=this.config[num].MenuSelectedCls;
		} else {
			obj1.className=classname;
		}
		//this.config[id].scrollMenucount,this.config[id].scrollMenuIndex
		pagename = this.config[num].PageName;
		str ="";
		str += '_MenuOut("';
		str += num;
		str += '","';
		str += objc;

		str += '","';
		str += this.config[num].scrollMenucount;
		str += '","';
		str += this.config[num].scrollMenuIndex;
		
		str += '")';
//

		eval( this.config[num].PageName + str);
	},
	cancelDiv: function (cont,num) {
		if(num !='undefined') {
		pagename = this.config[num].PageName;
		str ="";
		str += '_MenuCancel("';
		str += num;
		str += '")';
		eval( this.config[num].PageName + str);
			
		}
	},
	hasChild: function (parentid) {
		if(this.TreeElement.length > 0){
			for(b=0; b < this.MenuElements.length; b++)	{
				if(this.MenuElements[b].Parent == parentid)	{
					return 1;
				}
			}
		}
		return 0;
	},
	findSideChild: function (parentid,chtml,num,cont)	{
		var node;
		var Child=new Array();
		var cchtml="";
		this.refresh(num);
		var Ch=new Array();
		sre_core.initializeList(Child);
		if(this.TreeElement.length > 0){
			for(b=0; b < this.TreeElement.length; b++)	{
				if(this.MenuElements[b].Parent == parentid)	{
					Child[Child.length] = b;
				}
			}
		}
		//alert(this.config[num].SelectedMenu);
		this.config[num].MenuWidth=10;
		if(Child.length > 0)	{
			if(Ch.length > 0) {
					chtml +='<tr id="tr_'+num+'_'+node +'" class="'+this.config[num].MenuNoChld+'" onmouseover="sre_menu.mnuOver(\''+node+'\',\''+this.config[num].MenuHvr+'\',\''+num+'\',1)" onMouseOut="sre_menu.mnuOut(\''+node+'\',\''+this.config[num].MenuChld+'\',\''+num+'\',1)" style="width:'+this.config[num].MenuWidth+';" >';
			} else {
				//	if(c == this.config[num].SelectedMenu){
				//		chtml +='<tr id="'+num+'_'+node +'" class="'+this.config[num].MenuSelectedCls+'" onmouseover="sre_menu.mnuOver(\''+node+'\',\''+this.config[num].MenuHvr+'\',\''+num+'\',0)" onMouseOut="sre_menu.mnuOut(\''+node+'\',\''+this.config[num].MenuSelectedCls+'\',\''+num+'\',0)" style="cursor:pointer;width:'+this.config[num].MenuWidth+'" >';
				//	} else {
				//id="'+num+'_'+node +'" class="'+this.config[num].MenuNoChld+'" >';//onmouseover="sre_menu.mnuOver(\''+node+'\',\''+this.config[num].MenuHvr+'\',\''+num+'\',0)" onMouseOut="sre_menu.mnuOut(\''+node+'\',\''+this.config[num].MenuNoChld+'\',\''+num+'\',0)" style="cursor:pointer;width:'+this.config[num].MenuWidth+'" >';
				//	}
				chtml +='<tr >';
			}
			for(c = 0; c < Child.length; c++)	{
				node= Child[c];
				var ds = this.MenuElements[node].Desc;
				sre_core.initializeList(Ch);
				for(b=0; b < this.TreeElement.length; b++)	{
					if(this.MenuElements[b].Parent == node)	{
						Ch[Ch.length] = b;
					}
				}
				if(Ch.length > 0) {
					
					chtml +='<td colspan="2" align="left" id="td_'+num+'_'+node +'" onClick="sre_menu.childClicked(\''+num+'\','+cont+',\''+node+'\')"><span style="cursor:pointer;">'+ this.MenuElements[node].Desc +'</span></td>';
					chtml +='<td width="20" id="td_'+num+'_'+node +'" onClick="sre_menu.childClicked(\''+num+'\','+cont+','+node+')">';
					chtml +='<img src="'+this.config[num].DropDownPic+'" '
						+' width="15" height="15"></td>';
					//chtml += '</tr>';
				} else {
					
					node1 = parseInt(node) + parseInt(this.config[num].scrollMenuIndex);
					if ( (this.MenuElements[c].PicPath != " ") && (this.MenuElements[c].PicPath != '[DIV]')){
						chtml +='<td colspan="3">';
						chtml +='<table border="0" height="100%" style="border-collapse:collapse">';
						//chtml +='<tr>';
						//	if(c == this.config[num].SelectedMenu){
						//		chtml +='<tr id="'+num+'_'+node1 +'" class="'+this.config[num].MenuSelectedCls+'" onmouseover="sre_menu.mnuOver(\''+node1+'\',\''+this.config[num].MenuHvr+'\',\''+num+'\',0)" onMouseOut="sre_menu.mnuOut(\''+node1+'\',\''+this.config[num].MenuSelectedCls+'\',\''+num+'\',0)" style="cursor:pointer;width:'+this.config[num].MenuWidth+'" >';
						//	} else {
								chtml +='<tr id="'+num+'_'+node1 +'" class="'+this.config[num].MenuNoChld+'" onmouseover="sre_menu.mnuOver(\''+node1+'\',\''+this.config[num].MenuHvr+'\',\''+num+'\',0)" onMouseOut="sre_menu.mnuOut(\''+node1+'\',\''+this.config[num].MenuNoChld+'\',\''+num+'\',0)" style="cursor:pointer;width:'+this.config[num].MenuWidth+'" >';
						//	}
						chtml +='<td id="td_'+num+'_'+'node' +'" onDblClick="sre_menu.menuDoubleClk(\''+num+'\','+node+')" onClick="sre_menu.menuCallFunction(\''+num+'\','+node+')">';
						chtml +='<img border="0" style="background:transparent" src="'+this.MenuElements[node].PicPath+'" '
						+' width="'+this.config[num].IconWidth+'" height="'+this.config[num].IconHeight+'"></td>';
						if(this.config[num].ShowDesc==1) {
							chtml += '<td nowrap width="100%" id="td_'+num+'_'+'node' +'" onDblClick="sre_menu.menuDoubleClk(\''+num+'\','+node+')" onClick="sre_menu.menuCallFunction(\''+num+'\','+node+')"><span style="cursor:pointer;">' + ds +'</span></td>';
						} else {
							chtml += '<td width="100%" id="td_'+num+'_'+'node' +'" onDblClick="sre_menu.menuDoubleClk(\''+num+'\','+node+')" onClick="sre_menu.menuCallFunction(\''+num+'\','+node+')"><span style="cursor:pointer;"></span></td>';
						}
						chtml += '<td >';
						if(this.config[num].ExpandDiv == 1){
							chtml +='<img onclick="sre_menu.menuExpand(\''+num+'\','+node+')" src="'+this.config[num].ExpandPic+'" '
							+' width="'+this.config[num].ExpandPicWidth+'" >';
						}
						chtml += '</td>';
						
						chtml += '</td></tr></table>';
						chtml += '</td>';
					} else if(this.MenuElements[c].PicPath == '[DIV]'){
						//alert("here   " + this.MenuElements[node].PicPath);
						chtml +='<td colspan="3">';
						chtml +='<table border="0" height="100%">';
						//chtml +='<tr>';
						//	if(c == this.config[num].SelectedMenu){
						//		chtml +='<tr id="'+num+'_'+node1 +'" class="'+this.config[num].MenuSelectedCls+'" onmouseover="sre_menu.mnuOver(\''+node1+'\',\''+this.config[num].MenuHvr+'\',\''+num+'\',0)" onMouseOut="sre_menu.mnuOut(\''+node1+'\',\''+this.config[num].MenuSelectedCls+'\',\''+num+'\',0)" style="cursor:pointer;width:'+this.config[num].MenuWidth+'" >';
						//	} else {
								chtml +='<tr id="'+num+'_'+node1 +'" class="'+this.config[num].MenuNoChld+'" onmouseover="sre_menu.mnuOver(\''+node1+'\',\''+this.config[num].MenuHvr+'\',\''+num+'\',0)" onMouseOut="sre_menu.mnuOut(\''+node1+'\',\''+this.config[num].MenuNoChld+'\',\''+num+'\',0)" style="cursor:pointer;width:'+this.config[num].MenuWidth+'" >';
						//	}
						chtml +='<td id="td_'+num+'_'+'node' +'" onDblClick="sre_menu.menuDoubleClk(\''+num+'\','+node+')" onClick="sre_menu.menuCallFunction(\''+num+'\','+node+')">';
						chtml +='<img src="'+this.MenuElements[node].PicPath+'" '
						+' width="'+this.config[num].IconWidth+'" height="'+this.config[num].IconHeight+'"></td>';
						chtml += '<td width="100%" id="td_'+num+'_'+'node' +'" onDblClick="sre_menu.menuDoubleClk(\''+num+'\','+node+')" onClick="sre_menu.menuCallFunction(\''+num+'\','+node+')"><span style="cursor:pointer;"><div id="pic_dv_'+num+'_'+'node' +'">pic</div></span></td>';
						chtml += '<td >';
						if(this.config[num].ExpandDiv == 1){
							chtml +='<img onclick="sre_menu.menuExpand(\''+num+'\','+node+')" src="'+this.config[num].ExpandPic+'" '
							+' width="'+this.config[num].ExpandPicWidth+'" >';
						}
						chtml += '</td>';
						
						chtml += '</td></tr></table>';
						chtml += '</td>';
					} else {
						chtml +='<td colspan="3">';
						chtml +='<table border="0" height="100%">';
						//chtml +='<tr>';
						//	if(c == this.config[num].SelectedMenu){
						//		chtml +='<tr id="'+num+'_'+node1 +'" class="'+this.config[num].MenuSelectedCls+'" onmouseover="sre_menu.mnuOver(\''+node1+'\',\''+this.config[num].MenuHvr+'\',\''+num+'\',0)" onMouseOut="sre_menu.mnuOut(\''+node1+'\',\''+this.config[num].MenuSelectedCls+'\',\''+num+'\',0)" style="cursor:pointer;width:'+this.config[num].MenuWidth+'" >';
						//	} else {
								chtml +='<tr id="'+num+'_'+node1 +'" class="'+this.config[num].MenuNoChld+'" onmouseover="sre_menu.mnuOver(\''+node1+'\',\''+this.config[num].MenuHvr+'\',\''+num+'\',0)" onMouseOut="sre_menu.mnuOut(\''+node1+'\',\''+this.config[num].MenuNoChld+'\',\''+num+'\',0)" style="cursor:pointer;width:'+this.config[num].MenuWidth+'" >';
						//	}
						
						chtml +='<td id="td_'+num+'_'+'node' +'" onDblClick="sre_menu.menuDoubleClk(\''+num+'\','+node+')" onClick="sre_menu.menuCallFunction(\''+num+'\','+node+')">';
						chtml +='</td>';
						chtml += '<td id="td_'+num+'_'+'node' +'" onDblClick="sre_menu.menuDoubleClk(\''+num+'\','+node+')" onClick="sre_menu.menuCallFunction(\''+num+'\','+node+')">' + ds +'</td>';
						chtml += '<td >';
						if(this.config[num].ExpandDiv == 1){
							chtml +='<img onclick="sre_menu.menuExpand(\''+num+'\','+node+')" src="'+this.config[num].ExpandPic+'" '
							+' width="'+this.config[num].ExpandPicWidth+'" >';
						}
						chtml += '</td>';
						
						chtml += '</td></tr></table>';
						chtml += '</td>';
					}
					
				}
			}
			chtml += '</tr>';
		}
		//alert(chtml);
		return chtml;
	},
	findChild: function (parentid,chtml,num,cont)	{	
		var node;
		var Child=new Array();
		var cchtml="";
		this.refresh(num);
		var Ch=new Array();
		sre_core.initializeList(Child);
		if(this.TreeElement.length > 0){
			for(b=0; b < this.TreeElement.length; b++)	{
				if(this.MenuElements[b].Parent == parentid)	{
					Child[Child.length] = b;
				}
			}
		}
		if(Child.length > 0)	{
			for(c = 0; c < Child.length; c++)	{
				node= Child[c];
				var ds = this.MenuElements[node].Desc;
				sre_core.initializeList(Ch);
				for(b=0; b < this.TreeElement.length; b++)	{
					if(this.MenuElements[b].Parent == node)	{
						Ch[Ch.length] = b;
					}
				}
				if(Ch.length > 0) {
					
					chtml +='<tr id="tr_'+num+'_'+node +'" class="'+this.config[num].MenuDropDowndCls+'" onmouseover="sre_menu.mnuOver(\''+node+'\',\''+this.config[num].MenuHvr+'\',\''+num+'\',1)" onMouseOut="sre_menu.mnuOut(\''+node+'\',\''+this.config[num].MenuChld+'\',\''+num+'\',1)" style="width:'+this.config[num].MenuWidth+';" >';
					chtml +='<td></td><td colspan="1" align="left" id="'+num+'_'+node +'" onClick="sre_menu.childClicked(\''+num+'\','+cont+',\''+node+'\')"><span style="cursor:pointer;">'+ this.MenuElements[node].Desc +'</span></td>';
					chtml +='<td width="20" class="'+this.config[num].MenuDropDowndCls+'" id="td_'+num+'_'+node +'" onClick="sre_menu.childClicked(\''+num+'\','+cont+','+node+')">';
					chtml +='<img class="'+this.config[num].MenuDropDowndCls+'" src="'+this.config[num].DropDownPic+'" '
						+' width="'+this.config[num].IconWidth+'" height="'+this.config[num].IconHeight+'"></td>';
					chtml += '</tr>';
				} else {
					node1 = parseInt(node) + parseInt(this.config[num].scrollMenuIndex);
					//if(c == this.config[num].SelectedMenu){
					//	chtml +='<tr id="'+num+'_'+node +'" class="'+this.config[num].MenuSelectedCls+'" onmouseover="sre_menu.mnuOver(\''+node+'\',\''+this.config[num].MenuHvr+'\',\''+num+'\',0)" onMouseOut="sre_menu.mnuOut(\''+node+'\',\''+this.config[num].MenuSelectedCls+'\',\''+num+'\',0)" style="cursor:pointer;width:'+this.config[num].MenuWidth+'" >';
					//} else {
						chtml +='<tr id="'+num+'_'+node1 +'" class="'+this.config[num].MenuNoChld+'" onmouseover="sre_menu.mnuOver(\''+node1+'\',\''+this.config[num].MenuHvr+'\',\''+num+'\',0)" onMouseOut="sre_menu.mnuOut(\''+node1+'\',\''+this.config[num].MenuNoChld+'\',\''+num+'\',0)" style="cursor:pointer;width:'+this.config[num].MenuWidth+'" >';
					//}
					
					if((this.MenuElements[c].PicPath != "") && (this.config[num].noPic==0)){
						chtml +='<td id="td_'+num+'_'+node +'" onDblClick="sre_menu.menuDoubleClk(\''+num+'\','+node+')" onClick="sre_menu.menuCallFunction(\''+num+'\','+node+')">';
						chtml +='<img src="'+this.MenuElements[node].PicPath+'" '
						+' width="'+this.config[num].IconWidth+'" height="'+this.config[num].IconHeight+'"></td>';
						chtml += '<td width="100%" id="td_'+num+'_'+node +'" onDblClick="sre_menu.menuDoubleClk(\''+num+'\','+node+')" onClick="sre_menu.menuCallFunction(\''+num+'\','+node+')"><span style="cursor:pointer;">' + ds +'</span></td>';
						chtml += '<td >';
						if(this.config[num].ExpandDiv == 1){
							chtml +='<img onclick="sre_menu.menuExpand(\''+num+'\','+node+')" src="'+this.config[num].ExpandPic+'" '
							+' width="'+this.config[num].ExpandPicWidth+'" >';
						}
						chtml += '</td>';
						chtml += '</tr>';
					}/*else if(this.config[num].PicPath != " "){
						chtml +='<td id="'+num+'_'+node +'" onDblClick="sre_menu.menuDoubleClk(\''+num+'\','+node+')" onClick="sre_menu.menuCallFunction(\''+num+'\','+node+')">';
						chtml +='<img src="'+this.config[num].PicPath+'" '
						+' width="'+this.config[num].IconWidth+'" height="'+this.config[num].IconHeight+'"></td>';
						chtml += '<td width="100%" id="'+num+'_'+node +'" onDblClick="sre_menu.menuDoubleClk(\''+num+'\','+node+')" onClick="sre_menu.menuCallFunction(\''+num+'\','+node+')"><span style="cursor:pointer;">' + ds +'</span></td>';
						chtml += '<td >';
						if(this.config[num].ExpandDiv == 1){
							chtml +='<img onclick="sre_menu.menuExpand(\''+num+'\','+node+')" src="'+this.config[num].ExpandPic+'" '
							+' width="'+this.config[num].ExpandPicWidth+'" >';
						}
						chtml += '</td>';
						chtml += '</tr>';
						//alert(chtml);
					} */else {
						chtml +='<td id="td_'+num+'_'+node +'" onDblClick="sre_menu.menuDoubleClk(\''+num+'\','+node+')" onClick="sre_menu.menuCallFunction(\''+num+'\','+node+')">';
						chtml +='</td>';
						chtml += '<td id="td_'+num+'_'+node +'" onDblClick="sre_menu.menuDoubleClk(\''+num+'\','+node+')" onClick="sre_menu.menuCallFunction(\''+num+'\','+node+')"><span style="cursor:pointer;">' + ds +'</span></td>';
						chtml += '<td >';
						if(this.config[num].ExpandDiv == 1){
							if(this.config[num].ExpandSelective == 1){
								if(this.MenuElements[c].expand==1){
									chtml +='<img onclick="sre_menu.menuExpand(\''+num+'\','+node+')" src="'+this.config[num].ExpandPic+'" '
									+' width="'+this.config[num].ExpandPicWidth+'" >';									
								} else {
									chtml +='';									
								}
							} else{
								chtml +='<img onclick="sre_menu.menuExpand(\''+num+'\','+node+')" src="'+this.config[num].ExpandPic+'" '
								+' width="'+this.config[num].ExpandPicWidth+'" >';
							}
						}
						chtml += '</td>';
						chtml += '</tr>';
					}
					chtml +='<tr>';
					chtml +='<td colspan="3" ><div id="dv'+num+'_'+node +'"></div>';
					chtml +='</td>';
					chtml +='</tr>';
				}
			}
		}
		//alert(chtml);
		return chtml;
	},
	refresh: function (n){ //removed the first element
		Words = new Array();
		this.TreeElement = new Array();
		this.TreeElement = this.config[n].MenuArraySet;
		if(this.TreeElement =='undefined') return;
		if(!this.TreeElement) return;
		for(a = 0; a < this.TreeElement.length; a++){
			sre_core.breakWords(this.TreeElement[a],Words);
			this.MenuElements[a] = {
				Indx: a,
				Code: Words[0],
				Parent: Words[1],
				Desc: Words[2],
				PicPath: Words[3],
				expand: Words[4]
			};
			this.config[n].menuele=this.MenuElements;
		}
	},
	menuExpand: function (num,indx)	{
		//alert(num+'---'+indx);
		indx1=0;
		indx1 = parseInt(indx) + parseInt(this.config[num].scrollMenuIndex);
		//alert(this.config[num].scrollMenuIndex);
			if(this.config[num].Sideways==1){
				st= 'dv';st +=num;
				if($(st)) $(st).innerHTML ='';
			} else {
				st= 'dv';st +=num; st +='_'+this.config[num].LastExpand;
				if($(st)) $(st).innerHTML ='';
			}
			
		if ((this.config[num].LastExpand == indx) && (this.config[num].LastExpand != -1 )){
			this.config[num].LastExpand = -1;
		} else {
			this.config[num].LastExpand = indx1;
			objc = num; objc +='_'; objc +=indx1;
			if(!this.config[num].PageName) {this.config[num].PageName = SRESelectedPage; }
			this.config[num].SelectedMenu=indx1;
			//alert(this.config[num].SelectedMenu);
			obj1 = document.getElementById(objc);
			if(obj1) obj1.className=this.config[num].MenuSelectedCls;
			pagename = this.config[num].PageName;
			var str ="";
			str += '_MenuExpand("';
			str += num;
			str += '","';
			str += indx1;
			str += '","';
			str += this.MenuElements[indx].Code;

		str += '","';
		str += this.config[num].scrollMenucount;
		str += '","';
		str += this.config[num].scrollMenuIndex;
			str += '")';
			eval( pagename + str);
		}
	},
	buildSideTree: function (cont,desc,parid,num)	{
		this.refresh(num);
		var html =''; 
		var chtml ='';
		this.config[num].DivId=cont;
		this.config[num].MenuWidth=10;
		if(this.TreeElement.length > 0){
			var scrlpos =12;
			v = document.getElementById(cont);
			if(this.config[num].MenuType == 'L' ) {
				html +='<div id="sre_pop_div" style="background-color:#ffffff">';
				html +='<table border="0" cellpadding="0" cellspacing="0" style="border-top:0px transparent; border-left:0px transparent;border-bottom:1px solid gray; border-right:1px solid gray;">';
				html +='<tr><td align="right" height="15" style="background-color:rgb(255,255,255)" class="mnudrpdwnborder">'; /*'+this.config[num].BackColor+'*/
			  	html+='<img border="0" style="cursor:pointer;background-color:transparent" src="/EN/SRESYS/Pic/commonstyle/cancel.png" height="15" onclick="cancelDiv(\''+this.config[num].DivId+'\',\'MENU_'+num+'\')"></img>';
				html +='</td></tr><tr><td valign="top">';	
			}
			if(this.config[num].fixedScroll != 0) {
				html +='<div class="menuscroll" style="height:'+this.config[num].MenuHeight+';">';
			}
			html +='<table cellpadding="0" cellspacing="0" border="0" style="background-color:'+this.config[num].BackColor+';width:'+this.config[num].MenuWidth+';height:'+this.config[num].MenuHeight+';">'; //MenuHeight
				if(this.config[num].ShowHeader == 1){
					html +='<tr>';
						html +='<td class="'+this.config[num].MenuHeader+'" colspan="4" onClick="sre_menu.parentClicked(\''+num+'\','+cont+',-1)">';
							html += this.config[num].MenuName;
						html +='</td>';
					html +='</tr>';
				}
				html +='<tr style="width:'+this.config[num].MenuWidth+';">';
				//html +='<tr>';
					html +='<td nowrap width="20">';
						if(this.config[num].prev==1){
							if(this.config[num].scrollableData == 1){
								ht='';
								ht =sre_menu.dataScrollSideArrows(num,'H',this.config[num].currsetting) ;
							   html +=ht;		
							}
						} else {
							html +='<table border="0" width="100%" height="0"><tr><td align="center" >';
							html +='</td></tr></table>';
						}
					html +='</td>';
				//html +='</tr>';
				
				
					html +='<td valign="top" class="'+this.config[num].MenuBk+'" style="width:'+this.config[num].MenuWidth+'">';//<div persistID='+ scrlpos + ' scrollPOS = ';
					////	html +=  0 ;
					//	html +=' id="rightPane" style="width:'
					//	html += this.config[num].MenuWidth +'"'
					//	html +=' >' 
							html +='<table  height="100%" width="100%" id="' + 'TestR' + '" border="0"  style="border-collapse:collapse;">';  
							if (parid == -1) {
							}
							else {
								html +='<tr id="'+ parid +'" onClick="sre_menu.parentClicked(\''+num+'\','+cont+','+parid+')" style="width:'+this.config[num].MenuWidth+'">';
								html += '<td class="'+this.config[num].MenuSubHdr+'"><img src="'+this.config[num].picMenuReturn+'" width="15" height="15"></td>'
								+'<td class="'+this.config[num].MenuSubHdr+'" style="border-collapse:collapse;width:'+parseInt((this.config[num].MenuWidth - 20),10)+'">'+desc +'</td></tr>';
							}
								chtml = this.findSideChild(parid,chtml,num,cont); 
							html += chtml;
							html+='</table>';
					//		html+='</div>';
					html+='</td>';
						//html+='</tr>';
						//html +='<tr>';
					html +='<td nowrap width="20">';
					if(this.config[num].nxt==1){
						if(this.config[num].scrollableData == 1){
							ht='';
							ht =sre_menu.dataScrollSideArrows(num,'F',this.config[num].currsetting) ;
						   html +=ht;		
						}
					}else {
							html +='<table border="0" width="100%" height="0"><tr><td align="center" >';
							html +='</td></tr></table>';
					}
					html +='</td>';
				html +='</tr>';
			//			clsp = (Child.length * 2) ;
			html +='<tr >';
			html +='<td colspan="3"><div id="dv'+num+'" ></div>';
			html +='</td>';
			html +='</tr>';			
		
			html+='</table>';
			//alert(html);
			if(this.config[num].fixedScroll != 0) {
				html +='</div>';
			}
			if(this.config[num].MenuType == 'L' ) {
			  html +='</td></tr></table>';	
			  html +='<div>';
			}
			if(v) {
				v.innerHTML = html;
			}
			return html;
		}
	},
	buildTree: function (cont,desc,parid,num)	{
		//alert(this.config[num].DivId);
		//aaa = $("sre_floatdiv");
		//alert(cont);
		this.refresh(num);
		var html =''; 
		var chtml ='';
		this.config[num].DivId=cont;
		if(this.TreeElement.length > 0){
			var scrlpos =12;
			v = document.getElementById(cont);
			if(this.config[num].MenuType == 'L' ) {
				html +='<div id="sre_pop_div" style="background-color:#ffffff;" >';
				html +='<table class="calendar" border="0" cellpadding="0" cellspacing="0" style="border-top:0px transparent; border-left:0px transparent;border-bottom:1px solid gray; border-right:1px solid gray;">';
				html +='<tr><td align="right" height="15" style="background-color:rgb(206,206,255)" class="mnudrpdwnborder">'; /*'+this.config[num].BackColor+'*/
			  	html+='<img border="0" style="cursor:pointer;background-color:transparent" src="/EN/SRESYS/Pic/commonstyle/cancel.png" height="15" onclick="cancelDiv(\''+this.config[num].DivId+'\',\'MENU_'+num+'\')"></img>';
				html +='</td></tr><tr><td valign="top">';	
			}
			if(this.config[num].fixedScroll != 0) {
				html +='<div class="menuscroll" style="height:'+this.config[num].MenuHeight+';">';
			}
			html +='<table cellpadding="0" cellspacing="0" border="0" style="background-color:'+this.config[num].BackColor+';width:'+this.config[num].MenuWidth+';">';//height:'+this.config[num].MenuHeight+';">'; //MenuHeight
				if(this.config[num].ShowHeader == 1){
					html +='<tr>';
						html +='<td class="'+this.config[num].MenuHeader+'" colspan="2" onClick="sre_menu.parentClicked(\''+num+'\','+cont+',-1)">';
							html += this.config[num].MenuName;
						html +='</td>';
					html +='</tr>';
				}
				html +='<tr>';
					html +='<td >';
						if(this.config[num].prev==1){
							if(this.config[num].scrollableData == 1){
								ht='';
								ht =sre_menu.dataScrollArrows(num,'H',this.config[num].currsetting) ;
							   html +=ht;		
							}
						} else {
							if(this.config[num].scrollableData == 1){
								html +='<table border="0" width="100%" height="0"><tr><td align="center" >&nbsp;';
								html +='</td></tr></table>';
							} else {
								html +='<table border="0" width="100%" height="0"><tr><td align="center" >';
								html +='</td></tr></table>';
							}
						}
					html +='</td>';
				html +='</tr>';
				
				html +='<tr  style="width:'+this.config[num].MenuWidth+';">';
					html +='<td  class="'+this.config[num].MenuBk+'" style="width:'+this.config[num].MenuWidth+'"><div persistID='+ scrlpos + ' scrollPOS = ';
						html +=  0 ;
						html +=' id="rightPane" style="width:'
						html += this.config[num].MenuWidth +'"'
						html +=' valign="top">'
					//	if(this.config[num].ShowHeader == 1){
					//		html +='<table class="calendar" width="100%" id="' + 'TestR' + '" border="0"  style="border-collapse:collapse;">';  
					//	} else {
							html +='<table width="100%" id="' + 'TestR' + '" border="0"  style="border-collapse:collapse;">';  
					//	}
							if (parid == -1) {
							}
							else {
								html +='<tr id="'+ parid +'" onClick="sre_menu.parentClicked(\''+num+'\','+cont+','+parid+')" style="width:'+this.config[num].MenuWidth+'">';
								html += '<td class="'+this.config[num].MenuSubHdr+'"><img src="'+this.config[num].picMenuReturn+'" width="15" height="15"></td>'
								+'<td class="'+this.config[num].MenuSubHdr+'" style="border-collapse:collapse;width:'+parseInt((this.config[num].MenuWidth - 20),10)+'">'+desc +'</td></tr>';
							}
							chtml = this.findChild(parid,chtml,num,cont); 
							html += chtml;
							html+='</table>';
						html+='</div>';
					html+='</td>';
				html+='</tr>';
			html +='<tr>';
					html +='<td >';
					//alert(this.config[num].nxt);
					if(this.config[num].nxt==1){
						if(this.config[num].scrollableData == 1){
							ht='';
							ht =sre_menu.dataScrollArrows(num,'F',this.config[num].currsetting) ;
						   html +=ht;		
						}
					}else {
						if(this.config[num].scrollableData == 1){
							html +='<table border="0" width="100%" height="0"><tr><td align="center" >&nbsp;';
							html +='</td></tr></table>';
						} else {
							html +='<table border="0" width="100%" height="0"><tr><td align="center" >';
							html +='</td></tr></table>';
						}
						
					}
					html +='</td>';
				html +='</tr>';
					
			html+='</table>';
			if(this.config[num].fixedScroll != 0) {
				html +='</div>';
			}
			if(this.config[num].MenuType == 'L' ) {
			  html +='</td></tr></table>';	
			  html +='<div>';
			}
			//alert(html);
			if(v) {
				v.innerHTML = html;
			}
		//	tbl = 'hpdropTbl'+num;
		//	$(tbl).focus();
		//	idtd='td_'+num+'_'+'0';
		//	if($(idtd)) $(idtd).focus();
			return html;
		}
	},
	dropDown: function (num,bypass){
		if(bypass & bypass == 1){
		} else {
			for(x=0;x < sremenulist.length; x++ ){
				//alert("drop");
				//this.refresh(sremenulist[x]);
				var oth = "hpdrop" + sremenulist[x];
				ot = document.getElementById(oth);
				if(ot) {ot.innerHTML = '';} //
			}
		}
/****************/		
		//	pagename = this.config[num].PageName;
		//	var str ="";
		//	str += '_MenuDrop("';
		//	str += num;
		//	str += '","';
		//	str += indx1;
		//	str += '","';
		//	str += this.MenuElements[indx].Code;
		//	str += '","';
		//	str += this.config[num].scrollMenucount;
		//	str += '","';
		//	str += this.config[num].scrollMenuIndex;
		//	str += '")';
		//	eval( pagename + str);
/****************/

		var drp = "hpdrop" + num;
		$(drp).style.visibility = 'visible';
		v = document.getElementById(drp);
		var dlpy = "hpdisplay" + num;
		//$(dlpy).disabled= true;
		//$(dlpy).value='';
		
		//tbl = 'hpdropTbl'+num;
		//$(tbl).focus();
		//this.config[num].SelectedMenu=0;
		//idtd='td_'+num+'_'+'0';
		//$(idtd).focus();
		//v.disabled=true;
		//alert("menuname : "+ this.config[num].MenuId);
		if(this.config[num].dropStatus == 0) {
		
			this.display(drp,this.config[num].MenuId,this.config[num]);
			this.config[num].MenuType = 'H';
			this.config[num].MenuId = num;
			this.config[num].dropStatus = 1 ;
		} else {
			v.innerHTML = '';
			this.config[num].dropStatus = 0 ;
		}
	},
	dropDownBlur: function (num){
		//alert("vf");
		var drp1 = "hpdrop" + num;
		$(drp1).style.visibility = 'hidden';
		$(drp1).innerHTML='';
		
	//	this.config[num].dropStatus = 0 ;
		//this.display(drp,this.config[num].MenuId,this.config[num]);
		
	//	var drp = "hpdisplay" + num;
	//	alert($(drp1).innerHTML);
	//	$(drp).disabled=false;
	//	this.config[num].SelectedMenu =indx1;
	//	this.config[num].SelectedCode = cde;
	//	this.config[num].SelectedDesc =this.MenuElements[indx].Desc;

	//		if($(dlpy)) {
	//			$(drp).value = this.MenuElements[indx].Desc;
//				$(dlpy).disabled=false;
	//		}
	//menuCallFunction:(num,this.config[num].SelectedMenu)
		
	},

	dropDownPic: function (num,bypass){
		this.config[num].dropStatus  = 0 ;
		sre_menu.dropDown(num,bypass);
	},
	drawHyper: function (cont,num){
		//alert(cont);		alert(num);
		//alert(this.config[num].MenuWidth);
		var html='';var status = 0; var Words = new Array();
		vv = document.getElementById(cont);
		//alert(this.config[num].MenuWidth);
		html += '<table border="0" width="'+this.config[num].MenuWidth+'" cellpadding="0" cellspacing="0" style="background-color:'+this.config[num].BackColor+';">';
		html += '<tr>';
		html += '<td class="'+this.config[num].hyperDisplayHdrCls+'"  width="100%" style="cursor:pointer;height:10;padding-left:5;  padding-right:0;background-color:transparent;"  >';
			html += '<input style="cursor:default;width:'+this.config[num].MenuWidth+';" id="hpdisplay'+num+'" onblur="sre_menu.dropDownBlur(\''+num+'\')" onfocus="sre_menu.dropDownPic(\''+num+'\')"    class="'+this.config[num].MenuHdr+'" value="';
			html += this.config[num].hyperDisplay;
			html += '" disabled></input>';
		html += '</td>';
		html += '<td valign="bottom" style="cursor:pointer;padding-left:0; padding-right:0;height:15px;" >';
		html += '<img style="height:12px;" border="0" src="'+this.config[num].hyperDropDownPic+'" onclick="sre_menu.dropDownPic(\''+num+'\')" ></img>';
		html += '</td>';
		html += '</tr>';
		html += '<tr>';
		html += '<td colspan="2"  border="2">';
		//html += '<table border="0" cellpadding="0" cellspacing="0" id="hpdropTbl'+num+'"><tr><td>';
		if(sre_core.isMSIE() ){
			html += '<div  id="hpdrop'+num+'" style="position:absolute;z-index:100;filter:progid:DXImageTransform.Microsoft.Alpha(opacity='+this.config[num].hyperOpacity+');visibility:hidden" class="'+this.config[num].hyperBackCls+'"></div>';
		} else {
			html += '<div  id="hpdrop'+num+'" style="position:absolute;z-index:100;opacity:'+parseInt(this.config[num].hyperOpacity)/100+';visibility:hidden" class="'+this.config[num].hyperBackCls+'"></div>';
		}
		//html += '</td></tr></table>';
		//alert(this.config[num].hyperOpacity);
		html += '</td>';
		html += '</tr>';
		html += '</table>';
		//alert(html);
		if(vv) {
			vv.innerHTML = html;
		}
	},
	render: function(divid,html) {	
		v = document.getElementById(divid);
		v.innerHTML = html;
	},
	display: function(divid,id,settings) {	
		this.setSettings(id, settings);
		this.config[id].MenuId = id;
		this.config[id].MenuType = 'N';
		this.config[id].DivId = divid;
		if(this.config[id].Sideways==1){
			this.buildSideTree(divid,this.MenuName,-1,id);
		} else {
			this.buildTree(divid,this.MenuName,-1,id);
		}
	},
	displayHyper: function(divid,id,settings) {	
		this.setSettings(id, settings);
		this.config[id].MenuId = id;
		this.config[id].MenuType = 'H';
		this.config[id].DivId = divid;	
		this.config[id].dropStatus = 0;
		//alert(this.config[id]);
		this.drawHyper(divid,id);
	},
	displayLookup: function(divid,id,settings,top,left) {
		this.setSettings(id, settings);
		this.config[id].MenuId = id;
		this.config[id].MenuType = 'L';
		this.config[id].DivId = divid;	
		dv = document.getElementById(divid);
		dv.style.position ='absolute';
		ly = parseInt(this.config[id].Layer) + 10;
		dv.style.zIndex =ly;
		dv.style.top = top;
		this.config[id].Top = top;
		dv.style.left = left;
		this.config[id].Left = left;
		//alert(ly);
		if(this.config[id].Sideways==1){
			this.buildSideTree(divid,this.MenuName,-1,id);
		} else {
			this.buildTree(divid,this.MenuName,-1,id);
		}
	},
	dataMenuCall: function(id,settings,msg,action,func,ajxid,datacnt,start) {
		//alert(func+'--'+ajxid+'--'+datacnt+'--'+start);
		this.setSettings(id, settings);
		msgint='';
		msgint +='<menuid>'+id+'</menuid>';
		this.config[id].scrollMenuIndex = start;
		msgint +='<menuindex>'+this.config[id].scrollMenuIndex+'</menuindex>';
		this.config[id].scrollMenucount = datacnt;
		this.config[id].msg = msg;
		this.config[id].action = action;
		this.config[id].func = func;
		this.config[id].ajxid = ajxid;
		msgint +='<datacount>'+this.config[id].scrollMenucount+'</datacount>';
		msgint +=msg;
		//alert(msgint);
		srePHPAsyncSubmit(msgint,action,func,true,ajxid,'Y');
	},
	dataLoadArray: function(menu,mnuList,respstr,id,totalcnt) {
		//if(!this.config[id]) return;
		if(this.config[id].scrollMenuIndex > 0) {
			this.config[id].prev=1;
		} else {
			this.config[id].prev=0;
		}
		//$("detailcccccccc").innerHTML=totalcnt;
		if(this.config[id].scrollMenucount + this.config[id].scrollMenuIndex >= totalcnt){
			menu.nxt=0;
		}else{
			menu.nxt=1;
		}
		//alert(id);
		menu.totcnt = totalcnt;
		var done=0;var pos=0;var word="";var ret = 1;var indx=0;
		var wordarray = new Array();
		len = respstr.length;
		sre_core.initializeList(mnuList);
		for(i=pos; i < len && done == 0; i++)	{
			if(respstr.slice(i,i+1)==';')		{
				word = respstr.slice(pos,i);
				if(word !=''){	
					mnuList[mnuList.length] = word;
				}
				pos = i + 1;
				if (word)			{
					wordarray[indx] = word;
					indx++;
				} else {
					ret = 0;
				}
				word=""; 
			}
		}
		word = respstr.slice(pos,i-1);
		if(word !=''){	
			mnuList[mnuList.length] = word;
		}
		wordarray[indx] = word;
		done = 1;
		
		this.config[id].addMenuArray(mnuList);
	},
	scrollPrevNext: function(divid,id,settings,dir,jumpcnt){
		if(!jumpcnt) {jumpcnt = 1;}
		this.setSettings(id, settings);
		this.config[id].scrollMenuIndex +=(dir * jumpcnt);
		this.config[id].SelectedMenu -=(dir * jumpcnt);
//$("aa").innerHTML=divid +'----'+id;		
		//dvval = $(divid).innerHTML;//alert(this.config[id].action);
		sre_menu.dataMenuCall(id,this.config[id].currsetting,this.config[id].msg,
				       this.config[id].action,this.config[id].func,this.config[id].ajxid,
				       this.config[id].scrollMenucount,this.config[id].scrollMenuIndex);
		
			//$(divid).innerHTML = dvval;
			//alert("aa");
			//this.config[id].dropStatus = 0 ;
			//this.dropDown(id,1);
			//this.displayHyper(divid,id,settings);
			//this.drawHyper(divid,id);
			//this.config[id].dropStatus = 0 ;	
		

//alert("prev next");
//sre_menu.dataMenuCall(menuid,menuobj,Page,redirecturl,callback,ajxid,cnt,offset);
		if(this.config[id].Sideways==1){
			this.buildSideTree(divid,id,-1,id);
		} else {
			if(this.config[id].MenuType == 'H') {
				//alert("not building");
				this.config[id].dropStatus = 0 ;
				this.displayHyper(divid,id,settings);
			} else {
				this.buildTree(divid,id,-1,id);
			}
		}
	},
	scrollMenu: function(id,pagenm,dir){
		
		str ="";
		str += '_MenuScroll("';
		str += id;
		str += '",';
		str += dir;
		str += ')';
		eval( pagenm + str);
	},
	dataScrollSideArrows: function(id,headfoot,settings) {
		this.setSettings(id, settings);
		totalcnt = this.config[id].totcnt	
		if(this.config[id].scrollMenuIndex > -1) {
			this.config[id].prev=1;
		} else {
			this.config[id].prev=0;
		}
		if(this.config[id].scrollMenucount + this.config[id].scrollMenuIndex >= totalcnt ){
			this.config[id].nxt=0;
		}else{
			this.config[id].nxt=1;
		}
	
		html='';
		pagename = this.config[id].PageName;
		if(this.config[id].scrollableData == 1){
			if(headfoot =='H'){
				html +='<table border="0" height="100%" width="18"><tr>';
				html +='<td style="cursor:pointer" valign="middle" onclick="sre_menu.scrollMenu(\''+id+'\',\''+pagename+'\',-1)">';
				html +='<img src="/EN/SRESYS/Pic/commonstyle/prevsm.png" height="12"></img>';
				html +='</td></tr>';
				
				if(this.config[id].pageScroll==1){
					html +='<tr>';
					html +='<td style="cursor:pointer" align="center" onclick="sre_menu.scrollMenu(\''+id+'\',\''+pagename+'\',(-1 * mnucnt))">';
					html +='<img src="/EN/SRESYS/Pic/commonstyle/lesssm.png" height="12"></img>';
					html +='</td>';
					html +='</tr>';	
				}
				html +='</table>';
			}
			if(headfoot =='F'){
				html +='<table border="0" height="100%" width="18"><tr>';
				html +='<td style="cursor:pointer" valign="middle" onclick="sre_menu.scrollMenu(\''+id+'\',\''+pagename+'\',1)">';
				html +='<img src="/EN/SRESYS/Pic/commonstyle/nextsm.png" height="12"></img>';
				html +='</td></tr>';
				if(this.config[id].pageScroll==1){
					html +='<tr>';
					html +='<td style="cursor:pointer" align="center" onclick="sre_menu.scrollMenu(\''+id+'\',\''+pagename+'\',(1 * mnucnt))">';
					html +='<img src="/EN/SRESYS/Pic/commonstyle/moresm.png" height="12"></img>';
					html +='</td>';
					html +='</tr>';	
				}
				html +='</table>';
			}
		}
		//alert(html);	
		return html;
	},	
	
	dataScrollArrows: function(id,headfoot,settings) {
		//alert("scroll "+id);
		this.setSettings(id, settings);
		totalcnt = this.config[id].totcnt	
		
		if(this.config[id].scrollMenuIndex > -1) {
			this.config[id].prev=1;
		} else {
			this.config[id].prev=0;
		}
		if(this.config[id].scrollMenucount + this.config[id].scrollMenuIndex >= totalcnt ){
			this.config[id].nxt=0;
		}else{
			this.config[id].nxt=1;
		}
	
		html='';
		pagename = this.config[id].PageName;
		mnucnt =parseInt(this.config[id].scrollMenucount);
		//alert(mnucnt);
		if(this.config[id].scrollableData == 1){
			if(headfoot =='H'){
				html +='<table border="0" width="100%" height="18"><tr>';
				if(this.config[id].pageScroll==1){
					html +='<td style="cursor:pointer" align="center" onclick="sre_menu.scrollMenu(\''+id+'\',\''+pagename+'\',(-1 * mnucnt))">';
					html +='<img src="/EN/SRESYS/Pic/commonstyle/lesssm.png" height="12"></img>';
					html +='</td>';
				}
				html +='<td style="cursor:pointer" align="center" onclick="sre_menu.scrollMenu(\''+id+'\',\''+pagename+'\',-1)">';
				html +='<img src="/EN/SRESYS/Pic/commonstyle/prevsm.png" height="12"></img>';
				html +='</td>';
				html +='</tr></table>';
			}
			if(headfoot =='F'){
				html +='<table border="0" width="100%" height="18"><tr>';
				html +='<td style="cursor:pointer" align="center" onclick="sre_menu.scrollMenu(\''+id+'\',\''+pagename+'\',1)">';
				html +='<img src="/EN/SRESYS/Pic/commonstyle/nextsm.png" height="12"></img>';
				html +='</td>';
				if(this.config[id].pageScroll==1){
					html +='<td style="cursor:pointer" align="center" onclick="sre_menu.scrollMenu(\''+id+'\',\''+pagename+'\',(1 * mnucnt))">';
					html +='<img src="/EN/SRESYS/Pic/commonstyle/moresm.png" height="12"></img>';
					html +='</td>';					
				}
				html +='</tr></table>';
			}
		}
	//alert("hm");
		return html;
	}	
};
/* -----------------------END(sre_menu)---------------------------------- */

/* ---------------------Begin(sre_pop_msg)---------------------------------- *\
Usage:
Make sure we have the whole body element has ONE envelop table element. All other table elements can go withing it. This envelop table
element MUST have an ID [preferably : sre_page_container].
A div MUST exist right after the body tag BEFORE the envleop table. Div MUSt have an ID [preferably : sre_pop_msg]:
<div id="sre_pop_msg" style="position:absolute;z-index:9999;visibility:hidden;opacity:0.0;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);"></div>
Usage:
	msg = new sre_pop_msg.Settings();
	msg.setHeader("This is the header");
	msg.popWidth = "250";
	sre_pop_msg.msgPop ("msgid",msg,"page setup function name");

the page set up function should return html that will be shown in the content of the page. This page
MUST have event [MUST BE CALLED ] 
sre_pop_msg.msgClose ("msgid","S [for submit]","param to be sent to event"); 

\* ---------------------------------------------------------------------- */
var sre_pop_msg = {
	Settings: function() {
		this.TopColor = "rgb(0,0,224)";
		this.BottomColor = "rgb(0,0,224)";
		this.popMsgId = "";
		this.headerMsg = "";
		this.backFade = 0;
		this.rounding = 'smallsss';
		this.PageName='';
		this.noHeader=0;
		this.tabDiv = "sre_page_container_shadow"; // this is the envelop table for the page
		this.popDiv = "sre_pop_msg"; // this is the parent div for the popup
		this.popWidth = "500";  //this is the default width of the popup, can be "50%" etc
		this.popHeight = "50";  //this is the default width of the popup, can be "50%" etc
		this.fixHeight = 1;
		this.absolutePos=0;
		this.popTop = 0;  //this is the default top of the popup, if "AUTO" set at middle of page
		this.popLeft = 100;  //this is the default top of the popup, if "AUTO" set at middle of page
		this.diablePage = 1;
	//	this.MaxHeight = 300;
		this.setHeader = function(header) {
				this.headerMsg = header;
		};
	},
config: new Array(),
setSettings: function(n, settings) {
	if(typeof(settings) != "object") {
		this.config[n] = new this.Settings();
	}
	else {
		this.config[n] = settings;
	}
	this.config[n].popMsgId = n;
},
setScrollPos: function(){
        var shadow = document.getElementById("sre_page_container_shadow");
	t = sre_scrollTop();
	l = sre_scrollLeft();
	shadow.style.top = t;
	shadow.style.left = l;
},
setLayerPosition: function(){
        var shadow = document.getElementById("sre_page_container_shadow");
	var bws = this.getBrowserHeight();
        shadow.style.width = bws.width + "px";
        shadow.style.height = bws.height + "px";
	this.setScrollPos();
},
disablePage: function(){
        var shadow = document.getElementById("sre_page_container_shadow");
	this.setLayerPosition();
	shadow.style.display = "block";
	
},
enablePage: function(){
        var shadow = document.getElementById("sre_page_container_shadow");
	this.setLayerPosition();	
	shadow.style.display = "none";
},
getBrowserHeight: function () {
        var intH = 0;
        var intW = 0;
        if(typeof window.innerWidth  == 'number' ) {
                intH = window.innerHeight;
                intW = window.innerWidth;
        } 
        else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
                intH = document.documentElement.clientHeight;
                intW = document.documentElement.clientWidth;
        }
        else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
                intH = document.body.clientHeight;
                intW = document.body.clientWidth;
	}
        return { width: parseInt(intW), height: parseInt(intH) };
},  
msgClose: function (num,action,param) { //action C: cancel S: submit
	if((!action) || (action =='undefined')){
		action = 'S';
	}
	if(!this.config[num].PageName) {this.config[num].PageName = SRESelectedPage; }
	pagename = this.config[num].PageName;
	var str ="";
	str += '_PopMsgClose("';
	str += this.config[num].popMsgId;
	str += '","';
	str += action;
	str += '","';
	str += param;
	str += '")';
	// hide the popmsg
	fl = document.getElementById(this.config[num].popDiv);
	fl.innerHTML = '';
	fl.style.visibility = "hidden";
	//sre_core.lightUp(this.config[num].popDiv,50);
	if(this.config[num].diablePage==1){
		this.enablePage();
		sre_core.lightUp(this.config[num].tabDiv,100);
		scr = $(this.config[num].tabDiv);
		scr.disabled="false";
	}
	eval( pagename + str);
},	
msgPop: function (num,settings,popfunc,noeval,param){
	html=''; if(!noeval) noeval =false;
	this.setSettings(num, settings);
	//fade background
	if(this.config[num].diablePage==1){
		this.disablePage();
		sre_core.lightUp(this.config[num].tabDiv,this.config[num].backFade);
		scr = $(this.config[num].tabDiv);
		scr.disabled="true";		
	}
	if(param){
		fn= 'SRE_REQUEST_';
		fn +=num;
		$(fn).value=param;
	}	
	html+='<div id="popout" style="z-index:2">';	
		html+='<table border="0" cellpadding="3" cellspacing="0" width="100%"  style="background-color:aaaaaa">';
			html+='<tr>';
				html+='<td >';
					html+='<div id="poptryus" >';
						html+='<table border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color:rgb(255,255,255);">';
							html+='<tr>';
								html+='<td colspan="3" align="left" height="0" width="100%">';
									if(this.config[num].noHeader == 0){
									html+='<table border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color:#ffffff;">';
										html+='<tr>';
											html+='<td width="100%">';
												html+='<span class="popMsgHeader" >&nbsp;&nbsp;';
													html+=this.config[num].headerMsg ;
												html+='</span>';
											html+='</td>';
											html+='<td width="10" style="background-color:transparent">';
												html +='<table border="0"  cellpadding="0" cellspacing="0" ><tr ><td >';
												html +='<form id="frm_'+num+'" name="'+num+'" ';
												html +=' method="post" action=""';
												html +='><input type="text" size="1" style="visibility:hidden;" id="SRE_REQUEST_'+num+'" name="SRE_REQUEST_'+num+'" value="" ></input>';
												//html +='><input type="text" size="1" style="visibility:hidden;" id="SRE_CALLBACK'+num+'" name="SRE_CALLBACK" value="'+callbck+'" ></input>';
												
												html +='</form>';
												html +='</td></tr></table>';
											html+='</td>';
											html+='<td nowrap colspan="2" align="right" height="5" width="72" style="background-color:#ffffff">';
												html+='<span  nowrap style="cursor:pointer;padding-top:4;color:#000077;text-align:right;padding-right:10;font-family:Arial;font-size:9pt;font-style:normal;font-weight:bold;" onclick="sre_pop_msg.msgClose(\''+num+'\',\'SRE_CANCEL\',\'\')">Close &nbsp;';//onmouseover="showToolTip(\'Close window\',event)" onmouseout="hideToolTip()" 
													html+='<img src="/EN/SRESYS/Pic/commonstyle/cancel.PNG" height="20" width="20" ></img>';
												html+='</span>';
											html+='</td>';
										html+='</tr>';
									html+='</table>';
									}
								html+='</td>';
							html+='</tr>';
							html+='<tr>';
								html+='<td  colspan="3" style="background-color:rgb(112,146,190);padding-left:4;padding-right:4;height:1;"></td>';
							html+='</tr>';
							html+='<tr>';
								html+='<td   colspan="3" style="padding-left:0;padding-right:0;">';
									html+='<div id="TryusInner" >';
										html+='<table border="0" cellpadding="0" cellspacing="0" width="100%" >';
											html+='<tr>';
												html+='<td align="center"  valign="middle" style="background-color:rgb(255,255,255)">';
													html+='<table border="0" cellpadding="3" cellspacing="0" width="90%"  style="background-color:transparent">';
														html+='<tr>';
															html+='<td style="padding-top:0;padding-bottom:0;">';
																html+='<div id="divembed" ></div>'; /****** ADDED -NOT TESTED ******/
																if(this.config[num].fixHeight == 1) {
																	html+='<div class="menuscroll" style="height:'+this.config[num].popHeight+'" >';
																}
																
																	// ++++++++++++++
if(noeval == true) {
	html += popfunc;
} else {
	html += eval(popfunc+ "()");
}
																html+='</div>';
															html+='</td>';
														html+='</tr>';
													html+='</table>';
												html+='</td>';
											html+='</tr>';
										html+='</table>';
									html+='</div>';
								html+='</td>';
							html+='</tr>';
						html+='</table>';
					html+='</div>';
				html+='</td>';
			html+='</tr>';
		html+='</table>';
	html+='</div>';
	//alert(html);
	fl = document.getElementById(this.config[num].popDiv);
	fl.innerHTML = html;
	fl.style.visibility = "visible";


	//	this.popTop = "200";  //this is the default top of the popup, if "AUTO" set at middle of page

	//if(this.config[num].popTop == "AUTO"){
	//	winHeight = sre_core.windowSize('V');
	//	winHeight = Math.ceil(winHeight / 2);
	//} else {
	//	winHeight = this.config[num].popTop;
	//}
//	hei = sre_core.windowSize('V');
//	this.popWidth =wd;  
//	this.popTop = 0; 

	winwidth = sre_core.windowSize('H');
	winHeight = sre_core.windowSize('V');

if(this.config[num].popHeight > winHeight) {
	this.config[num].popHeight = winHeight;
}
		st = sre_scrollTop();
		sl = sre_scrollLeft();

	if(this.config[num].absolutePos !=1){
		//winwidth = Math.ceil((winwidth - this.config[num].popWidth)/ 2);
		fl.style.top = st +this.config[num].popTop;//winHeight;
		fl.style.left = sl +this.config[num].popLeft;//winwidth;
	} else {
		fl.style.top = this.config[num].popTop;//winHeight;
		fl.style.left = this.config[num].popLeft;//winwidth;
	}
	
	fl.style.height = this.config[num].popHeight;//winHeight -50;
	fl.style.width = this.config[num].popWidth;//winwidth -30;
	strdv = "div#"
	strdv += this.config[num].popDiv;
	// need "div#container" format for div to work
	sre_core.lightUp(this.config[num].popDiv,100);
sre_rounded.Rounded("div#TryusInner","transparent","rgb(255,255,255)","rgb(255,255,255)","small");
return fl;
//sre_rounded.Rounded("div#poptryus","transparent","rgb(212,212,212)","rgb(212,212,212)","small");
//sre_rounded.Rounded("div#popout","transparent","transparent","transparent","smallss");
}
};

/* -----------------------END(sre_pop_msg)---------------------------------- */



/* ---------------------Begin(sre_flytab)---------------------------------- *\
 * eMiliue v1.0 Copyright (c) 2010 Sreejon LLC 
 * Contact us at sreejon2006@msn.com
 * This copyright notice MUST stay intact for use.
 *
 * $Revision: 1.0 $
Dependency :	[Meant to work with Sreejon message structure ]
				No individual controls for popup must exist
Description :	 Allows vertical tabs on a page 
Usage: Simple function call
\* ---------------------------------------------------------------------- */

var sre_flytab = {
	Settings: function() {
		this.TabId;
		this.TabType = 'H';
		this.DivId;
		this.FlyTabArraySet;
		this.PageName='';
		this.selindx=1;
		this.TabWidth='20';
		this.BackgroundColor = '#ffffff'; //'#B4E9FF';
		this.Color ='#000';
		this.totaltab =1;
		this.H4Cls='h4_sre_fly';
		this.ControlWidth =1205;
		this.TabPageWidth =1205;
		this.SectionHeight='818';
		this.Fontsize="12";
		this.BackGround="url('/EN/SRESYS/Pic/commonstyle/menuregvert.png') #ffffff repeat-y";
		this.SelectColor='#337700';
		this.addTabArray = function(flytbArray) {
				this.FlyTabArraySet = flytbArray;
		};
	},
	config: new Array(),
	setSettings: function(n, settings) {
		if(typeof(settings) != "object") {
			this.config[n] = new this.Settings();
		}
		else {
			this.config[n] = settings;
		}
	},
	drawFlyTab: function (cont,num,settings,cnt){
		flyhtml='';this.setSettings(num,settings);var Words = new Array();
		//alert(cnt);
		widthadjust = parseInt(cnt) * (parseInt(this.config[num].TabWidth)) ;
		this.config[num].totaltab=cnt;
		this.config[num].ControlWidth -= widthadjust;
		this.config[num].TabPageWidth -= widthadjust;
		flyhtml +='<div id="flyout'+num+'" >';//style="width:'+this.config[num].ControlWidth+'; background-color:blue">';
		dvid = "flyout"+ num;
		//alert(this.config[num].FlyTabArraySet.length);
		for(k= 0; k < this.config[num].FlyTabArraySet.length; k++){
			sre_core.initializeList(Words);
			sre_core.breakWords(this.config[num].FlyTabArraySet[k],Words);
			flyhtml +='<div  class="'+num+'" style="width:'+this.config[num].TabPageWidth+';font-size:'+this.config[num].Fontsize+';background:'+this.config[num].BackGround+';" >';
			if (k == this.config[num].selindx){
				flyhtml +='<h4 id="h4_'+num+k+'" onclick="sre_flytab.show(\'h4_'+num+k+'\',\''+num+'\',\''+k+'\');" class="showfirst" style="padding-left:5">';
				flyhtml += Words[2];
			flyhtml +='<div style="padding-left:'+this.config[num].TabWidth+';" ><span><table border="0" height="100%" width="100%"><tr><td valign="top"><div id="'+Words[3]+'" style="height:100%;padding-left:1;text-align:top;background-color:'+this.config[num].BackgroundColor+';"></div></td></tr></table></span></div>';//></div>';
				
				flyhtml +='</h4>';
			} else {//\'h4_'+num+k+'\'
				flyhtml +='<h4 id="h4_'+num+k+'" onclick="sre_flytab.show(\'h4_'+num+k+'\',\''+num+'\',\''+k+'\');" style="padding-left:5">';
				
				flyhtml += Words[2];
			flyhtml +='<div style="padding-left:'+this.config[num].TabWidth+';" ><span><table border="0" height="100%" width="100%"><tr><td valign="top"><div id="'+Words[3]+'" style="height:100%;padding-left:1;text-align:top;background-color:'+this.config[num].BackgroundColor+';"></div></td></tr></table></span></div>';//></div>';
				
				flyhtml +='</h4>';
			}
			//flyhtml +='<div style="padding-left:20;" ><span><table border="1" height="100%" width="100%"><tr><td valign="top"><div id="'+Words[3]+'" style="padding-left:0;text-align:top;background-color:transparent;"></div></td></tr></table></span></div>';//></div>';
			flyhtml +='</div><!-- section -->';
		}
		flyhtml +='</div> <!-- flyout -->';
		vv = document.getElementById(cont);
		if(vv) {
			//alert(flyhtml);
			vv.innerHTML = flyhtml;
		}
	},
	show: function (id,num,selindx) { // do not remove
	   Me = $(id);
	   var section = Me.parentNode;
	   //alert(id+'-'+num+'-'+selindx);;
	  // alert("me    " +Me);
	   var menu = section.parentNode;
	   for(var i = 0; i < menu.childNodes.length; i++) {
	      if (menu.childNodes[i].length == 0) continue;
	      if (typeof menu.childNodes[i].style != 'object') continue;
	      menu.childNodes[i].style.width = this.config[num].TabWidth;//20;//'2em'; //
	      menu.childNodes[i].style.backgroundColor = this.config[num].BackgroundColor;//'#B4E9FF'; //
	      menu.childNodes[i].style.color = this.config[num].Color;//'#000';//
	      menu.childNodes[i].style.height = this.config[num].SectionHeight;//545;;
	      menu.childNodes[i].style.background = this.config[num].BackGround;//545;;
	   }
		//cnt=this.config[num].totaltab;
		//widthadjust = parseInt(cnt) * (parseInt(this.config[num].TabWidth));
		//this.config[num].ControlWidth -= widthadjust;
		//this.config[num].TabPageWidth -= widthadjust;
	   
	   section.style.width = this.config[num].TabPageWidth;//'567px'; //
	   section.style.background = this.config[num].BackGround;//"url('/EN/SRESYS/Pic/commonstyle/flyback.jpg') #ffffff repeat-y"; //this.config[num].BackGround;
	   section.style.color = this.config[num].SelectColor;//'#0000ff';//
	   section.style.height = this.config[num].SectionHeight;//545;//this.config[num].SectionHeight;
	if(!selindx){
		selindx = this.config[num].selindx;
	}
	
	var str ="";
		str += '_FlyTabClick(\"';
		str += num;
		str += '\",\"';
		str += selindx;
		str += '\")';
		str1 = this.config[num].PageName + str;
		eval(str1);
	  return true;
	},
	showfirst: function (num,settings) { // do not remove
		this.setSettings(num,settings);
		if (!document.getElementsByTagName) return;
		var a = document.body.getElementsByTagName("div");
		divid="flyout" + num;
		for (i = 0; i < a.length; i++) {
			if (a[i].id == divid) {
				if (typeof a[i].style != 'object') continue;
				var x = a[i].getElementsByTagName("h4");
				for (j = 0; j < x.length; j++) {
					if (x[j].className == "showfirst") {
						if (typeof x[j].style != 'object') continue;
						//alert("id   " +x[j].id);
						this.show(x[j].id,num,0);
						return;
					}
				}
			}
		}
	}	
};
/* -----------------------END(sre_flytab)---------------------------------- */


/* ---------------------Begin(sre_tab)---------------------------------- *\
 * eMiliue v1.0 Copyright (c) 2010 Sreejon LLC 
 * Contact us at sreejon2006@msn.com
 * This copyright notice MUST stay intact for use.
 *
 * $Revision: 1.0 $
Dependency :	[Meant to work with Sreejon message structure ]
				No individual controls for popup must exist
Description :	All dynamic form elements. also can be used as individual controls  
Usage: Simple function call
\* ---------------------------------------------------------------------- */

var sre_tab = {
	Settings: function() {
		this.TabId;
		this.TabType = 'H';
		this.DivId;
		this.Width="60";
		this.Height="10";
		this.PicWidth="20";
		this.PicHeight="20";
		this.TabArraySet;
		this.PageName='';
		this.selindx=0;
		this.picType=0;//picture, instead of letter 0: only letter 1: only pic 2: both
		this.regHcls ='hTabreg';
		this.selHcls ='hTabsel';
		this.BackHcls='hTabBackg';
		this.regVcls ='/EN/SRESYS/Pic/commonstyle/regVtab.jpg'; //not supported
		this.selVcls ='/EN/SRESYS/Pic/commonstyle/selVtab.jpg'; //not supported
		this.BackVcls='hTabBackg'; //not supported
		this.BackColor='transparent';
		this.addTabArray = function(tbArray) {
				this.TabArraySet = tbArray;
		};
	},
	config: new Array(),
	//TabElements:  new Array(),
	setSettings: function(n, settings) {
		if(typeof(settings) != "object") {
			this.config[n] = new this.Settings();
		}
		else {
			this.config[n] = settings;
		}
	},
	changeTabs: function (code,desc,indx,cont,num){
		//alert(code+'-'+desc+'-'+indx+'-'+cont+'-'+num);
		this.config[num].selindx = indx;
		sre_tab.drawTab(cont,num,this.config[num]);
		pagenm = this.config[num].PageName;
		str ="";
		str += '_TabChanged("';
		str += num;
		str += '","';
		str += code;
		str += '","';
		str += desc;
		str += '")';
		eval( pagenm + str);
	},
	drawTab: function (cont,num,settings){
		this.setSettings(num,settings);
		var html='';var status = 0; var Words = new Array();
		html += '<table border="0"  cellpadding="0" cellspacing="0" width="'+this.config[num].Width+'" height="'+this.config[num].Height+'">';
		if(this.config[num].TabType =='H') { //horizontal tab
			//html += '<tr><td height="100%"></td><tr>';
			html += '<tr class="'+this.config[num].BackHcls+'" height="'+this.config[num].Height+'" style="background-color:'+this.config[num].BackColor+'">';
			//alert(this.config[num].TabArraySet.length);
			for(k= 0; k < this.config[num].TabArraySet.length; k++){
				sre_core.initializeList(Words);
				sre_core.breakWords(this.config[num].TabArraySet[k],Words);
				html += '<td valign="baseline" nowrap onclick="sre_tab.changeTabs(\''+Words[0]+'\',\''+Words[2]+'\',\''+k+'\',\''+cont+'\',\''+num+'\')" height="'+this.config[num].Height+'">';
				if (k == this.config[num].selindx){
					html += '&nbsp;<span nowrap id="hpdisplay'+num+'" class="'+this.config[num].selHcls+'" style="cursor:pointer;height:'+this.config[num].Height+';">&nbsp;';
					if((this.config[num].picType==1)|| (this.config[num].picType==2)){
						html +='<img src="'+Words[3]+'" width="'+this.config[num].PicWidth+'" height="'+this.config[num].PicHeight+'" style="padding-top:2"></img>';
					}
					if((this.config[num].picType==0)|| (this.config[num].picType==2)){
						html +=Words[2];
					}
					html += '&nbsp;</span>';
				} else {
					html += '&nbsp;<span nowrap id="hpdisplay'+num+'" class="'+this.config[num].regHcls+'" style="cursor:pointer;height:'+this.config[num].Height+';">&nbsp;';
					if((this.config[num].picType==1)|| (this.config[num].picType==2)){
						html +='<img src="'+Words[3]+'" width="'+this.config[num].PicWidth+'" height="'+this.config[num].PicHeight+'" style="padding-top:2"></img>';
					}
					if((this.config[num].picType==0)|| (this.config[num].picType==2)){
						html +=Words[2];
					}
					html += '&nbsp;</span>';
				}
				html += '</td>';
				//html += '<td width="1">&nbsp;';
				//html += '</td>';
				
			}
			html += '<td  width="100%" ><div id="tabextra"></div>';
			html += '</td>';
			html += '</tr>';
		} else if(this.config[num].TabType =='V') { //vertical tab not supported
		}
		html += '</table>';
		//alert(html);
		vv = document.getElementById(cont);
		if(vv) {
			vv.innerHTML = html;
		}
	}	
};
/* -----------------------END(sre_tab)---------------------------------- */

/* ---------------------Begin(sre_dynform)---------------------------------- *\
 * eMiliue v1.0 Copyright (c) 2010 Sreejon LLC 
 * Contact us at sreejon2006@msn.com
 * This copyright notice MUST stay intact for use.
 *
 * $Revision: 1.0 $

Dependency :	[Meant to work with Sreejon message structure ]
				No individual controls for popup must exist

Description :	All dynamic form elements. also can be used as individual controls  

Usage: Simple function call

\* ---------------------------------------------------------------------- */

var sre_dynform = {
	Settings: function() {
		this.dynFrmId = '';
		this.pageName = '';
		this.borderColor = 'aaaaaa';
		this.backColor = 'rgb(230,230,255)';
		this.fromName = 'SRE_ACTIONFORM';
		this.divName = "sre_body_element";
		this.noBackBorder = 0;
		this.dynArray;
		this.addDynArray = function(dynArray) {
				//sre_core.initializeList(this.dynArray);
				this.dynArray = dynArray;
		};
	},
config: new Array(),
varlist: new Array(),
vardone: new Array(),
txtarealist: new Array(),
txtareatbstate: new Array(),
txtareastate: new Array(),

getDynArray: function(num) {
	return this.config[num].dynArray;
},
isDone: function(num,indx) {
	for(i=0;i < this.vardone[num].length; i++ ) {
		if(this.vardone[num][i] == indx) {
			return 1;
		}
	}
	return 0;
},
setSettings: function(n, settings) {
	if(typeof(settings) != "object") {
		this.config[n] = new this.Settings();
	}
	else {
		this.config[n] = settings;
	}
	sre_core.initializeList(this.varlist[n]);sre_core.initializeList(this.vardone[n]);
	this.varlist[n]=null;this.vardone[n]=null;
	this.varlist[n] = new Array();
	this.vardone[n] = new Array();
	this.config[n].dynFrmId = n;
	
	this.config[n].pageName = SRESelectedPage;
	
},
dynForm: function (num, settings)	{
	this.setSettings(num, settings);
	html=''; var Words = new Array();var tbindx=0;
	dv = this.config[num].divName;
	this.config[num].dynFrmId =  this.config[num].fromName;

	frmname = this.config[num].fromName;

	v = $(dv);
	if(this.config[num].noBackBorder==0){
		html+='<table border="0" cellpadding="3" cellspacing="0" width="100%"  style="background-color:'+this.config[num].borderColor+'">';
			html+='<tr>';
				html+='<td >';	
		html +='<table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0" style="background-color:'+this.config[num].backColor+'">';
	} else {
		html+='<table border="0" cellpadding="3" cellspacing="0" width="100%"  >';
			html+='<tr>';
				html+='<td >';	
		html +='<table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0" >';
	}
	html +='<tr height="5">';
	html +='<td colspan="6" >';
	html +='<form name="'+frmname+'" id="'+frmname+'">';	
	html +='</td>';
	html +='</tr>';
	
	var holdArray = new Array();
	holdArray = this.config[num].dynArray;
	len = this.config[num].dynArray.length;
//alert(len);	
	for(j=0;j < len; j++){
		sre_core.breakWords(this.config[num].dynArray[j],Words);
		//alert(sre_controls.checkDone(frmname,Words[3]));
		//alert(Words[3]+'----'+sre_controls.checkDone(frmname,Words[3]));
			
/*//	 */		if(sre_controls.checkDone(frmname,Words[3]) == -1){
			//	alert("check done : "+sre_controls.checkDone(frmname,Words[3]));
		/*
			if (Words[1] != "SPACE"){
				if((Words[10] ==' ') ||(Words[10] =='') ){
					Words[10] = parseInt(j + 1);
				}
				
				if((Words[9] != " ")&&(Words[9] != "")){
					html +='<tr>';
					html +='<td colspan="2"></td><td colspan="3">';
					html +='<span class="formctlmsg">';
					html += Words[9];
					html +='</span>';
					html +='</td >';
					html +='<td >';
					html +='</td >';
					html +='</tr>';
					html +='<tr>';
					html +='<td colspan="5" height="10">';
					html +='</td >';
					html +='</tr>';
				}
			}
		*/
					html +='<tr>';
					if(Words[1] == "SPACE"){
						lidt = "l_" + Words[3];
						html +='<td nowrap colspan="4" height="25" align="center">';
						html +='<span id="'+lidt+'" class="formctltrans" style="visibility:visible" nowrap>';
						html +=Words[0];
						html +='</span>';						
						html +='</td>';
					} else {
					html +='<td nowrap align="right">';
					
					if((Words[1] == "TEXT") || (Words[1] == "TEXTAREA") ||(Words[1] == "PASSWORD")){
						lidt = "l_" + Words[3];
						
						html +='<span id="'+lidt+'" class="formctltrans" style="visibility:visible" nowrap>';
						html +=Words[0];
						html +='</span>';
					}
					html +='</td>';
					html +='<td width="20"  nowrap >';
					if((Words[1] == "TEXT") || (Words[1] == "TEXTAREA") || (Words[1] == "PASSWORD") ||  (Words[1] == "CHECKBOX") ||  (Words[1] == "RADIO")){
						if(Words[6]=='Y'){
							lidi =  Words[3] + "_I"; 
							html +='&nbsp;<img id="'+lidi+'" src="../../../EN/SRESYS/Pic/commonstyle/requiredBang.gif" style="visibility:visible" height="6" width="6" ></img>';
						}
					}
					html +='</td>';
					x = eval("Words[3]");
					y = eval(x);
					if(Words[1]== "TEXTAREA" ){
						html +='<td >';
						fhtml='';
						//fhtml +='<textarea id="'+Words[3]+'"></textarea>';
						fhtml += sre_controls.textAreaCtl(frmname,Words[3],Words[2],Words[4],Words[5],"visible",y,Words[7],Words[10]);
						html += fhtml;
						this.txtarealist[this.txtarealist.length] = { 
							name: Words[3],
							size: Words[4],
							height: Words[5],
							vass: Words[7],
							value: y
							};
						html +='</td>';
						//html +='</tr>';
					}
					if((Words[1]== "TEXT") || (Words[1]== "PASSWORD") ){
						//alert(Words[10]+'++');
						
						html +='<td nowrap >';
						thtml='';
						thtml = sre_controls.formCtl(frmname,Words[3],Words[1],Words[2],Words[4],Words[5],"visible",y,Words[7],'',Words[10]);
						html += thtml;
						html +='</td>';
						
					}
					//html +='</tr>';
	
					if(Words[1]== "RADIO" ){
							var hArray = new Array();
							hArray = this.config[num].dynArray;
							ln = this.config[num].dynArray.length;

						var RWrd = new Array();
						for(k=0;k < hArray.length; k++){
							sre_core.breakWords(hArray[k],RWrd);
							if(RWrd[3] == Words[3]){
								if(!this.isDone(num,k)) {
									this.vardone[num][this.vardone[num].length] = k;RWrd[0] ;
									html +='<tr>';
									html +='<td >';
									x = eval(RWrd[3]);
									y = eval(x); 
								//	alert(RWrd[3]+'--'+RWrd[8]+'--'+y);
									html +='<td colspan="4" nowrap>';
									fhtml='';
									if(y == RWrd[8]) {
										fhtml = sre_controls.radioCtl(frmname,RWrd[3],RWrd[2],"visible",y,'Y',RWrd[0],RWrd[0],'RIGHT','',Words[10]);
									} else {
										fhtml = sre_controls.radioCtl(frmname,RWrd[3],RWrd[2],"visible",y,'N',RWrd[0],RWrd[0],'RIGHT','',Words[10]);
									}
									html += fhtml;
									html +='</td>';
									html +='</tr>';
								}
							}
						}
					}

//	alert(Words[1]+'--'+Words[3]+'--'+Words[8]);
				if(Words[1]== "CHECKBOX" ){
						x = eval("Words[3]");
						y = eval(x); 
						html +='<td colspan="1"  nowrap>';
						fhtml=''; 
						if(y == 'Y') {
							fhtml = sre_controls.checkCtl(frmname,Words[3],Words[2],"visible",y,'Y',Words[0],Words[0],'RIGHT','formctl',Words[10]);
						} else {
							fhtml = sre_controls.checkCtl(frmname,Words[3],Words[2],"visible",y,'N',Words[0],Words[0],'RIGHT','formctl',Words[10]);
						}
						html += fhtml;
						html +='</td>';
					}
						html +='<td colspan="1" nowrap >';					
							if((Words[9] != " ")&&(Words[9] != "")){
								if((Words[11] != " ")&&(Words[11] != "")){
									ttp = Words[11];
								//	html +='<span class="frmctrl" >';
								//	html += Words[11];
								//	html +='</span>';
	
								}
								html +='<img style="cursor:pointer" id="hlpimg_'+Words[9]+'" src="/EN/SRESYS/Pic/commonstyle/Help.gif" height="20" onclick="';
								html += Words[9];
								html +='()" ></img>';
								//html +='()" onmouseover="showToolTip(\''+ttp+'\',event,\'hlpimg_'+Words[9]+'\')" onmouseout="hideToolTip()"></img>';
      								//html +='" onmouseover="showToolTip('+(Words[11]+',event,img_'+Words[9]+')" onmouseout="hideToolTip()"></img>';

							}
					
						html +='</td>';
					//alert(html);
					}
					html +='</tr>';
					html +='<tr>';
					html +='<td  colspan="6" height="5" >';
					html +='</td >';
					html +='</tr>';
					
			if (Words[1] != "SPACE"){
				if((Words[10] ==' ') ||(Words[10] =='') ){
					Words[10] = parseInt(j + 1);
					//alert(Words[10]);
				}
				if(Words[12]){
				if((Words[12] != " ")&&(Words[9] != "")){
					html +='<tr>';
					html +='<td colspan="2"></td><td colspan="3">';
					html +='<span class="formctltrans">';
					html += Words[12];
					html +='</span>';
					html +='</td >';
					html +='<td >';
					html +='</td >';
					html +='</tr>';
					html +='<tr>';
					html +='<td colspan="5" height="10">';
					html +='</td >';
					html +='</tr>';
				}
				}
				
/*//	*/		}
		}
	}

	html +='<tr height="5">';
	html +='<td colspan="6" style="background-color:'+this.config[num].backColor+'">';
	html +='<input type="text" size="10" style="visibility:hidden;" name="SRE_REQUEST" value=""></input>';
	html +='<input id="sre_submit" type="submit" style="visibility:hidden;" name="SRE_SUBMIT" value="Send" onclick=""></input>';
	html +='</form>';
	html +='</td>';
	html +='</tr>';
	html +='</table>';

				html+='</td>';
			html+='</tr>';
		html+='</table>';		
	v.innerHTML = html;
//alert("config : "+ frmname);
	for (ta=0; ta < sre_dynform.txtarealist.length; ta++) {
		thtml =''; 
		if($("sre_showTa")) $("sre_showTa").innerHTML ="";
		nam = sre_dynform.txtarealist[ta].name;
		val = sre_dynform.txtarealist[ta].value;
		vass = sre_dynform.txtarealist[ta].vass;
		thtml +='<div class="textwrapper"><textarea class="textwrapper" id="'+nam+'" name="'+nam+'_N" cols="'+sre_dynform.txtarealist[ta].size+'" style="visibility:visible" wrap="soft" rows="'+sre_dynform.txtarealist[ta].height+'"  value="'+val+'" onFocus="sre_controls.focusVal(\''+frmname+'\',\''+nam+'\')" onchange="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" onblur="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)">'+val+'</textarea></div>' ;
		//alert(thtml);
		if($("sre_showTa")) $("sre_showTa").innerHTML = thtml;
		if(vass =='Y'){
			sre_controls.showTextAreaButton(frmname,nam,null);
		} else {
			tb = $("sre_txtar_toolb_"+nam);
			tb.innerHTML='';
		}
	}
},
getDynNameValue: function(num,settings){ /******Example : sre_dynform.getDynNameValue("auth",mainform); ****`*/

	var Words = new Array();
	var y='';
	fhtml='';
	fhtml +='SREResponse=';
	for(j=0;j < this.config[num].dynArray.length; j++){
		sre_core.breakWords(this.config[num].dynArray[j],Words);
		if((Words[1] == "TEXT") || (Words[1] == "TEXTAREA") ||
			(Words[1] == "CHECKBOX") || (Words[1] == "PASSWORD") || (Words[1] == "RADIO")){
			//fhtml +='<';
			fhtml +=Words[3];
			fhtml +=':';
			x = eval("Words[3]");
			if ((Words[1] == "CHECKBOX") || (Words[1] == "RADIO"))	{
				tc2 = document.getElementById(x);	
				y = tc2.value;
			}
			if((Words[1] == "TEXT") || (Words[1] == "PASSWORD") )	{
				y = eval(x);
				y = sre_controls.webToTxt(y);
				if(Words[8] =='Y') {
					y=sreEnc(y);
					//alert(y);
					y=DoAsciiHex(y,'A2H');
				}
			} else if(Words[1] == "TEXTAREA" ) {
				if(	this.txtareatbstate[Words[3]] == 1) {
					dv=	"wysiwyg"+ Words[3];
					ct = document.getElementById(dv);
					ct.contentWindow.document.body.innerHTML = sre_core.htmlClean(ct.contentWindow.document.body.innerHTML); 
					
					//y = DoAsciiHex(ct.contentWindow.document.body.innerHTML,'A2H');
					y = sreEnc(ct.contentWindow.document.body.innerHTML);
				} else {
					v = $(x);
					y = v.value;
					y = sre_controls.webToTxt(y);
					//y=DoAsciiHex(y,'A2H');
				//	y=sreEnc(y);
				}
			}
			fhtml +=y;
		//	fhtml +='<\/';
		//	fhtml +=Words[3];
		//	fhtml +='>';
		} else if(Words[1] == "RADIO") {
		} 
		fhtml +='|';
	}
	return fhtml;
},
getDynVarValue: function(num,settings){
//	sre_dynform.setSettings(num, settings);
	var Words = new Array();
	var dupl = new Array();
	var y='';
	fhtml='';
	for(j=0;j < this.config[num].dynArray.length; j++){
		sre_core.breakWords(this.config[num].dynArray[j],Words);
		if((Words[1] == "TEXT") || (Words[1] == "TEXTAREA") ||
			(Words[1] == "CHECKBOX") || (Words[1] == "PASSWORD") || (Words[1] == "RADIO")){
			fhtml +='<';
			fhtml +=Words[3];
			fhtml +='>';
			x = eval("Words[3]");
			if (Words[1] == "CHECKBOX")	{
				tc2 = document.getElementById(x);
				//alert(x);
				y = tc2.value;
			}
			idx=-1;
			if  (Words[1] == "RADIO")	{
				//frmname = this.config[num].fromName;	
				found = 0; 
				ln = dupl.length;
				for( i=0; i < ln; i++) {
					if(dupl[i] == x) { // mainly for an already set radio button
						found = 1; break;
					}
				}
				if(found == 0) { // no duplicate tag
					y = eval(x);
				}
				
				//alert(y);
				//y = tc2.value;
			}
			if((Words[1] == "TEXT") || (Words[1] == "PASSWORD") )	{
				y = eval(x);
				//y = sre_controls.webToTxt(y);
				if(Words[8] =='Y') {
					//y=DoAsciiHex(y,'A2H');
					y=sreEnc(y);
					//alert("===="+y+'====');
					y=DoAsciiHex(y,'A2H');
					//alert("===="+y+'====');
				} else{
				//	y=DoAsciiHex(y,'A2H');
				}
			} else if(Words[1] == "TEXTAREA" ) {
			//
				if(	this.txtareatbstate[Words[3]] == 1) {
					dv=	"wysiwyg"+ Words[3];
					ct = document.getElementById(dv);
					ct.contentWindow.document.body.innerHTML = sre_core.htmlClean(ct.contentWindow.document.body.innerHTML); 
					//y = DoAsciiHex(ct.contentWindow.document.body.innerHTML,'A2H');
					y = sreEnc(ct.contentWindow.document.body.innerHTML);
				} else {
					v = $(x);
					y = v.value;
					
				//	y = sre_controls.webToTxt(y);
				y = y.replace(/\n/g,"^^")
				//	y=DoAsciiHex(y,'A2H');
				//	y=sreEnc(y);
				//alert("value:  "+y);
				}
			}
			fhtml +=y;
			fhtml +='<\/';
			fhtml +=Words[3];
			fhtml +='>';
			dupl[dupl.length] = y;
		} else if(Words[1] == "RADIO") {
//			if(checkDone(Words[3])){
//				fhtml +='<';
//				fhtml +=Words[3];
//				fhtml +='>';
//				x = eval("Words[3]");
//				y = eval(x);
//				fhtml +=y;
//				fhtml +='<\/';
//				fhtml +=Words[3];
//				fhtml +='>';
//			}
		} 
	}
	return fhtml;
},
dynamicMsg: function(num, settings,skipautosub,retv){
	//alert(num);
	//this.setSettings(num, settings);

	var tmp = this.config[num].pageName;//SRESelectedPage;
	var fhhml='';var vals ='';
	if ( skipautosub != 'Y') {
		data= this.getDynVarValue(num, settings);
		fhhml +=sre_message.sreBuildPHPMsg(data) ;

	} else {
	//alert("before : "+this.config[num]);

		fhhml += this.getDynVarValue(num, settings);
	//alert("after : "+this.config[num]);

	}
	vals = fhhml;			
	var fhhml='';var retval="-1";
	if(retv != 'undefined') {
		retval = retv;
	}
	var str ='';
	str += tmp;
	str += '_OnSubmit("';
	str += retval;
	str += '","'
	str += vals;
	str += '")';
	eval(str);
	return vals;
}
};

/* -----------------------END(sre_dynform)---------------------------------- */





/* ---------------------Begin(sre_controls)---------------------------------- *\
 * eMiliue v1.0 Copyright (c) 2010 Sreejon LLC 
 * Contact us at sreejon2006@msn.com
 * This copyright notice MUST stay intact for use.
 *
 * $Revision: 1.0 $

Dependency :	[Meant to work with Sreejon framework ]
Description :	  
Usage: 
\* ---------------------------------------------------------------------- */

/***************************************************************************************************************************/
var sre_controls = {
	Settings: function() {
		this.enableHovClass ='formctlhov';
		this.enableGenClass = 'formctl';
		this.disableGenClass = 'formctl';
		
	//	this.disableHovClass ='formctl';
	//	this.disableCHovClass ='chkctl';
	//	this.disableCGenClass = 'chkctl';
	//	this.hiddenHovClass ='formctltrans';
	//	this.hiddenGenClass = 'formctltrans';
	//	this.hiddenCHovClass ='chkctltrans';
	//	this.hiddenCGenClass = 'chkctltrans';
	//	this.enableCHovClass ='chklhov';
	//	this.enableCGenClass = 'chkctl';
	//	
	//	this.pageName='';
	},
config: new Array(),
txtareaArr: new Array(),

setSettings: function(n) {
	if(typeof(settings) != "object") {
		this.config[n] = new this.Settings();
	}
	else {
		this.config[n] = settings;
	}
	if(typeof(sre_dynform.config[n]) !="object") {
		sre_dynform.setSettings(n);
	}
	this.config[n].pageName = sre_dynform.config[n].pageName;
	//alert(this.config[n].pageName+'--++---');	
},
formCtl: function (frmname,nam,typ,stat,siz,maxlen, vis,val,visAss,vispic,tbindx){
	this.setSettings(frmname);
	var last_indx = sre_controls.checkDone(frmname,nam); // should return -1 (control not created) else return, do not create same control.
	if(last_indx != -1) return;
	fhtml=''; hovclass ='';genclass = '';
	if(stat == 'E'){
		//hovclass ='formctlhov';
		genclass = this.config[frmname].enableGenClass; 
		fhtml +='<table id ="'+frmname+'_'+nam+'_0_T" border="0" cellpadding="0" cellspacing="0" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\'0\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\'0\')" ><tr><td align="left">';
		if((visAss !='') && (visAss!=' ')){
			fhtml +='<td >';
			fhtml +='<div id="'+frmname+'_'+nam+'_dv" class="'+genclass+'"></div>';
//+++++++++++++			
			imgid = frmname+'_'+nam+'_img';
			fhtml +='<input type="'+typ+'" id ="'+nam+'" class="'+genclass+'" name="'+nam+'_N" size="'+siz+'" maxlength="'+maxlen+'" style="visibility:'+vis+';" value="'+val+'" onfocus="this.disabled=true;showPopup(\''+visAss+'\',\'sre_popup_div\',event,\''+nam+'\',\''+imgid+'\')" onClick="this.disabled=true;showPopup(\''+visAss+'\',\'sre_popup_div\',event,\''+nam+'\',\''+imgid+'\')" onchange="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" onblur="this.disabled=false;sre_controls.blurVal(\''+frmname+'\',\''+nam+'\',\''+val+'\')" onkeyup="this.disabled=false;sre_controls.keyUpVal(\''+frmname+'\',\''+nam+'\',\''+val+'\')"></input>' ;
			x = "\'"+nam + "_D\'"; y = "\'"+nam + "\'";
			fhtml +='<div id="sre_popup_div" style="position:absolute"></div>';
			if((vispic) && (vispic !='') && (vispic!=' ')){ 
				fhtml +='</td>';
				fhtml +='<td >';
				fhtml  +='<img id="'+imgid+'" src="'+vispic+'" style="cursor:pointer;"  onclick="showPopup(\''+visAss+'\',\'sre_popup_div\',event,\''+nam+'\',\''+imgid+'\')" onmouseover="showToolTip(\'Please make your selection\',event)" onmouseout="hideToolTip()">';
				fhtml +='</td>';	
			} else {
				fhtml +='</td>';
				fhtml +='<td >';
				fhtml  +='<img id="'+imgid+'" src="../../../EN/SRESYS/Pic/commonstyle/drop.gif" height="12" style="cursor:pointer;"   onclick="showPopup(\''+visAss+'\',\'sre_popup_div\',event,\''+nam+'\',\''+imgid+'\')" onmouseover="showToolTip(\'Please make your selection\',event)" onmouseout="hideToolTip()">';
				fhtml +='</td>';
			}
//	+++++++++++++++++		
		} else {
			fhtml +='<input  class="'+genclass+'" type="'+typ+'" id ="'+nam+'" name="'+nam+'_N" size="'+siz+'" maxlength="'+maxlen+'" style="visibility:'+vis+';" value="'+val+'" onFocus="sre_controls.focusVal(\''+frmname+'\',\''+nam+'\')" onchange="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" onblur="sre_controls.blurVal(\''+frmname+'\',\''+nam+'\',\''+val+'\')"  onkeyup="this.disabled=false;sre_controls.keyUpVal(\''+frmname+'\',\''+nam+'\',\''+val+'\')"></input>' ;
		}
	} else 	if(stat == 'D'){
		genclass = this.config[frmname].disableGenClass; ;
		fhtml +='<tr><td><table id ="'+frmname+'_'+nam+'_0_T" border="0" cellpadding="0" cellspacing="0" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\'0\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\'0\')" ><tr><td align="left">';
		fhtml +='<input  class="'+genclass+'" type="'+typ+'" id ="'+nam+'" name="'+nam+'_N" size="'+siz+'" maxlength="'+maxlen+'" style="visibility:'+vis+';" value="'+val+'" onFocus="sre_controls.focusVal(\''+frmname+'\',\''+nam+'\')" onchange="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" onblur="sre_controls.blurVal(\''+frmname+'\',\''+nam+'\',\''+val+'\')" disabled></input>' ;
		fhtml +='</td>';
	} else 	if(stat == 'H'){
		genclass = this.config[frmname].disableGenClass; ;
		fhtml +='<table id ="'+frmname+'_'+nam+'_0_T" border="0" cellpadding="0" cellspacing="0" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" ><tr><td align="left">';
		fhtml +='<tr><td><input  class="'+genclass+'" type="'+typ+'" id ="'+nam+'" name="'+nam+'_N" size="'+siz+'" maxlength="'+maxlen+'" style="visibility:hidden;" value="'+val+'" onFocus="sre_controls.focusVal(\''+frmname+'\',\''+nam+'\')" onchange="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" onblur="sre_controls.blurVal(\''+frmname+'\',\''+nam+'\',\''+val+'\')"></input>' ;
		fhtml +='</td>';
	} else {
			alert("eMilieu error : control status is not valid. control "+nam+" may not be created");
	}
	//fhtml +='</td>';	
	fhtml +='</tr>';
	fhtml +='<tr>';
		fhtml +='<td >';
		fhtml  +='<div id="'+frmname+'_'+nam+'_ac"></div>';
		fhtml +='</td>';
	fhtml +='</tr>';
	fhtml +='</table>';
	sre_controls.setDone(nam,frmname);
//alert(fhtml);	
	return fhtml;
},
checkCtl: function (frmname,nam,stat,vis,val,checked,desc,altdesc,side,lblcls,tbindx){
	//	this.config[frmname].enableHovClass ='formctlhov';
	//	this.enableGenClass = 'formctl';
	//	this.disableHovClass ='formctlhov';
	//	this.disableGenClass = 'formctl';
	//	this.hiddenHovClass ='formctlhov';
	//	this.hiddenGenClass = 'formctl';
	//alert(nam);
	fhtml='';
	
	this.setSettings(frmname);
	var last_indx = sre_controls.checkDone(frmname,nam);
	genclass = this.config[frmname].enableGenClass; 
	if(last_indx != -1) return;
		if(stat == 'E'){
		//hovclass ='formctlhov';
		genclass = 'formctl';
		fhtml +='<table id ="'+frmname+'_'+nam+'_0_T" border="0" cellpadding="0" cellspacing="0" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\'0\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\'0\')"><tr ><td align="left">';
		if(side =="LEFT"){fhtml += '<span class="formctltrans">'+desc+'</span></td><td align="right">';}
		if(checked == 'Y'){
		//	alert(nam+'--'+checked);
				fhtml +='<input class="'+genclass+'" type="checkbox" id="'+nam+'" name="'+nam+'" style="visibility:'+vis+';" value="'+val+'" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')" checked></input>';
		} else {
				fhtml +='<input class="'+genclass+'" type="checkbox" id="'+nam+'" name="'+nam+'" style="visibility:'+vis+';" value="'+val+'" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')" ></input>';
		}
		if(side =="RIGHT"){fhtml += '</td><td align="left" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')"><span  class="formctltrans">&nbsp;'+desc+'</span>';}
	}else if(stat == 'D') {
		//hovclass ='formctl';
		genclass = 'formctl';
		fhtml +='<table id ="'+frmname+'_'+nam+'_0_T" border="0" cellpadding="0" cellspacing="0" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\'0\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\'0\')"><tr ><td align="left">';
		if(side =="LEFT"){fhtml += '<span class="formctltrans">'+desc+'</span></td><td align="right">';}
		if(checked == 'Y'){
			fhtml +='<input class="'+genclass+'" type="checkbox" id="'+nam+'" name="'+nam+'" style="visibility:'+vis+';" value="'+val+'" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" checked></input>';
		} else {
			fhtml +='<input class="'+genclass+'" type="checkbox" id="'+nam+'" name="'+nam+'" style="visibility:'+vis+';" value="'+val+'" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" disabled></input>';
		}
		if(side =="RIGHT"){fhtml += '</td><td align="left" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')"><span  class="formctltrans">&nbsp;'+desc+'</span>';}
	}else if(stat == 'H') {
		genclass = 'formctltrans';
		fhtml +='<table id ="'+frmname+'_'+nam+'_0_T" border="0" cellpadding="0" cellspacing="0" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\'0\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\'0\')"><tr ><td align="left">';
		if(side =="LEFT"){fhtml += '<span class="formctltrans">'+desc+'</span></td><td align="right">';}
		if(checked == 'Y'){
			fhtml +='<input class="'+genclass+'" type="checkbox" id="'+nam+'" name="'+nam+'" style="visibility:hidden;" value="'+val+'" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" checked></input>';
		} else {
			fhtml +='<input class="'+genclass+'" type="checkbox" id="'+nam+'" name="'+nam+'" style="visibility:hidden;" value="'+val+'" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')"></input>';
		}
		if(side =="RIGHT"){fhtml += '</td><td align="left" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')"><span  class="formctltrans">&nbsp;'+desc+'</span>';}
	}
	fhtml +='</td></tr></table>';
	sre_controls.setDone(nam,frmname);
	return fhtml;
},
mouseOvr: function (frmname,varname,idx,e){
	//alert(varname);
	obj=frmname+'_'+varname+'_'+idx+'_T';
	//obj = $(varname);  //alert(obj.disabled); //alert(obj.style.visibility);
	//alert(obj);
	if(!obj) return; //for hyper control
//	ln = sre_dynform.varlist[frmname].length;
//	if(ln > 0) {
//		for( i=0; i < ln; i++) {  //reset all objects
//		//	if(sre_dynform.varlist[frmname][i].varname == varname) {
//				for (j=0;j < sre_dynform.varlist[frmname][i].indx + 1; j++) { //for radio
//					nobj=$(frmname+'_'+varname+'_'+parseInt(j)+'_T');
//					//nobj=$(frmname+'_'+varname+'_'+idx+'_T');
//					
//					//if( (obj.type =='radio') || (obj.type =='checkbox') ){
//					//	if(obj.disabled){
//					//		if(obj.style.visibility == 'visible') {
//					//			nobj.className= this.config[frmname].disableCGenClass;
//					//		} else {
//					//			nobj.className= this.config[frmname].hiddenCGenClass;
//					//		}
//					//	} else {
//					//		nobj.className= this.config[frmname].enableCGenClass;
//					//	}
//					//} else {
//						if(obj.disabled){
//						//	if(obj.style.visibility == 'visible') {
//								nobj.className= this.config[frmname].disableGenClass;
//						//	} else {
//						//		nobj.className= this.config[frmname].hiddenGenClass;
//						//	}
//						} else {
//							nobj.className= this.config[frmname].enableGenClass;
//						}
//					//}
//				}
//		//	}
//		}
//		//alert(nobj.className);
//	}  
	nobj=$(frmname+'_'+varname+'_'+idx+'_T'); //current one
	//alert(nobj);
//	if( (obj.type =='radio') || (obj.type =='checkbox') ){
//		if(!obj.disabled){
//			nobj.className= this.config[frmname].enableCHovClass;
//		}
//	} else {
		if(!obj.disabled){
			nobj.className= this.config[frmname].enableHovClass;
		}
//	}
	var tmp = SRESelectedPage;//this.config[frmname].pageName;//SRESelectedPage;
	var str ='';
	str += '_ControlOver("';
	str += varname;
	str += '",e)';
	eval( tmp + str);
},
mouseOt: function (frmname,varname,idx) {
	ln = sre_dynform.varlist[frmname].length;
	obj=frmname+'_'+varname+'_'+idx+'_T';
	//obj = $(varname);
	if(!obj) return; //for hyper control
	//if(ln > 0) {
		//for( i=0; i < ln; i++) { 
			//if(sre_dynform.varlist[frmname][i].varname == varname) {
			
				//for (j=0;j < sre_dynform.varlist[frmname][i].indx + 1; j++) {
					//nobj=$(frmname+'_'+varname+'_'+parseInt(j)+'_T'); //alert(obj.type);
					nobj=$(frmname+'_'+varname+'_'+idx+'_T');
					
				//	if( (obj.type =='radio') || (obj.type =='checkbox') ){
				//		if(obj.disabled){
				//			if(obj.style.visibility == 'visible') {
				//				nobj.className= this.config[frmname].disableCGenClass;
				//			} else {
				//				nobj.className= this.config[frmname].hiddenCGenClass;
				//			}
				//		} else {
				//			nobj.className= this.config[frmname].enableCGenClass;
				//		}
				//	} else {
						if(obj.disabled){
						//	if(obj.style.visibility == 'visible') {
								nobj.className= this.config[frmname].disableGenClass;
						//	} else {
						//		nobj.className= this.config[frmname].hiddenGenClass;
						//	}
						} else {
							nobj.className= this.config[frmname].enableGenClass;
						}
				//	}
				//}
			//}
		//}
	//}  
	var tmp = SRESelectedPage;//this.config[frmname].pageName;//
	var str ='';
	str += '_ControlOut("';
	str += varname;
	str += '")';
	eval( tmp + str);
},
setDone: function (varname,frmname) {
	//sre_dynform.varlist has each variable listed only once. Other than radio button, each control is supposed to only have
	// 0 index available. Each radio control will have its own index, even though the variable name is the same.
	found = 0; 
	ln = sre_dynform.varlist[frmname].length;
	if(ln > 0) {
		for( i=0; i < ln; i++) {
			if(sre_dynform.varlist[frmname][i].varname == varname) { // mainly for an already set radio button
				idx =sre_dynform.varlist[frmname][i].indx;
				idx = idx + 1; 
				sre_dynform.varlist[frmname][i] = {
					varname: varname,
					indx: idx,
					currindx: idx,
					selected: -1
				};
				found = 1; break;
			}
		}
	} 
	if (found == 0) { //most of the control except the radio button will always fall here
		sre_dynform.varlist[frmname][ln] = { 
					varname: varname,
					indx: 0,
					currindx: 0,
					selected: -1
				};
	}
},
unSetDone: function (frmname) {
	var cnt = -1;
	if(sre_dynform.varlist[frmname]){
		ln = sre_dynform.varlist[frmname].length;
		if( ln > 0) {
			for( m=0; m < ln; m++) {
				
					sre_dynform.varlist[frmname][m].indx = -1;
				
			}
		} 
	} 
},
checkDone: function (frmname,varname) {
	// Except for radio button, checkDone always returns 0 if the control is already created, else it returns a -1.
	//Other than radio button, the control will be created only if the return is -1. Avoids duplicate control creation.
	var cnt = -1;
	if(sre_dynform.varlist[frmname]){
		ln = sre_dynform.varlist[frmname].length;
		if( ln > 0) {
			for( m=0; m < ln; m++) {
				if(sre_dynform.varlist[frmname][m].varname == varname) {
				cnt = 	sre_dynform.varlist[frmname][m].indx;
				}
			}
		} 
	} 
	return cnt;
},
cancelDone: function (frmname) {
	//resets sre_dynform.varlist. used when the same form is used again and again ( tab change and back). Each Dynaform creation will reset.
	if(sre_dynform.varlist[frmname]){
		sre_core.initializeList(sre_dynform.varlist[frmname]);
	} 
},
webToTxt: function (str){
	var cnt = 0;var val='';
	var tmp = new Array();
	for(jj=0; jj < str.length;jj++){
		x = str.slice(jj,jj+1);
		if(x == '\"'){
			tmp[cnt]='%34';cnt++;
		} else if((x == '\'')|| (x == '\`')){
			tmp[cnt]='%39';cnt++;
		} else if(x == '/'){
			tmp[cnt]='%47';cnt++;
		}else if(x == '\\'){
			tmp[cnt]='%92';cnt++;
		}else if(x == '('){
			tmp[cnt]='%40';cnt++;
		}else if(x == ')'){
			tmp[cnt]='%41';cnt++;
		}else if(x == '<'){
			tmp[cnt]='%60';cnt++;
		} else if(x == '>'){
			tmp[cnt]='%62';cnt++;
		} else if(x == '\n'){
			tmp[cnt]='%15';cnt++;
		}else if(x == '\r'){
		}else {
			tmp[cnt]=x;cnt++;
		}
	}
	for(kk=0; kk < tmp.length;kk++){
		val += tmp[kk];
	}
	return val;
},

focusVal: function (frmname,nam){
	//alert(nam);
	//hideToolTip();
	for(x=0;x < sremenulist.length; x++ ){
			//this.refresh(sremenulist[x]);
		var oth = sremenulist[x];
		ot = document.getElementById(oth);
		if(ot) {
			//alert(sremenulist.length);	
			if(sremenutypelist[x]=='MENU'){
				sre_menu.cancelDiv("sre_popup_div",oth);
			} else if(sremenutypelist[x]=='CLDR'){
				sre_calendar.cancelDiv("sre_popup_div",oth);
			}
			//
			pd =$("sre_popup_div");
			if (pd) {pd.innerHTML = '';}
		}
	}
	v = $(nam);
	val = this.webToTxt(v.value);
	eval(this.config[frmname].pageName+"_OnFocus(\""+nam+"\",\""+val+"\")");
},
keyUpVal: function (frmname,nam,orival){
	v = $(nam);
	eval (nam + "= \"" + v.value+"\"");
	eval(this.config[frmname].pageName+"_OnKeyUp(\""+nam+"\",\""+v.value+"\",\""+orival+"\")");
},
changeVal: function (frmname,nam,obj){
	var picfile='';
	pic = $("clickpic"+ nam);
	if(pic) {
		sr = pic.src;
		picfile = sr.substring(pic.src.length - 16);
	}
	SREModified=1;
	if(picfile == "Customize_bw.png") { //hide toolbar
	}else {
	v = $(nam);
		val = obj;//this.webToTxt(v.value);
		ori = eval(nam);
		eval (nam + "= \"" + val+"\"");
		eval(this.config[frmname].pageName+"_OnChange(\""+nam+"\",\""+val+"\",\""+ori+"\")");
	}
},
formatVal: function (nam,val){
	//eval(this.config[nam].pageName+"_OnFormatChange(\""+nam+"\",\'"+val+"\')");
},
selectRadio: function (frmname,nam,obj){
	id=nam+'_'+obj;
	$(id).checked = true;
	this.changeRadio(frmname,nam,obj);
},
changeRadio: function (frmname,nam,obj){
	//alert(nam);alert(obj);
	id=nam+'_'+obj;
	v = $(id);
	val = this.webToTxt(v.value);
	//ori = eval(id);
	eval (nam + "= \"" + val+"\"");
	eval(this.config[frmname].pageName+"_OnRadio(\""+nam+"\",\""+obj+"\")");
},
toggleVal: function (frmname,varname,label) {
	
	tc1 = document.getElementById(varname);
	if(tc1.value=='Y'){
		tc1.value='N';
		tc1.checked=false;
	} else {
		tc1.value='Y';
		tc1.checked=true;
	}
	eval(this.config[frmname].pageName+"_ToggleCheck(\""+varname+"\",\""+tc1.value+"\")");
},
//toggleVal(\'
//toggleVal(\''+frmname+'\',\'
blurVal: function (frmname,nam,orival){
	v = $(nam);
	eval (nam + "= \"" + v.value+"\"");
	eval(this.config[frmname].pageName+"_OnBlur(\""+nam+"\",\""+v.value+"\",\""+orival+"\")");
},
/*
hideShowCheck: function (fldname,state){
	fldid = fldname;
	var fldobj = document.getElementById(fldid);
	if(state == "HIDE"){
		fldobj.style.visibility= "hidden";
	} else {
		fldobj.style.visibility= "visible";
	}
},
hideShowField: function (fldname,state){
	fldid = fldname +"_D";
	var fldobj = document.getElementById(fldid);
	if(state == "HIDE"){
		fldobj.style.visibility= "hidden";
	} else {
		fldobj.style.visibility= "visible";
	}
},
hideShowLabel: function (fldname,state) {
	fldid = "l_" +fldname;
	var fldobj = document.getElementById(fldid);
	if(state == "HIDE"){
		fldobj.style.visibility= "hidden";
	} else {
		fldobj.style.visibility= "visible";
	}
},
hideShowImage: function (fldname,state) {
	var fldid = fldname +"_I";
	var fldobj = document.getElementById(fldid);
	if(state == "HIDE"){
		fldobj.style.visibility= "hidden";
	} else {
		fldobj.style.visibility= "visible";
	}
},
resetField: function (fldname,value,descr){
	var val,desc;
	if(value){
		val = value;
		if(descr) {
			desc = descr;
		} else {
			desc = value;
		}
	} else {
		val ="";
		desc ="";
	}
	fldid = fldname +"_D";
	var flddes = document.getElementById(fldid);
	var fldobj = document.getElementById(fldname);
	flddes.value = desc;
	fldobj.value = val;
},
resetField: function (fldname,value,descr){
	var val;
	if(value){
		val = value;
	} else {
		val ="";
	}
	var fldobj = document.getElementById(fldname);
	fldobj.value = val;
},
*/
/*
*/
/*
formCtl: function (frmname,nam,typ,stat,siz,maxlen, vis,val,visAss,vispic,tbindx){
	this.setSettings(frmname);
	var last_indx = sre_controls.checkDone(frmname,nam);
	var cur_indx =  parseInt(parseInt(last_indx) + parseInt("1") )     ;
	fhtml=''; 	hovclass ='';genclass = '';
		if(stat == 'E'){
			hovclass ='formctlhov';
			genclass = 'formctl';
			fhtml +='<table id ="'+frmname+'_'+nam+'_'+cur_indx+'_T" border="0" cellpadding="0" cellspacing="0" class="'+genclass+'" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" ><tr><td align="left">';

			if((visAss) && (visAss !='') && (visAss!=' ')){ 
				imgid = frmname+'_'+nam+'_'+cur_indx+'_img';
				fhtml +='<input type="'+typ+'" id ="'+nam+'" name="'+nam+'_N" size="'+siz+'" maxlength="'+maxlen+'" style="visibility:'+vis+';" value="'+val+'" onClick="this.disabled=true;showPopup(\''+visAss+'\',\'sre_popup_div\',event,\''+nam+'\',\''+imgid+'\')" onchange="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" onblur="sre_controls.blurVal(\''+frmname+'\',\''+nam+'\',\''+val+'\')" ></input>' ;
				x = "\'"+nam + "_D\'";
				y = "\'"+nam + "\'";
				fhtml +='<div id="sre_popup_div" style="position:absolute"></div>';
				if((vispic) && (vispic !='') && (vispic!=' ')){ 
					fhtml +='</td>';
					fhtml +='<td >';
					
					fhtml  +='<img id="'+imgid+'" src="'+vispic+'" style="cursor:pointer;"  onclick="showPopup(\''+visAss+'\',\'sre_popup_div\',event,\''+nam+'\',\''+imgid+'\')" onmouseover="showToolTip(\'Please make your selection\',event)" onmouseout="hideToolTip()">';
					fhtml +='</td>';	
				} else {
					fhtml +='</td>';
					fhtml +='<td >';
					fhtml  +='<img id="'+imgid+'" src="../../../EN/SRESYS/Pic/commonstyle/childc.gif" style="cursor:pointer;"   onclick="showPopup(\''+visAss+'\',\'sre_popup_div\',event,\''+nam+'\',\''+imgid+'\')" onmouseover="showToolTip(\'Please make your selection\',event)" onmouseout="hideToolTip()">';
					fhtml +='</td>';
				}
			} else {
				fhtml +='<input type="'+typ+'" id ="'+nam+'" name="'+nam+'_N" size="'+siz+'" maxlength="'+maxlen+'" style="visibility:'+vis+';" value="'+val+'" onFocus="sre_controls.focusVal(\''+frmname+'\',\''+nam+'\')" onchange="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" onblur="sre_controls.blurVal(\''+frmname+'\',\''+nam+'\',\''+val+'\')" ></input>' ;
			}
		} else 	if(stat == 'D'){
			hovclass ='formctl';
			genclass = 'formctl';
		//	fhtml +='<table id ="'+frmname+'_'+nam+'_'+cur_indx+'_T" border="0" cellpadding="0" cellspacing="0" class="'+genclass+'" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" ><tr><td align="left">';
		//	fhtml +='<input class="formctldis" type="BUTTON" id ="'+nam+'" name="'+nam+'1" size="'+siz+'" maxlength="'+maxlen+'" style="visibility:'+vis+';"  value="'+val+'" onFocus="sre_controls.focusVal(\''+frmname+'\',\''+nam+'\')" onchange="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" onblur="sre_controls.blurVal(\''+frmname+'\',\''+nam+'\',\''+val+'\')" disabled></input>' ;
			fhtml +='<table id ="'+frmname+'_'+nam+'_'+cur_indx+'_T" border="0" cellpadding="0" cellspacing="0" class="'+genclass+'" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" ><tr><td align="left">';

			fhtml +='<input type="'+typ+'" id ="'+nam+'" name="'+nam+'_N" size="'+siz+'" maxlength="'+maxlen+'" style="visibility:'+vis+';" value="'+val+'" onFocus="sre_controls.focusVal(\''+frmname+'\',\''+nam+'\')" onchange="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" onblur="sre_controls.blurVal(\''+frmname+'\',\''+nam+'\',\''+val+'\')" disabled></input>' ;
		} else 	if(stat == 'H'){
			hovclass ='formctltrans';
			genclass = 'formctltrans';
		//	fhtml +='<table id ="'+frmname+'_'+nam+'_'+cur_indx+'_T" border="0" cellpadding="0" cellspacing="0" class="'+genclass+'" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" ><tr><td align="left">';
		//	fhtml +='<input class="formctltrans" type="'+typ+'" id ="'+nam+'" name="'+nam+'1" size="'+siz+'" maxlength="'+maxlen+'" style="visibility:hidden;"  value="'+val+'" onFocus="sre_controls.focusVal(\''+frmname+'\',\''+nam+'\')" onchange="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" onblur="sre_controls.blurVal(\''+frmname+'\',\''+nam+'\',\''+val+'\')" disabled></input>' ;
			fhtml +='<table id ="'+frmname+'_'+nam+'_'+cur_indx+'_T" border="0" cellpadding="0" cellspacing="0" class="'+genclass+'" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" ><tr><td align="left">';
			fhtml +='<input type="'+typ+'" id ="'+nam+'" name="'+nam+'_N" size="'+siz+'" maxlength="'+maxlen+'" style="visibility:hidden;" value="'+val+'" onFocus="sre_controls.focusVal(\''+frmname+'\',\''+nam+'\')" onchange="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" onblur="sre_controls.blurVal(\''+frmname+'\',\''+nam+'\',\''+val+'\')"></input>' ;
		} else {
				alert("eMilieu error : control status is not valid. control "+nam+" may not be created");
		}
		fhtml +='</td>';	
		fhtml +='</tr>';
		fhtml +='</table>';
	sre_controls.setDone(nam,frmname);
//alert(nam+'---'+frmname+'---'+fhtml);	
	return fhtml;
},
*/
/*
checkCtl: function (frmname,nam,stat,vis,val,checked,desc,altdesc,side,lblcls,tbindx){
	//	this.config[frmname].enableHovClass ='formctlhov';
	//	this.enableGenClass = 'formctl';
	//	this.disableHovClass ='formctlhov';
	//	this.disableGenClass = 'formctl';
	//	this.hiddenHovClass ='formctlhov';
	//	this.hiddenGenClass = 'formctl';
	fhtml=''; 
	this.setSettings(frmname);
	var last_indx = sre_controls.checkDone(frmname,nam);
	var cur_indx =  parseInt(parseInt(last_indx) + parseInt("1") );
		if(stat == 'E'){
		hovclass ='formctlhov';
		genclass = 'formctl';
		fhtml +='<table id ="'+frmname+'_'+nam+'_'+cur_indx+'_T" border="0" cellpadding="0" cellspacing="0" class="chkctl" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')"><tr ><td align="left">';
		if(side =="LEFT"){fhtml += '<span class="'+lblcls+'">'+desc+'</span></td><td align="right">';}
		if(checked == 'Y'){
		//	alert(nam+'--'+checked);
				fhtml +='<input type="checkbox" id="'+nam+'" name="'+nam+'" style="visibility:'+vis+';" value="'+val+'" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')" checked></input>';
		} else {
				fhtml +='<input type="checkbox" id="'+nam+'" name="'+nam+'" style="visibility:'+vis+';" value="'+val+'" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')" ></input>';
		}
		if(side =="RIGHT"){fhtml += '</td><td align="left" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')"><span  class="'+lblcls+'">&nbsp;'+desc+'</span>';}
	}else if(stat == 'D') {
		hovclass ='formctl';
		genclass = 'formctl';
		fhtml +='<table id ="'+frmname+'_'+nam+'_'+cur_indx+'_T" border="0" cellpadding="0" cellspacing="0" class="chkctl" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')"><tr ><td align="left">';
		if(side =="LEFT"){fhtml += '<span class="'+lblcls+'">'+desc+'</span></td><td align="right">';}
		if(checked == 'Y'){
			fhtml +='<input type="checkbox" id="'+nam+'" name="'+nam+'" style="visibility:'+vis+';" value="'+val+'" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" checked></input>';
		} else {
			fhtml +='<input type="checkbox" id="'+nam+'" name="'+nam+'" style="visibility:'+vis+';" value="'+val+'" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" disabled></input>';
		}
		if(side =="RIGHT"){fhtml += '</td><td align="left" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')"><span  class="'+lblcls+'">&nbsp;'+desc+'</span>';}
	}else if(stat == 'H') {
		hovclass ='formctltrans';
		genclass = 'formctltrans';
		fhtml +='<table id ="'+frmname+'_'+nam+'_'+cur_indx+'_T" border="0" cellpadding="0" cellspacing="0" class="chkctl" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')"><tr ><td align="left">';
		if(side =="LEFT"){fhtml += '<span class="'+lblcls+'">'+desc+'</span></td><td align="right">';}
		if(checked == 'Y'){
			fhtml +='<input type="checkbox" id="'+nam+'" name="'+nam+'" style="visibility:hidden;" value="'+val+'" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" checked></input>';
		} else {
			fhtml +='<input type="checkbox" id="'+nam+'" name="'+nam+'" style="visibility:hidden;" value="'+val+'" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')"></input>';
		}
		if(side =="RIGHT"){fhtml += '</td><td align="left" onclick="sre_controls.toggleVal(\''+frmname+'\',\''+nam+'\',\''+desc+'\')"><span  class="'+lblcls+'">&nbsp;'+desc+'</span>';}
	}
	fhtml +='</td></tr></table>';
	sre_controls.setDone(nam,frmname);
	return fhtml;
},
*/
radioCtl: function (frmname,nam,stat,vis,val,checked,desc,altdesc,side,lblcls,tbindx){
		fhtml=''; 
		this.setSettings(frmname);
	var last_indx = sre_controls.checkDone(frmname,nam);
	var cur_indx =  parseInt(parseInt(last_indx) + parseInt("1") )     ;
	if(stat == 'E'){
		lblcls = 'formctl';
		hovclass ='formctlhov';
		genclass = 'formctl';
		fhtml +='<table id ="'+frmname+'_'+nam+'_'+cur_indx+'_T" border="0" cellpadding="0" cellspacing="0" class="chkctl" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')"><tr ><td align="left" width="20">';
		if(side =="LEFT"){fhtml += '<span class="formctltrans">'+desc+'</span></td><td align="right">';}
		if(checked == 'Y'){
				fhtml +='<input type="radio"  id="'+nam+'_'+cur_indx+'" name="'+nam+'" style="visibility:'+vis+';" value="'+val+'" onclick="sre_controls.changeRadio(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" checked></input>';
		} else {
				fhtml +='<input type="radio"  id="'+nam+'_'+cur_indx+'" name="'+nam+'" style="visibility:'+vis+';" value="'+val+'" onclick="sre_controls.changeRadio(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" ></input>';
		}
		if(side =="RIGHT"){fhtml += '</td><td align="left"><span  class="formctltrans" onclick="sre_controls.selectRadio(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')">&nbsp;'+desc+'</span>';}
	}else if(stat == 'D') {
		lblcls = 'formctl';
		hovclass ='formctl';
		genclass = 'formctl';
		fhtml +='<table id ="'+frmname+'_'+nam+'_'+cur_indx+'_T" border="0" cellpadding="0" cellspacing="0" class="chkctl" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')"><tr ><td align="left" width="20">';
		if(side =="LEFT"){fhtml += '<span class="formctltrans">'+desc+'</span></td><td align="right">';}
		if(checked == 'Y'){
			fhtml +='<input type="radio"  id="'+nam+'_'+cur_indx+'" name="'+nam+'" style="visibility:'+vis+';" value="'+val+'" onclick="sre_controls.changeRadio(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" checked></input>';
		} else {
			fhtml +='<input type="radio"  id="'+nam+'_'+cur_indx+'" name="'+nam+'" style="visibility:'+vis+';" value="'+val+'" onclick="sre_controls.changeRadio(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" disabled></input>';
		}
		if(side =="RIGHT"){fhtml += '</td><td align="left"><span  class="formctltrans">&nbsp;'+desc+'</span>';}
	}else if(stat == 'H') {
		lblcls = 'formctl';
		hovclass ='formctltrans';
		genclass = 'formctltrans';
		fhtml +='<table id ="'+frmname+'_'+nam+'_'+cur_indx+'_T" border="0" cellpadding="0" cellspacing="0" class="chkctl" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')"><tr ><td align="left" width="20">';
		if(side =="LEFT"){fhtml += '<span class="formctltrans">'+desc+'</span></td><td align="right">';}
		if(checked == 'Y'){
			fhtml +='<input type="radio"  id="'+nam+'_'+cur_indx+'" name="'+nam+'" style="visibility:hidden;" value="'+val+'" onclick="sre_controls.changeRadio(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" checked></input>';
		} else {
			fhtml +='<input type="radio"  id="'+nam+'_'+cur_indx+'" name="'+nam+'" style="visibility:hidden;" value="'+val+'" onclick="sre_controls.changeRadio(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')"></input>';
		}
		if(side =="RIGHT"){fhtml += '</td><td align="left"><span  class="formctltrans">&nbsp;'+desc+'</span>';}
	}
	fhtml +='</td></tr></table>';
	//alert(fhtml);
	sre_controls.setDone(nam,frmname);
	return fhtml;
},
textAreaCtl: function (frmname,nam,stat,siz,hei,vis,val,visAss,tbindx){
	this.setSettings(frmname);
	fhtml=''; 	hovclass ='';genclass = '';
	var last_indx = sre_controls.checkDone(frmname,nam);
	var cur_indx =  parseInt(parseInt(last_indx) + parseInt("1") )     ;
	if(stat == 'E'){
		hovclass ='formctlhov';
		genclass = 'formctl';
		fhtml +='<table  id ="'+frmname+'_'+nam+'_'+cur_indx+'_T" border="0" cellpadding="0" cellspacing="0" class="'+genclass+'" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" ><tr><td align="left"><div id="sre_txtar_toolb_'+nam+'"></div></td></tr><tr><td class="txtareafr" align="left">';
	//	fhtml +='<textarea  id="'+nam+'" name="'+nam+'_N" cols="'+siz+'" rows="'+hei+'" wrap="physical" style="visibility:'+vis+';" value="'+val+'" onFocus="sre_controls.focusVal(\''+frmname+'\',\''+nam+'\')" onchange="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" onblur="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" >'+val+'</textarea>' ;
		fhtml +='<div id="sre_showTa"  ></div>';
	} else if(stat == 'D') {
		hovclass ='formctl';
		genclass = 'formctl';
		fhtml +='<table id ="'+frmname+'_'+nam+'_'+cur_indx+'_T" border="0" cellpadding="0" cellspacing="0" class="'+genclass+'" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" ><tr><td align="left"><div id="sre_txtar_toolb_'+nam+'"></div></td></tr><tr><td align="left">';
	//	fhtml +='<textarea id="'+nam+'" name="'+nam+'_N" cols="'+siz+'" rows="'+hei+'" wrap="physical" style="visibility:'+vis+';" value="'+val+'" onFocus="sre_controls.focusVal(\''+frmname+'\',\''+nam+'\')" onchange="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" onblur="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" disabled>'+val+'</textarea>' ;
	} else if(stat == 'H') {
		hovclass ='formctltrans';
		genclass = 'formctltrans';
		fhtml +='<table id ="'+frmname+'_'+nam+'_'+cur_indx+'_T" border="0" cellpadding="0" cellspacing="0" class="'+genclass+'" onmouseover="sre_controls.mouseOvr(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\',event)" onmouseout="sre_controls.mouseOt(\''+frmname+'\',\''+nam+'\',\''+cur_indx+'\')" ><tr><td align="left"><div id="sre_txtar_toolb_'+nam+'"></div></td></tr><tr><td align="left">';
	//	fhtml +='<textarea id="'+nam+'" name="'+nam+'_N" cols="'+siz+'" rows="'+hei+'" wrap="physical" style="visibility:hidden;"  value="'+val+'" onFocus="sre_controls.focusVal(\''+frmname+'\',\''+nam+'\')" onchange="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" onblur="sre_controls.changeVal(\''+frmname+'\',\''+nam+'\',this.value)" disabled>'+val+'</textarea>' ;
	}
	fhtml +='<div id="sre_popup_div" style="position:absolute"></div>';
	fhtml +='</td>';
	fhtml +='<td valign="bottom">';
//	if(visAss =='Y') {
//		fhtml  +='<img value="Off" id="clickpic'+nam+'" width="18" src="/EN/SRESYS/Pic/commonstyle/actions/Customize.png" style="cursor:pointer;" ';
//		fhtml  +=' onclick="sre_controls.showTextAreaButton(\''+frmname+'\',\''+nam+'\',event)" onmouseover="showToolTip(\'Click here to customize text format.\',event)" onmouseout="hideToolTip()">';
//	}
	fhtml +='</td>';
			
	fhtml +='</tr>';
	fhtml +='</table>';
//alert(fhtml);

	sre_controls.setDone(nam,frmname);
	return fhtml;	
},
showTextAreaButton: function (frmname,nam,ev){
	//pic = $("clickpic"+ nam);
	//sr = pic.src;
	//picfile = sr.substring(pic.src.length - 16);
	//if(picfile == "Customize_bw.png") { //hide toolbar
	//	pic.style.cursor= "none";
	//} else {
		var storeval='';;fhtml ='';
		n = $(nam);
		if(n) {storeval = n.value;}
		var Words = new Array();
		dynarr = sre_dynform.config[frmname].dynArray;
		for (ta=0; ta < dynarr.length; ta++) {
			sre_core.breakWords(dynarr[ta],Words);
			if(Words[3] == nam) {
				if($("sre_showTa"))	$("sre_showTa").innerHTML ="";
				fhtml +='<textarea border="0" id="'+Words[3]+'" Words[3]="'+Words[3]+'_N" cols="'+Words[4]+'" rows="'+Words[5]+'" wrap="physical" style="visibility:visible;" value="'+val+'" onFocus="sre_controls.focusVal(\''+Words[3]+'\')" onchange="sre_controls.changeVal(\''+Words[3]+'\',this.value)" onblur="sre_controls.changeVal(\''+Words[3]+'\',this.value)" >'+val+'</textarea>' ;
				if($("sre_showTa")) $("sre_showTa").innerHTML = fhtml;
				aaa = $(Words[3]);
				var ta = new sre_html.Settings();
				//ta.Width = "500"; 
				//ta.Height = "100";
				ta.StatusBarEnabled = false;
				//alert("before : "+sre_dynform.config[frmname]);

				sre_html.attach(nam,ta); // default setup
				sre_html.generate(nam, ta);
				//alert("aaa : " +nam+'--'+frmname);
				//alert("after : "+sre_dynform.config[frmname]);
			}
		}
			
		sre_dynform.txtareatbstate[nam] = 1;
		//alert(sre_dynform.txtareatbstate[nam]);
		this.textAreaToolBar(frmname,nam);
	//	pic.src = "/EN/SRESYS/Pic/commonstyle/actions/Customize_bw.png";
	//}
},
addTextAreaButton: function (frmname,nam,butname,picpath,onclk,value,tooltip){
	html ='';
	html+= '<div id="'+butname+'" style="visibility:visible;z-index:9;position:absolute;" ></div><img type="BUTTON" class="txtartb" name="';
	html+= butname;
	html+= '" id="id_'+butname+'" src="';
	html+= picpath;
	html+= '" onclick="';
	html+= onclk;
	html+= '(\''+frmname+'\',\''+nam+'\',\''+value+'\',event)" onmouseover="showToolTipEx(\'';
	html+= tooltip;
	html+= '\',event)" onmouseout="hideToolTip()"></img>';
	
	return html;
},
textAreaToolBar: function (frmname,nam){
	html=''; 
	tb = $("sre_txtar_toolb_"+nam);
	html+= this.addTextAreaButton(frmname,nam,'Bold','../../../EN/SRESYS/Pic/commonstyle/srp_htmleditor/bold.gif','sre_controls.MakeBold','Make text bold from this point');
	html+= this.addTextAreaButton(frmname,nam,'UnderLine','../../../EN/SRESYS/Pic/commonstyle/srp_htmleditor/underline.gif','sre_controls.MakeUnderline','Make text underlined from this point');
	//html+= this.addTextAreaButton(frmname,nam,'insertlink','../../../EN/SRESYS/Pic/commonstyle/srp_htmleditor/insert_hyperlink_on.gif','sre_controls.MakeLink','Add a hyperlink at the current location');
	if(tb) tb.innerHTML = html;
},
MakeBold: function (frmname,nam,value,e){
//alert(nam);
	sre_html.execCommand(nam,"Bold");
},
MakeUnderline: function (frmname,nam,value,e){
	sre_html.execCommand(nam,"Underline");
},
MakeLink: function (frmname,nam,value,e){
	//alert(e);
	AddLink(e);
},
msgClose: function (num,action,param) { //action C: cancel S: submit

}	
};

/* -----------------------END(sre_controls)---------------------------------- */


/* ---------------------Begin(sre_monthyear)---------------------------------- *\
 * eMiliue v1.0 Copyright (c) 2010 Sreejon LLC 
 * Contact us at sreejon2006@msn.com
 * This copyright notice MUST stay intact for use.
 *
 * $Revision: 1.0 $

Dependency :	[Meant to work with Sreejon message structure ]
				No dependency

Description :	All calendar rountines needed throughout the system 

Usage:


\* ---------------------------------------------------------------------- */
//var srecalendarlist = new Array();

var sre_monthyear = {
	Settings: function() {
		this.CalendarId;
		this.CalendarType = 'N';
		this.DivId;
		this.CalendarName = "";
		this.ShowHeader = 1;
		this.dCurMonth;
		this.dCurYear;
		this.DropDownPic = "../../../EN/SRESYS/Pic/commonstyle/childc.gif";
		this.hyperDropDownPic = "../../../EN/SRESYS/Pic/commonstyle/childc.gif";

		//this.dCurDate;
		this.BackColor='#ffffff';
		this.iCellWidth = 15;
		this.iCellHeight = 8;
		this.sDateTextSize = "12px"; 
		this.sDateTextWeight = "bold";
		this.SelectedValue = "";
		this.SelectedDescription = "";
		this.hyperDisplay='';
		this.hyperDisplayCls='formctl';
		this.calendarHdr='formctl';
		this.PageName='';
		this.Top=0;
		this.Left=0;
		this.Layer=0;
		this.objPrevElement='';
		this.CalendarHvr = "menureghov";
		this.CalendarOut = "menureg";
		this.CalendarWidth = "140";
	},
	config: new Array(),
	Months: new Array(),
	ShortMonths: new Array(),
	
	dCurDate: new Date(),
	CalendarElements:  new Array(),
	setSettings: function(n, settings) {
		if(typeof(settings) != "object") {
			this.config[n] = new this.Settings();
		}
		else {
			this.config[n] = settings;
		}
		sremenulist[sremenulist.length]=n;
		sremenutypelist[sremenutypelist.length]='MNYR';
	},
	render: function(divid,html) {	
		v = document.getElementById(divid);
		v.innerHTML = html;
	},
	cancelDiv: function (cont,num) {
		pagename = this.config[num].PageName;
		str ="";
		str += '_MenuCancel("';
		str += num;
		str += '")';
		eval( this.config[num].PageName + str);
	},
	display: function(divid,id,settings) {	
		this.setSettings(id, settings);
		this.config[id].CalendarId = id;
		this.config[id].CalendarType = 'N';
		this.config[id].DivId = divid;	
		if(!this.config[id].dCurMonth) {this.config[id].dCurMonth = this.dCurDate.getMonth()+1;}
		if(!this.config[id].dCurYear) {this.config[id].dCurYear = this.dCurDate.getFullYear();}
		this.Months = ["January", "February", "March", "April", "May", "June",
			"July", "August", "September", "October", "November", "December"];
		this.ShortMonths = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN",
			"JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
		this.showCalendar(id,divid);
	},
	displayHyper: function(divid,id,settings) {	
		this.setSettings(id, settings);
		this.config[id].CalendarId = id;
		this.config[id].CalendarType = 'H';
		this.config[id].DivId = divid;	
		this.config[id].dropStatus = 0;
		this.drawHyper(divid,id);
	},
	displayLookup: function(divid,id,settings,top,left) {	//here setting is a label not an object
		this.setSettings(id, settings);
		this.config[id].CalendarId = id;
		this.config[id].CalendarType = 'L';
		this.config[id].DivId = divid;
		if(!this.config[id].dCurMonth) {this.config[id].dCurMonth = this.dCurDate.getMonth()+1;}
		if(!this.config[id].dCurYear) {this.config[id].dCurYear = this.dCurDate.getFullYear();}
		this.Months = ["January", "February", "March", "April", "May", "June",
			"July", "August", "September", "October", "November", "December"];
		this.ShortMonths = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN",
			"JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
		dv = document.getElementById(divid);
		dv.style.position ='absolute';
		ly = parseInt(this.config[id].Layer) + 1;
		dv.style.zIndex =ly;
		dv.style.top = top;
		this.config[id].Top = top;
		dv.style.left = left;
		this.config[id].Left = left;
		this.showCalendar(id,divid);
	},
	fGetDaysInMonth: function (iMonth, iYear) {
		var dPrevDate = new Date(iYear, iMonth, 0);
		return dPrevDate.getDate();
	},
	fBuildCal: function (iYear, iMonth, iDayStyle) {
		var aMonth = new Array();
		aMonth[0] = new Array(7);
		aMonth[1] = new Array(7);
		aMonth[2] = new Array(7);
		aMonth[3] = new Array(7);
		aMonth[4] = new Array(7);
		aMonth[5] = new Array(7);
		aMonth[6] = new Array(7);
		var dCalDate = new Date(iYear, iMonth-1, 1);
		var iDayOfFirst = dCalDate.getDay();
		var iDaysInMonth = this.fGetDaysInMonth(iMonth, iYear);
		var iVarDate = 1;
		var i, d, w;
		if (iDayStyle == 2) {
			aMonth[0][0] = "Sunday";
			aMonth[0][1] = "Monday";
			aMonth[0][2] = "Tuesday";
			aMonth[0][3] = "Wednesday";
			aMonth[0][4] = "Thursday";
			aMonth[0][5] = "Friday";
			aMonth[0][6] = "Saturday";
		} else if (iDayStyle == 1) {
			aMonth[0][0] = "Sun";
			aMonth[0][1] = "Mon";
			aMonth[0][2] = "Tue";
			aMonth[0][3] = "Wed";
			aMonth[0][4] = "Thu";
			aMonth[0][5] = "Fri";
			aMonth[0][6] = "Sat";
		} else {
			aMonth[0][0] = "S";
			aMonth[0][1] = "M";
			aMonth[0][2] = "T";
			aMonth[0][3] = "W";
			aMonth[0][4] = "T";
			aMonth[0][5] = "F";
			aMonth[0][6] = "S";
		}
		for (c =0; c < iDayOfFirst; c++) {
			aMonth[1][c] = " ";
		}
		for (d = iDayOfFirst; d < 7; d++) {
				aMonth[1][d] = iVarDate;
				iVarDate++;
		}
		for (w = 2; w < 7; w++) {
			for (d = 0; d < 7; d++) {
				if (iVarDate <= iDaysInMonth) {
					aMonth[w][d] = iVarDate;
					iVarDate++;
				} else {
					aMonth[w][d] = " ";
				}
			}
		}
		return aMonth;
	},
	fToggleColor: function (num,id,mode) 	{
		v = document.getElementById(id);
		if (mode == 1) {
			v.className = this.config[num].CalendarHvr;
		} else {
			v.className = this.config[num].CalendarOut;
		}
	},
	fdaydiff: function(firstdate,currdate){
		var one_day=1000*60*60*24;
		fulldays = Math.ceil((currdate.getTime()-firstdate.getTime())/(one_day));
		return fulldays;
	},
	fzeropad: function(val){
		v ='';
		if(parseInt(val) < 10){
			v='0';
		}
		v+=val;
		return v;
	},
	fSetSelectedDay: function (obj,num) 	{
		var v = document.getElementById(obj);
		if (!isNaN(parseInt(v.childNodes[0].innerHTML))) {
			v.className = "CalendarHvr";
			var dateval = parseInt(v.childNodes[0].innerHTML);
			
			curmon =parseInt(this.config[num].dCurMonth)-parseInt(1);
			
			//v.value = dateval+"-"+this.config[num].ShortMonths[this.config[num].dCurMonth - 1] +"-"+this.config[num].dCurYear;
			v.value = this.fzeropad(curmon+1)+"-"+ this.fzeropad(dateval)+"-"+ this.config[num].dCurYear ;
this.config[num].SelectedValue =this.config[num].dCurYear+"/"+this.fzeropad(curmon+1)  +"/"+ this.fzeropad(dateval);
this.config[num].SelectedDescription =this.config[num].dCurYear+", "+this.Months[curmon]  +" "+ dateval;
			this.config[num].objPrevElement = v;
			if(!this.config[num].PageName) {this.config[num].PageName = SRESelectedPage; }
				pagename = this.config[num].PageName;
				var str ="";
				str += '_CalendarClick("';
					str += num;
					str += '","';
					str += this.config[num].SelectedValue;//v.value;
					str += '","';
					str += v.value;
					str += '","';
					str += this.config[num].SelectedDescription;
					str += '")';
					eval( pagename + str);
		}
		if(this.config[num].CalendarType =='L') {
			dv = document.getElementById(this.config[num].DivId);
			dv.innerHTML='';
		}else if(this.config[num].CalendarType =='H') { // need to close hyper menu
			var drp = "hpdrop" + this.config[num].CalendarId;
			v = document.getElementById(drp);
			v.innerHTML ='';
			var dlpy = "hpdisplay" + this.config[num].CalendarId;
			$(dlpy).value = this.config[num].SelectedDescription;//this.MenuElements[indx].Desc;
			$(dlpy).disabled=false;

			//this.drawHyper(drp,this.config[num].MenuId);
		}
		//if(this.config[num].CalendarType =='H') {
		//	sre_calendar.dropDown(num);
		//}
		
		//onclick="sre_calendar.dropDown(\''+num+'\')"
	},
	fUpdateCal: function (iMonth,num) 	{
		yr = this.config[num].dCurYear;
		var idval; var val; var new_txt;
		myMonth = this.fBuildCal(yr, iMonth,0);
		this.config[num].dCurMonth = iMonth;
		this.config[num].dCurYear = yr;
		this.config[num].SelectedValue='';
	curmon =parseInt(this.config[num].dCurMonth)-parseInt(1);
this.config[num].SelectedValue =this.config[num].dCurYear+"/"+this.fzeropad(curmon+1);//  +"/"+ this.fzeropad(dateval);
this.config[num].SelectedDescription =this.config[num].dCurYear+"/"+this.fzeropad(curmon+1);//  +"/"+ this.fzeropad(dateval);

//this.config[num].SelectedDescription =this.config[num].dCurYear+", "+this.Months[curmon]  +" "+ dateval;
				if(!this.config[num].PageName) {this.config[num].PageName = SRESelectedPage; }
				pagename = this.config[num].PageName;
				var str ="";
				str += '_CalendarClick("';
					str += num;
					str += '","';
					str += this.config[num].SelectedValue;//v.value;
					str += '","';
					str += v.value;
					str += '","';
					str += this.config[num].SelectedDescription;
					str += '")';
					eval( pagename + str);
		if(this.config[num].CalendarType =='L') {
			dv = document.getElementById(this.config[num].DivId);
			dv.innerHTML='';
		}else if(this.config[num].CalendarType =='H') { // need to close hyper menu
			var drp = "hpdrop" + this.config[num].CalendarId;
			v = document.getElementById(drp);
			v.innerHTML ='';
			var dlpy = "hpdisplay" + this.config[num].CalendarId;
			$(dlpy).value = this.config[num].SelectedDescription;//this.MenuElements[indx].Desc;
			$(dlpy).disabled=false;

			//this.drawHyper(drp,this.config[num].MenuId);
		}	
	/*	for (w = 1; w < 7; w++) {
			for (d = 0; d < 7; d++) {
				idval = num+"_calDateText" + w + d;
				ct = document.getElementById(idval);
				val = myMonth[w][d];
			//	if(ct.value != undefined){
			//		alert("here");
			//		if(sre_core.isMSIE()) {
			//			ct.innerHTML = val;
			//		} else {
			//			ct.childNodes[0].innerHTML = val;
			//		}
			//	} else {
					if(sre_core.isMSIE()) {
						ct.innerHTML = val;
					} else {
						new_txt = document.createTextNode(val);
						ct.replaceChild(new_txt, ct.childNodes[0]);
						ct.id = idval;
						ct.childNodes[0].innerHTML = val;
					}
			//	}
			}
		}
	*/
	},
	MoveYear: function (dir,num)	{
		var d = parseInt(dir);
		yr = this.config[num].dCurYear;
		yr += d;
		this.config[num].dCurYear = yr
		ids = num +'_' +'tbSelYear';
		y = document.getElementById(ids);
		y.value = yr;
		//this.fUpdateCal(this.config[num].dCurMonth,num);
	},
	dropDownBlur: function (num){
		//alert("vf");
			var dlpy = "hpdisplay" + this.config[num].CalendarId;
			$(dlpy).value = this.config[num].SelectedDescription;//this.MenuElements[indx].Desc;
			$(dlpy).disabled=false;

		var drp = "hpdrop" + num;
		$(drp).innerHTML='';
	},
	dropDown: function (num){
		//[sremenulist.length]=n;
		for(x=0;x < sremenulist.length; x++ ){
			//this.refresh(sremenulist[x]);
			var oth = "hpdrop" + sremenulist[x];
			var othply = "hpdrop" + sremenulist[x];
			ot = document.getElementById(oth);
			if(ot) {ot.innerHTML = '';} //
			if($(othply))$(othply).disabled=false;
		}
		var drp = "hpdrop" + num;
		v = document.getElementById(drp);
		
	//	var x = "hpdisplay" + num;
		//$(x).disabled=true;
	//	$(x).value='';
		
		if(this.config[num].dropStatus == 0) {
		//alert("menuname : "+ this.config[num].MenuId);
			this.display(drp,this.config[num].CalendarId,this.config[num]);
			this.config[num].CalendarType = 'H';
			this.config[num].CalendarId = num;
			this.config[num].dropStatus = 1 ;
		} else {
			v.innerHTML = '';
			this.config[num].dropStatus = 0 ;
		}
	},
//	dropDownBlur: function (num){
//		//alert("gg");
//		this.config[num].dropStatus = 0 ;
//		var drp = "hpdisplay" + num;
//		$(drp).disabled=false;
//		//this.config[num].dropStatus = 0 ;
//	},
	dropDownPic: function (num){
		this.config[num].dropStatus = 0;
		sre_monthyear.dropDown(num);
	},
	dropDownPicDummy: function (num){
		var drph = "hpdisplay" + num;
		//if($(drph).value !=''){
			$(drph).disabled=true;
		//}
		
		var drp = "hppic" + num;
		$(drp).click();
		$(drph).disabled=false;
	},
	drawHyper: function (cont,num){
		var html='';var status = 0; var Words = new Array();
		vv = document.getElementById(cont);
	/*
		html += '<table border="0" width="'+this.config[num].CalendarWidth+'" cellpadding="0" cellspacing="0" style="background-color:'+this.config[num].BackColor+';">';
		html += '<tr>';
		html += '<td class="'+this.config[num].hyperDisplayCls+'" onclick="sre_calendar.dropDown(\''+num+'\')" width="100%" style="cursor:pointer;background-color:#ffffff"  >';
			html += '<input onfocus="sre_calendar.dropDown(\''+num+'\')" onkeydown="sre_calendar.dropDown(\''+num+'\')" id="hpdisplay'+num+'"  value=';
			html += this.config[num].hyperDisplay;
			html += '></input>';
		html += '</td>';
		html += '<td valign="bottom" style="cursor:pointer;padding-left:0; padding-right:0;height:15px;" >';
		html += '<img style="height:15px;" border="0" src="'+this.config[num].hyperDropDownPic+'" onclick="sre_calendar.dropDownPic(\''+num+'\')" class="menureg"></img>';
		html += '</td>';
		html += '</tr>';
	*/
	
		html += '<table border="0" width="'+this.config[num].CalendarWidth+'" cellpadding="0" cellspacing="0" style="background-color:'+this.config[num].BackColor+';">';
		html += '<tr>';
		html += '<td class="'+this.config[num].hyperDisplayCls+'"  width="100%" style="cursor:pointer;height:10;padding-left:5;  padding-right:0;background-color:transparent;"  >';
			html += '<input id="hpdisplay'+num+'" onblur="sre_monthyear.dropDownBlur(\''+num+'\')" onfocus="sre_monthyear.dropDownPicDummy(\''+num+'\')" class="'+this.config[num].hyperDisplayCls+'" value="';
			html += this.config[num].hyperDisplay;
			html += '">';
			html +='</input>';
		html += '</td>';
		html += '<td valign="bottom" style="cursor:pointer;padding-left:0; padding-right:0;height:15px;" >';
		html += '<img id="hppic'+num+'" style="height:15px;" border="0" src="'+this.config[num].hyperDropDownPic+'" onclick="sre_monthyear.dropDownPic(\''+num+'\')" class="menureg"></img>';
		html += '</td>';
		html += '</tr>';
		

	
	
	
		html += '<tr>';
		html += '<td colspan="2">';
		if(sre_core.isMSIE() ){
			html += '<div id="hpdrop'+num+'" style="position:absolute;z-index:100;filter:progid:DXImageTransform.Microsoft.Alpha(opacity='+this.config[num].hyperOpacity+');" class="menureg"></div>';
		} else {
			html += '<div id="hpdrop'+num+'" style="position:absolute;z-index:100;opacity:'+parseInt(this.config[num].hyperOpacity)/100+';" class="menureg"></div>';
		}
		
		//alert(this.config[num].hyperOpacity);
		html += '</td>';
		html += '</tr>';
		html += '</table>';
		//alert(html);
		
		if(vv) {
			vv.innerHTML = html;
		}
	},	
	showCalendar: function (num,divid)	{
		var calhtml=''; dataname ="";
		myMonth = this.fBuildCal(this.config[num].dCurYear, this.config[num].dCurMonth, 0);
		//alert(this.config[num].CalendarType);
			if(this.config[num].CalendarType == 'L' ) {
			  calhtml +='<div id="sre_pop_div" style="background-color:rgb(255,255,255)">';
			  calhtml +='<table border="0" cellpadding="0" cellspacing="0" style="border-top:0px transparent; border-left:0px transparent;border-bottom:1px solid gray; border-right:1px solid gray;">';
			  calhtml +='<tr><td align="right" height="15" style="background-color:rgb(206,206,255)">';
			  	   
    		  calhtml+='<img border="0" style="cursor:pointer;background-color:transparent" src="/EN/SRESYS/Pic/commonstyle/cancel.png" height="15" onclick="cancelDiv(\''+this.config[num].DivId+'\',\'MNYR_'+num+'\')"></img>';
			  calhtml +='</td></tr><tr><td>';	
			}
		calhtml += '<table class="calendar" style="background-color:rgb(255,255,255)" border="0" width="'+this.config[num].CalendarWidth+'">';
		calhtml +=	'<tr>';
		calhtml +=	'<td  colspan="2">';
		calhtml += '<table border="0">';
		calhtml+=		'<tr>';
		calhtml+=		'<td colspan="2">';
		calhtml += '<table border="0" width="'+this.config[num].CalendarWidth+'" cellpadding="0" cellspacing="0">';
		calhtml+=		'<tr>';
		calhtml+=		'<td >';
		calhtml += '<tr><td colspan="1">';
		if(this.config[num].ShowHeader == 1) {
			calhtml += this.config[num].CalendarName;
		}
		calhtml += '</td><td>';		
		idy = num +'_' +'tbSelYear';
		calhtml+=		'<img style="cursor:pointer;" src="../../../EN/SRESYS/Pic/commonstyle/prevsm.png" height="15" width="15" name="back" onclick=sre_monthyear.MoveYear('+ -5 +',\''+num+'\')>';
		
		calhtml+=		'<img style="cursor:pointer;" src="../../../EN/SRESYS/Pic/commonstyle/arrow-left.png" height="15" width="15" name="back" onclick=sre_monthyear.MoveYear('+ -1 +',\''+num+'\')>';
		calhtml+=		'<input type="text" id='+idy+' name='+idy+' size="6" value="'+this.config[num].dCurYear+'" disabled></input>';
		calhtml+=		'<img style="cursor:pointer;" src="../../../EN/SRESYS/Pic/commonstyle/arrow-right.png" height="15" width="15" name="forw" onclick=sre_monthyear.MoveYear('+1 +',\''+num+'\')>';

		calhtml+=		'<img style="cursor:pointer;" src="../../../EN/SRESYS/Pic/commonstyle/nextsm.png" height="15" width="15" name="forw" onclick=sre_monthyear.MoveYear('+5 +',\''+num+'\')>';
		
		calhtml += '</td></tr>';			
		calhtml += '</table>';
		calhtml+=		'</td>';
		calhtml+=		'</tr>';
		calhtml+=		'<tr>';
		calhtml+=		'<td >';
		idm = num +'_' +'tbSelMonth';

		calhtml+=		'<select id='+idm+' style="width:135;" name='+idm+' value="9" onchange="sre_monthyear.fUpdateCal(this.value,\''+num+'\')">';
		for (i=1; i<13;i++) {
			if (i == this.config[num].dCurMonth ) {
				calhtml+=	'<option value="'+ i +'" selected>'+this.Months[i-1]+'</option>';
			} else{
				calhtml+=	'<option value="'+ i +'">'+this.Months[i-1]+'</option>';
			}
		}
		calhtml+=		'</select>';
		calhtml+=		'</td>';
		calhtml+=		'</tr>';
		calhtml+=		'<tr>';
		calhtml+=		'<td >';
	/*	calhtml += '<table border="1" >';
		calhtml += '<tr>';
		calhtml += '<td align="center" style="color:rgb(255,94,94);background-color:#f2f2f2;text-align:left; font-family:Arial,sans-serif;font-style:italic; font-size:10pt; font-weight:bold; border-top:1px solid gray; border-left:1px solid gray;border-bottom:0px solid gray; border-right:0px solid gray;">' + myMonth[0][0] + '</td>';
		calhtml += '<td align="center" style="color:#727272;background-color:#f2f2f2;text-align:left; font-family:Arial,sans-serif;font-style:italic; font-size:10pt; font-weight:bold; border-top:1px solid gray; border-left:1px solid gray;border-bottom:0px solid gray; border-right:0px solid gray;">' + myMonth[0][1] + '</td>';
		calhtml += '<td align="center" style="color:#727272;background-color:#f2f2f2;text-align:left; font-family:Arial,sans-serif;font-style:italic; font-size:10pt; font-weight:bold; border-top:1px solid gray; border-left:1px solid gray;border-bottom:0px solid gray; border-right:0px solid gray;">' + myMonth[0][2] + '</td>';
		calhtml += '<td align="center" style="color:#727272;background-color:#f2f2f2;text-align:left; font-family:Arial,sans-serif;font-style:italic; font-size:10pt; font-weight:bold; border-top:1px solid gray; border-left:1px solid gray;border-bottom:0px solid gray; border-right:0px solid gray;">' + myMonth[0][3] + '</td>';
		calhtml += '<td align="center" style="color:#727272;background-color:#f2f2f2;text-align:left; font-family:Arial,sans-serif;font-style:italic; font-size:10pt; font-weight:bold; border-top:1px solid gray; border-left:1px solid gray;border-bottom:0px solid gray; border-right:0px solid gray;">' + myMonth[0][4] + '</td>';
		calhtml += '<td align="center" style="color:#727272;background-color:#f2f2f2;text-align:left; font-family:Arial,sans-serif;font-style:italic; font-size:10pt; font-weight:bold; border-top:1px solid gray; border-left:1px solid gray;border-bottom:0px solid gray; border-right:0px solid gray;">' + myMonth[0][5] + '</td>';
		calhtml += '<td align="center" style="color:#727272;background-color:#f2f2f2;text-align:left; font-family:Arial,sans-serif;font-style:italic; font-size:10pt; font-weight:bold; border-top:1px solid gray; border-left:1px solid gray;border-bottom:0px solid gray; border-right:0px solid gray;">' + myMonth[0][6] + '</td>';
		calhtml += '</tr>';
		var idval;
		for (w = 1; w < 7; w++) {
			calhtml += '<tr>';
			for (d = 0; d < 7; d++) {
				if ( (!isNaN(myMonth[w][d]))  ) {
					idval = num+"_calDateText" + w + d; 
					calhtml += '<td  align="left" valign="top" width="' + this.config[num].iCellWidth + '" height="' + this.config[num].iCellHeight + '" id="'+idval+'" style="color:#07015c; cursor:pointer;font-family:Arial,sans-serif;font-style:normal; font-size:10pt; font-weight:normal;" onMouseOver="sre_monthyear.fToggleColor(\''+num+'\',\''+idval+'\',1)" onMouseOut="sre_monthyear.fToggleColor(\''+num+'\',\''+idval+'\',0)" onclick="sre_monthyear.fSetSelectedDay(\''+idval+'\',\''+num+'\')">';
						calhtml += '<span class=""  id="'+idval+'" value="*" >' + myMonth[w][d] + '</span>';
				} 
				calhtml += '</td>';
			}
			calhtml += '</tr>';
		}
		calhtml += '</table>';
		calhtml+=		'</td>';
		calhtml+=		'</tr>';
		calhtml+=		'</table>';
	*/	
		calhtml +=		'</td>';
		calhtml +=		'</tr>';
		calhtml +=		'</table>';
			if(this.config[num].CalendarType == 'L' ) {
			  calhtml +='</td></tr></table>';	
			  calhtml +='<div>';
			}

		vv =	document.getElementById(divid);
		vv.innerHTML=calhtml;
	}
};

/* -----------------------END(sre_monthyear)---------------------------------- */



/* ---------------------Begin(sre_calendar)---------------------------------- *\
 * eMiliue v1.0 Copyright (c) 2010 Sreejon LLC 
 * Contact us at sreejon2006@msn.com
 * This copyright notice MUST stay intact for use.
 *
 * $Revision: 1.0 $

Dependency :	[Meant to work with Sreejon message structure ]
				No dependency

Description :	All calendar rountines needed throughout the system 

Usage:
<div id="area1" style="width:150px;height:300px;"></div>
----------
var fullcal = new sre_calendar.Settings();
fullcal.dCurMonth = 6;
fullcal.dCurYear = 2007;
fullcal.PageName='test';

sre_calendar.display("area1",'first',fullcal);  // second param is the calendar name


Following events will be supported 
[num calendar name, date formatted date ]

function [pagename]_CalendarClick(num,date){} 

\* ---------------------------------------------------------------------- */
//var srecalendarlist = new Array();

var sre_calendar = {
	Settings: function() {
		this.CalendarId;
		this.CalendarType = 'N';
		this.DivId;
		this.CalendarName = "";
		this.ShowHeader = 1;
		this.dCurMonth;
		this.dCurYear;
		this.DropDownPic = "../../../EN/SRESYS/Pic/commonstyle/childc.gif";
		this.hyperDropDownPic = "../../../EN/SRESYS/Pic/commonstyle/childc.gif";

		//this.dCurDate;
		this.BackColor='#ffffff';
		this.iCellWidth = 15;
		this.iCellHeight = 8;
		this.sDateTextSize = "12px"; 
		this.sDateTextWeight = "bold";
		this.SelectedValue = "";
		this.SelectedDescription = "";
		this.hyperDisplay='';
		this.hyperDisplayCls='formctl';
		this.calendarHdr='formctl';
		this.PageName='';
		this.Top=0;
		this.Left=0;
		this.Layer=0;
		this.objPrevElement='';
		this.CalendarHvr = "menureghov";
		this.CalendarOut = "menureg";
		this.CalendarWidth = "140";
	},
	config: new Array(),
	Months: new Array(),
	ShortMonths: new Array(),
	
	dCurDate: new Date(),
	CalendarElements:  new Array(),
	setSettings: function(n, settings) {
		
		if(typeof(settings) != "object") {
			this.config[n] = new this.Settings();
		}
		else {
			this.config[n] = settings;
		}
		sremenulist[sremenulist.length]=n;
		sremenutypelist[sremenutypelist.length]='CLDR';
	},
	render: function(divid,html) {	
		v = document.getElementById(divid);
		v.innerHTML = html;
	},
	cancelDiv: function (cont,num) {
		pagename = this.config[num].PageName;
		str ="";
		str += '_MenuCancel("';
		str += num;
		str += '")';
		eval( this.config[num].PageName + str);
	},
	display: function(divid,id,settings) {	
		this.setSettings(id, settings);
		this.config[id].CalendarId = id;
		this.config[id].CalendarType = 'N';
		this.config[id].DivId = divid;	
		if(!this.config[id].dCurMonth) {this.config[id].dCurMonth = this.dCurDate.getMonth()+1;}
		if(!this.config[id].dCurYear) {this.config[id].dCurYear = this.dCurDate.getFullYear();}
		this.Months = ["January", "February", "March", "April", "May", "June",
			"July", "August", "September", "October", "November", "December"];
		this.ShortMonths = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN",
			"JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
		this.showCalendar(id,divid);
	},
	displayHyper: function(divid,id,settings) {	
		this.setSettings(id, settings);
		this.config[id].CalendarId = id;
		this.config[id].CalendarType = 'H';
		this.config[id].DivId = divid;	
		this.config[id].dropStatus = 0;
		this.drawHyper(divid,id);
	},
	displayLookup: function(divid,id,settings,top,left) {	//here setting is a label not an object
		this.setSettings(id, settings);
		this.config[id].CalendarId = id;
		this.config[id].CalendarType = 'L';
		this.config[id].DivId = divid;
		if(!this.config[id].dCurMonth) {this.config[id].dCurMonth = this.dCurDate.getMonth()+1;}
		if(!this.config[id].dCurYear) {this.config[id].dCurYear = this.dCurDate.getFullYear();}
		this.Months = ["January", "February", "March", "April", "May", "June",
			"July", "August", "September", "October", "November", "December"];
		this.ShortMonths = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN",
			"JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
		dv = document.getElementById(divid);
		dv.style.position ='absolute';
		ly = parseInt(this.config[id].Layer) + 1;
		dv.style.zIndex =ly;
		dv.style.top = top;
		this.config[id].Top = top;
		dv.style.left = left;
		this.config[id].Left = left;
		this.showCalendar(id,divid);
	},
	fGetDaysInMonth: function (iMonth, iYear) {
		var dPrevDate = new Date(iYear, iMonth, 0);
		return dPrevDate.getDate();
	},
	fBuildCal: function (iYear, iMonth, iDayStyle) {
		var aMonth = new Array();
		aMonth[0] = new Array(7);
		aMonth[1] = new Array(7);
		aMonth[2] = new Array(7);
		aMonth[3] = new Array(7);
		aMonth[4] = new Array(7);
		aMonth[5] = new Array(7);
		aMonth[6] = new Array(7);
		var dCalDate = new Date(iYear, iMonth-1, 1);
		var iDayOfFirst = dCalDate.getDay();
		var iDaysInMonth = this.fGetDaysInMonth(iMonth, iYear);
		var iVarDate = 1;
		var i, d, w;
		if (iDayStyle == 2) {
			aMonth[0][0] = "Sunday";
			aMonth[0][1] = "Monday";
			aMonth[0][2] = "Tuesday";
			aMonth[0][3] = "Wednesday";
			aMonth[0][4] = "Thursday";
			aMonth[0][5] = "Friday";
			aMonth[0][6] = "Saturday";
		} else if (iDayStyle == 1) {
			aMonth[0][0] = "Sun";
			aMonth[0][1] = "Mon";
			aMonth[0][2] = "Tue";
			aMonth[0][3] = "Wed";
			aMonth[0][4] = "Thu";
			aMonth[0][5] = "Fri";
			aMonth[0][6] = "Sat";
		} else {
			aMonth[0][0] = "S";
			aMonth[0][1] = "M";
			aMonth[0][2] = "T";
			aMonth[0][3] = "W";
			aMonth[0][4] = "T";
			aMonth[0][5] = "F";
			aMonth[0][6] = "S";
		}
		for (c =0; c < iDayOfFirst; c++) {
			aMonth[1][c] = " ";
		}
		for (d = iDayOfFirst; d < 7; d++) {
				aMonth[1][d] = iVarDate;
				iVarDate++;
		}
		for (w = 2; w < 7; w++) {
			for (d = 0; d < 7; d++) {
				if (iVarDate <= iDaysInMonth) {
					aMonth[w][d] = iVarDate;
					iVarDate++;
				} else {
					aMonth[w][d] = " ";
				}
			}
		}
		return aMonth;
	},
	fToggleColor: function (num,id,mode) 	{
		v = document.getElementById(id);
		if (mode == 1) {
			v.className = this.config[num].CalendarHvr;
		} else {
			v.className = this.config[num].CalendarOut;
		}
	},
	fdaydiff: function(firstdate,currdate){
		var one_day=1000*60*60*24;
		fulldays = Math.ceil((currdate.getTime()-firstdate.getTime())/(one_day));
		return fulldays;
	},
	fzeropad: function(val){
		v ='';
		if(parseInt(val) < 10){
			v='0';
		}
		v+=val;
		return v;
	},
	fSetSelectedDay: function (obj,num) 	{
		var v = document.getElementById(obj);
		if (!isNaN(parseInt(v.childNodes[0].innerHTML))) {
			v.className = "CalendarHvr";
			var dateval = parseInt(v.childNodes[0].innerHTML);
			
			curmon =parseInt(this.config[num].dCurMonth)-parseInt(1);
			
			//v.value = dateval+"-"+this.config[num].ShortMonths[this.config[num].dCurMonth - 1] +"-"+this.config[num].dCurYear;
			v.value = this.fzeropad(curmon+1)+"-"+ this.fzeropad(dateval)+"-"+ this.config[num].dCurYear ;
this.config[num].SelectedValue =this.config[num].dCurYear+"/"+this.fzeropad(curmon+1)  +"/"+ this.fzeropad(dateval);
this.config[num].SelectedDescription =this.config[num].dCurYear+", "+this.Months[curmon]  +" "+ dateval;
			this.config[num].objPrevElement = v;
			if(!this.config[num].PageName) {this.config[num].PageName = SRESelectedPage; }
				pagename = this.config[num].PageName;
				var str ="";
				str += '_CalendarClick("';
					str += num;
					str += '","';
					str += this.config[num].SelectedValue;//v.value;
					str += '","';
					str += v.value;
					str += '","';
					str += this.config[num].SelectedDescription;
					str += '")';
					eval( pagename + str);
		}
		if(this.config[num].CalendarType =='L') {
			dv = document.getElementById(this.config[num].DivId);
			dv.innerHTML='';
		}else if(this.config[num].CalendarType =='H') { // need to close hyper menu
			var drp = "hpdrop" + this.config[num].CalendarId;
			v = document.getElementById(drp);
			v.innerHTML ='';
			var dlpy = "hpdisplay" + this.config[num].CalendarId;
			$(dlpy).value = this.config[num].SelectedDescription;//this.MenuElements[indx].Desc;
			$(dlpy).disabled=false;

			//this.drawHyper(drp,this.config[num].MenuId);
		}
		//if(this.config[num].CalendarType =='H') {
		//	sre_calendar.dropDown(num);
		//}
		
		//onclick="sre_calendar.dropDown(\''+num+'\')"
	},
	fUpdateCal: function (iMonth,num) 	{
		yr = this.config[num].dCurYear;
		var idval; var val; var new_txt;
		myMonth = this.fBuildCal(yr, iMonth,0);
		this.config[num].dCurMonth = iMonth;
		this.config[num].dCurYear = yr;
		this.config[num].SelectedValue='';
		for (w = 1; w < 7; w++) {
			for (d = 0; d < 7; d++) {
				idval = num+"_calDateText" + w + d;
				ct = document.getElementById(idval);
				val = myMonth[w][d];
			//	if(ct.value != undefined){
			//		alert("here");
			//		if(sre_core.isMSIE()) {
			//			ct.innerHTML = val;
			//		} else {
			//			ct.childNodes[0].innerHTML = val;
			//		}
			//	} else {
					if(sre_core.isMSIE()) {
						ct.innerHTML = val;
					} else {
						new_txt = document.createTextNode(val);
						ct.replaceChild(new_txt, ct.childNodes[0]);
						ct.id = idval;
						ct.childNodes[0].innerHTML = val;
					}
			//	}
			}
		}
	},
	MoveYear: function (dir,num)	{
		var d = parseInt(dir);
		yr = this.config[num].dCurYear;
		yr += d;
		this.config[num].dCurYear = yr
		ids = num +'_' +'tbSelYear';
		y = document.getElementById(ids);
		y.value = yr;
		this.fUpdateCal(this.config[num].dCurMonth,num);
	},
	dropDownBlur: function (num){
		//alert("vf");
			var dlpy = "hpdisplay" + this.config[num].CalendarId;
			$(dlpy).value = this.config[num].SelectedDescription;//this.MenuElements[indx].Desc;
			$(dlpy).disabled=false;

		var drp = "hpdrop" + num;
		$(drp).innerHTML='';
	},
	dropDown: function (num){
		//[sremenulist.length]=n;
		for(x=0;x < sremenulist.length; x++ ){
			//this.refresh(sremenulist[x]);
			var oth = "hpdrop" + sremenulist[x];
			var othply = "hpdrop" + sremenulist[x];
			ot = document.getElementById(oth);
			if(ot) {ot.innerHTML = '';} //
			if($(othply))$(othply).disabled=false;
		}
		var drp = "hpdrop" + num;
		v = document.getElementById(drp);
		
	//	var x = "hpdisplay" + num;
		//$(x).disabled=true;
	//	$(x).value='';
		
		if(this.config[num].dropStatus == 0) {
		//alert("menuname : "+ this.config[num].MenuId);
			this.display(drp,this.config[num].CalendarId,this.config[num]);
			this.config[num].CalendarType = 'H';
			this.config[num].CalendarId = num;
			this.config[num].dropStatus = 1 ;
		} else {
			v.innerHTML = '';
			this.config[num].dropStatus = 0 ;
		}
	},
//	dropDownBlur: function (num){
//		//alert("gg");
//		this.config[num].dropStatus = 0 ;
//		var drp = "hpdisplay" + num;
//		$(drp).disabled=false;
//		//this.config[num].dropStatus = 0 ;
//	},
	dropDownPic: function (num){
		this.config[num].dropStatus = 0;
		sre_calendar.dropDown(num);
	},
	dropDownPicDummy: function (num){
		var drph = "hpdisplay" + num;
		//if($(drph).value !=''){
			$(drph).disabled=true;
		//}
		
		var drp = "hppic" + num;
		$(drp).click();
		$(drph).disabled=false;
	},
	drawHyper: function (cont,num){
		var html='';var status = 0; var Words = new Array();
		vv = document.getElementById(cont);
	/*
		html += '<table border="0" width="'+this.config[num].CalendarWidth+'" cellpadding="0" cellspacing="0" style="background-color:'+this.config[num].BackColor+';">';
		html += '<tr>';
		html += '<td class="'+this.config[num].hyperDisplayCls+'" onclick="sre_calendar.dropDown(\''+num+'\')" width="100%" style="cursor:pointer;background-color:#ffffff"  >';
			html += '<input onfocus="sre_calendar.dropDown(\''+num+'\')" onkeydown="sre_calendar.dropDown(\''+num+'\')" id="hpdisplay'+num+'"  value=';
			html += this.config[num].hyperDisplay;
			html += '></input>';
		html += '</td>';
		html += '<td valign="bottom" style="cursor:pointer;padding-left:0; padding-right:0;height:15px;" >';
		html += '<img style="height:15px;" border="0" src="'+this.config[num].hyperDropDownPic+'" onclick="sre_calendar.dropDownPic(\''+num+'\')" class="menureg"></img>';
		html += '</td>';
		html += '</tr>';
	*/
	
		html += '<table border="0" width="'+this.config[num].CalendarWidth+'" cellpadding="0" cellspacing="0" style="background-color:'+this.config[num].BackColor+';">';
		html += '<tr>';
		html += '<td class="'+this.config[num].hyperDisplayCls+'"  width="100%" style="cursor:pointer;height:10;padding-left:5;  padding-right:0;background-color:transparent;"  >';
			html += '<input id="hpdisplay'+num+'" onblur="sre_calendar.dropDownBlur(\''+num+'\')" onfocus="sre_calendar.dropDownPicDummy(\''+num+'\')" class="'+this.config[num].hyperDisplayCls+'" value="';
			html += this.config[num].hyperDisplay;
			html += '">';
			html +='</input>';
		html += '</td>';
		html += '<td valign="bottom" style="cursor:pointer;padding-left:0; padding-right:0;height:15px;" >';
		html += '<img id="hppic'+num+'" style="height:15px;" border="0" src="'+this.config[num].hyperDropDownPic+'" onclick="sre_calendar.dropDownPic(\''+num+'\')" class="menureg"></img>';
		html += '</td>';
		html += '</tr>';
		

	
	
	
		html += '<tr>';
		html += '<td colspan="2">';
		if(sre_core.isMSIE() ){
			html += '<div id="hpdrop'+num+'" style="position:absolute;z-index:100;filter:progid:DXImageTransform.Microsoft.Alpha(opacity='+this.config[num].hyperOpacity+');" class="menureg"></div>';
		} else {
			html += '<div id="hpdrop'+num+'" style="position:absolute;z-index:100;opacity:'+parseInt(this.config[num].hyperOpacity)/100+';" class="menureg"></div>';
		}
		
		//alert(this.config[num].hyperOpacity);
		html += '</td>';
		html += '</tr>';
		html += '</table>';
		//alert(html);
		
		if(vv) {
			vv.innerHTML = html;
		}
	},	
	showCalendar: function (num,divid)	{
		var calhtml=''; dataname ="";
		myMonth = this.fBuildCal(this.config[num].dCurYear, this.config[num].dCurMonth, 0);
		//alert(this.config[num].CalendarType);
			if(this.config[num].CalendarType == 'L' ) {
			  calhtml +='<div id="sre_pop_div" style="background-color:rgb(255,255,255)">';
			  calhtml +='<table border="0" cellpadding="0" cellspacing="0" style="border-top:0px transparent; border-left:0px transparent;border-bottom:1px solid gray; border-right:1px solid gray;">';
			  calhtml +='<tr><td align="right" height="15" style="background-color:rgb(206,206,255)">';
			  	   
    		  calhtml+='<img border="0" style="cursor:pointer;background-color:transparent" src="/EN/SRESYS/Pic/commonstyle/cancel.png" height="15" onclick="cancelDiv(\''+this.config[num].DivId+'\',\'CLDR_'+num+'\')"></img>';
			  calhtml +='</td></tr><tr><td>';	
			}
		calhtml += '<table class="calendar" style="background-color:rgb(255,255,255)" border="0" width="'+this.config[num].CalendarWidth+'">';
		calhtml +=	'<tr>';
		calhtml +=	'<td  colspan="2">';
		calhtml += '<table border="0">';
		calhtml+=		'<tr>';
		calhtml+=		'<td colspan="2">';
		calhtml += '<table border="0" width="'+this.config[num].CalendarWidth+'" cellpadding="0" cellspacing="0">';
		calhtml+=		'<tr>';
		calhtml+=		'<td >';
		calhtml += '<tr><td colspan="1">';
		if(this.config[num].ShowHeader == 1) {
			calhtml += this.config[num].CalendarName;
		}
		calhtml += '</td><td>';		
		idy = num +'_' +'tbSelYear';
		calhtml+=		'<img style="cursor:pointer;" src="../../../EN/SRESYS/Pic/commonstyle/prevsm.png" height="15" width="15" name="back" onclick=sre_calendar.MoveYear('+ -5 +',\''+num+'\')>';
		
		calhtml+=		'<img style="cursor:pointer;" src="../../../EN/SRESYS/Pic/commonstyle/arrow-left.png" height="15" width="15" name="back" onclick=sre_calendar.MoveYear('+ -1 +',\''+num+'\')>';
		calhtml+=		'<input type="text" id='+idy+' name='+idy+' size="6" value="'+this.config[num].dCurYear+'" disabled></input>';
		calhtml+=		'<img style="cursor:pointer;" src="../../../EN/SRESYS/Pic/commonstyle/arrow-right.png" height="15" width="15" name="forw" onclick=sre_calendar.MoveYear('+1 +',\''+num+'\')>';

		calhtml+=		'<img style="cursor:pointer;" src="../../../EN/SRESYS/Pic/commonstyle/nextsm.png" height="15" width="15" name="forw" onclick=sre_calendar.MoveYear('+5 +',\''+num+'\')>';
		
		calhtml += '</td></tr>';			
		calhtml += '</table>';
		calhtml+=		'</td>';
		calhtml+=		'</tr>';
		calhtml+=		'<tr>';
		calhtml+=		'<td >';
		idm = num +'_' +'tbSelMonth';

		calhtml+=		'<select id='+idm+' style="width:135;" name='+idm+' value="9" onchange="sre_calendar.fUpdateCal(this.value,\''+num+'\')">';
		for (i=1; i<13;i++) {
			if (i == this.config[num].dCurMonth ) {
				calhtml+=	'<option value="'+ i +'" selected>'+this.Months[i-1]+'</option>';
			} else{
				calhtml+=	'<option value="'+ i +'">'+this.Months[i-1]+'</option>';
			}
		}
		calhtml+=		'</select>';
		calhtml+=		'</td>';
		calhtml+=		'</tr>';
		calhtml+=		'<tr>';
		calhtml+=		'<td >';
		calhtml += '<table border="0" >';
		calhtml += '<tr>';
		calhtml += '<td align="center" style="color:rgb(255,94,94);background-color:#f2f2f2;text-align:left; font-family:Arial,sans-serif;font-style:italic; font-size:10pt; font-weight:bold; border-top:1px solid gray; border-left:1px solid gray;border-bottom:0px solid gray; border-right:0px solid gray;">' + myMonth[0][0] + '</td>';
		calhtml += '<td align="center" style="color:#727272;background-color:#f2f2f2;text-align:left; font-family:Arial,sans-serif;font-style:italic; font-size:10pt; font-weight:bold; border-top:1px solid gray; border-left:1px solid gray;border-bottom:0px solid gray; border-right:0px solid gray;">' + myMonth[0][1] + '</td>';
		calhtml += '<td align="center" style="color:#727272;background-color:#f2f2f2;text-align:left; font-family:Arial,sans-serif;font-style:italic; font-size:10pt; font-weight:bold; border-top:1px solid gray; border-left:1px solid gray;border-bottom:0px solid gray; border-right:0px solid gray;">' + myMonth[0][2] + '</td>';
		calhtml += '<td align="center" style="color:#727272;background-color:#f2f2f2;text-align:left; font-family:Arial,sans-serif;font-style:italic; font-size:10pt; font-weight:bold; border-top:1px solid gray; border-left:1px solid gray;border-bottom:0px solid gray; border-right:0px solid gray;">' + myMonth[0][3] + '</td>';
		calhtml += '<td align="center" style="color:#727272;background-color:#f2f2f2;text-align:left; font-family:Arial,sans-serif;font-style:italic; font-size:10pt; font-weight:bold; border-top:1px solid gray; border-left:1px solid gray;border-bottom:0px solid gray; border-right:0px solid gray;">' + myMonth[0][4] + '</td>';
		calhtml += '<td align="center" style="color:#727272;background-color:#f2f2f2;text-align:left; font-family:Arial,sans-serif;font-style:italic; font-size:10pt; font-weight:bold; border-top:1px solid gray; border-left:1px solid gray;border-bottom:0px solid gray; border-right:0px solid gray;">' + myMonth[0][5] + '</td>';
		calhtml += '<td align="center" style="color:#727272;background-color:#f2f2f2;text-align:left; font-family:Arial,sans-serif;font-style:italic; font-size:10pt; font-weight:bold; border-top:1px solid gray; border-left:1px solid gray;border-bottom:0px solid gray; border-right:0px solid gray;">' + myMonth[0][6] + '</td>';
		calhtml += '</tr>';
		var idval;
		for (w = 1; w < 7; w++) {
			calhtml += '<tr>';
			for (d = 0; d < 7; d++) {
				if ( (!isNaN(myMonth[w][d]))  ) {
					idval = num+"_calDateText" + w + d; 
					calhtml += '<td  align="left" valign="top" width="' + this.config[num].iCellWidth + '" height="' + this.config[num].iCellHeight + '" id="'+idval+'" style="color:#07015c; cursor:pointer;font-family:Arial,sans-serif;font-style:normal; font-size:10pt; font-weight:normal;" onMouseOver="sre_calendar.fToggleColor(\''+num+'\',\''+idval+'\',1)" onMouseOut="sre_calendar.fToggleColor(\''+num+'\',\''+idval+'\',0)" onclick="sre_calendar.fSetSelectedDay(\''+idval+'\',\''+num+'\')">';
						calhtml += '<span class=""  id="'+idval+'" value="*" >' + myMonth[w][d] + '</span>';
				} 
				calhtml += '</td>';
			}
			calhtml += '</tr>';
		}
		calhtml += '</table>';
		calhtml+=		'</td>';
		calhtml+=		'</tr>';
		calhtml+=		'</table>';
		calhtml +=		'</td>';
		calhtml +=		'</tr>';
		calhtml +=		'</table>';
			if(this.config[num].CalendarType == 'L' ) {
			  calhtml +='</td></tr></table>';	
			  calhtml +='<div>';
			}

		vv =	document.getElementById(divid);
		vv.innerHTML=calhtml;
	}
};

/* -----------------------END(sre_calendar)---------------------------------- */

/* ---------------------Begin(sre_grid)---------------------------------- *\
 * eMiliue v1.0 Copyright (c) 2010 Sreejon LLC 
 * Contact us at sreejon2006@msn.com
 * This copyright notice MUST stay intact for use.
 *
 * $Revision: 1.0 $

Dependency :	[Meant to work with Sreejon message structure ]
				No dependency

Description :	All grid rountines needed throughout the system 

Usage:
<div id="area1" style="width:150px;height:300px;"></div>
----------
var fullgrid = new sre_grid.Settings();
fullgrid.PageName = 'test';
var PERSONheader222 = new Array();
var PERSON = new Array();

// Grid column definition
//  Desc|Width|Hidden|Indx|Edit|Assist
	PERSONheader222[0] = "ID|15|N|N|N|N";
	PERSONheader222[1] = "Name|30|N|N|N|N";
	PERSONheader222[2] = "Who are they?|150|N|Y|Y|N";
	PERSONheader222[3] = "Department|30|N|N|N|Y";
//Grid Data
	PERSON[0] ="0|George|The cool guy|Finance";
	PERSON[1] ="1|Tina|The person in charge|IT";
	PERSON[2] ="2|Larry|The joker|Purchasing";
	PERSON[3] ="3|Debra|The epicenter|Finance";
	PERSON[4] ="4|Craig|The trouble maker|IT";
	PERSON[5] ="2|Lanka|The learner|Purchasing";
	PERSON[6] ="3|Greg|The fashion guy|Finance";
	PERSON[7] ="4|Laura|The mother|IT";

fullgrid.addGridArray(PERSON);  //data setting
fullgrid.addGridHeader(PERSONheader222); //header setting

	sre_grid.display("area1",'1st',fullgrid);    // second param is the grid name


Following events will be supported 
[num: grid name, rw: row cl: col, oldcolval: old col val, fullcol: full col, newval: edited value ]

function [pagename]_GridClick(num,rw,cl,curcolval,fullcol,indx){}
function [pagename]_GridEdited(num,rw,cl,oldcolval,fullcol,newval){}

\* ---------------------------------------------------------------------- */

var sre_grid = {
	Settings: function() {
		this.GridId;
		this.GridType = 'N';
		this.DivId;
		this.GridArraySet;
		this.GridHeaderSet;
		this.startR = 0;
		this.maxRow = 3;
		this.previousRow = null;
		this.previousCol = null;
		this.currentRow = -1;
		this.currentCol = -1;
		this.GridName = "";
		this.GridWidth = "140";
		this.GridHeight = "300";
		this.TreeElement;
		this.HeaderElement;
		this.GridSelectedCls = "colheadsel"; //header only
		this.GridNoSelectedCls = "colhead"; //header only
		this.oddRow = "evenrow";
		this.evenRow = "evenrow";
		this.HeaderRow = "colhead";
		this.selrowCls ='oddrow';
		this.selColCls ='oddrow';
		this.PageName='';
		this.HeaderRowSel = "colheadsel";
		this.Top=0;
		this.Left=0;
		this.Layer=0;
		this.suppressHeader=0;
		this.scrollableData = 1;
		this.scrollMenuIndex = -1;
		this.scrollMenucount =5;
		this.fixedScroll=0;
		this.DropDownPic = "../../../EN/SRESYS/Pic/commonstyle/childc.gif";
		this.hyperDropDownPic = "../../../EN/SRESYS/Pic/commonstyle/childc.gif";
		this.hyperDisplay='';
		this.hyperDisplayCls='formctl';
		
		//for dataarray
		
		this.msg ='';
		this.action = '';
		this.func ='';
		this.ajxid='';
		this.prev=0;
		this.nxt=0;
		this.totcnt=0;
		this.currsetting;
		
		this.addGridArray = function(grdArray) {
				this.GridArraySet = grdArray;
		};
		this.addGridHeader = function(grdArray) {
				this.GridHeaderSet = grdArray;
		};
	},
	config: new Array(),
	ColElements:  new Array(),
	setSettings: function(n, settings) {
		if(typeof(settings) != "object") {
			this.config[n] = new this.Settings();
		}
		else {
			this.config[n] = settings;
		}
		sremenulist[sremenulist.length]=n;
		sremenutypelist[sremenutypelist.length]='COLR';
	},
	MovePos: function (cnt,cont,num)	{	
		if(this.config[num].startR == 0 && cnt < 0) return;
		if(this.config[num].startR + this.config[num].maxRow > this.config[num].TreeElement.length && cnt >0) return;
		this.config[num].startR += cnt;
		this.drawGrid(cont,num);
	},
	EditCell: function (rwid,colid,cont,num,newval)	{
		//alert("new value: "+newval);
		if(!this.config[num].PageName) {this.config[num].PageName = SRESelectedPage; }
		pagename = this.config[num].PageName;
		Words = new Array();
		sre_core.breakWords(this.config[num].TreeElement[rwid],Words);
				var str ="";
				str += '_GridEdited("';
				str += num;
				str += '",';
				str += rwid;
				str += ',';
				str += colid;
				str += ',"';
				str += Words[colid];
				str += '","';
				str += Words;
				str += '","';
				str += newval;
				str += '")';
				eval( pagename + str);
	},
	SelectionRow: function (rwid,colid,cont,num)	{
		this.refresh(num);
		if(!this.config[num].PageName) {this.config[num].PageName = SRESelectedPage; }
		pagename = this.config[num].PageName;
		this.config[num].previousRow = this.config[num].currentRow;
		this.config[num].previousCol =this.config[num].currentCol;
		this.config[num].currentRow = rwid;
		this.config[num].currentCol = colid;
		Words = new Array();
		var newval='';
		sre_core.breakWords(this.config[num].TreeElement[rwid],Words);
		for(b = 0; b < this.config[num].HeaderElement.length; b++){
			if (this.ColElements[b].Indx == 'Y') {
				newval = Words[colid];
				var str ="";
				str += '_GridClick("';
				str += num;
				str += '",';
				str += rwid;
				str += ',';
				str += colid;
				str += ',"';
				str += Words[colid];
				str += '","';
				str += Words;
				str += '","';
				str += Words[b];
				str += '")';
				eval( pagename + str);
				break;
			}
		}	
		this.drawGrid(cont,num);
		if(this.config[num].GridType =='L') {
			dv = document.getElementById(this.config[num].DivId);
			dv.innerHTML='';
		}else if(this.config[num].GridType =='H') { // need to close hyper menu
			var drp = "hpdrop" + this.config[num].GridId;
			v = document.getElementById(drp);
			v.innerHTML ='';
			var dlpy = "hpdisplay" + this.config[num].GridId;
			$(dlpy).innerHTML = newval;//this.MenuElements[indx].Desc;
			//this.drawHyper(drp,this.config[num].MenuId);
		}
	},
	refresh: function (num){ //removed the first element
		Words = new Array();
		this.config[num].TreeElement = new Array();
		this.config[num].TreeElement = this.config[num].GridArraySet;
		this.config[num].HeaderElement = new Array();
		this.config[num].HeaderElement = this.config[num].GridHeaderSet;
		for(b = 0; b < this.config[num].HeaderElement.length; b++){
			sre_core.breakWords(this.config[num].HeaderElement[b],Words);
			this.ColElements[b] = {
				ColIndx: b,
				Desc: Words[0],
				Width: Words[1],
				Hidden: Words[2],
				Indx: Words[3],
				Edit: Words[4],
				Assist: Words[5]
			};
		}	
	},
	dataMenuCall: function(id,settings,msg,action,func,ajxid,datacnt,start) {
		alert(msg);
		this.setSettings(id, settings);
		msgint='';
		msgint +='<menuid>'+id+'</menuid>';
		
		this.config[id].scrollMenuIndex = start;
		
		msgint +='<menuindex>'+this.config[id].scrollMenuIndex+'</menuindex>';
		//if(datacnt){
			this.config[id].scrollMenucount = datacnt;
		//}
		this.config[id].msg = msg;
		this.config[id].action = action;
		this.config[id].func = func;
		this.config[id].ajxid = ajxid;
		msgint +='<datacount>'+this.config[id].scrollMenucount+'</datacount>';
		msgint +=msg;
		
		srePHPAsyncSubmit(msgint,action,func,true,ajxid,'Y');
	},
	dataLoadArray: function(menu,mnuList,respstr,id,totalcnt) {
		
		if(this.config[id].scrollMenuIndex > 0) {
			this.config[id].prev=1;
		} else {
			this.config[id].prev=0;
		}
		if(this.config[id].scrollMenucount + this.config[id].scrollMenuIndex > totalcnt){
			this.config[id].nxt=0;
		}else{
			this.config[id].nxt=1;
		}
		this.config[id].totcnt = totalcnt;
		var done=0;var pos=0;var word="";var ret = 1;var indx=0;
		var wordarray = new Array();
		len = respstr.length;
		sre_core.initializeList(mnuList);
		for(i=pos; i < len && done == 0; i++)	{
			if(respstr.slice(i,i+1)==';')		{
				word = respstr.slice(pos,i);
				if(word !=''){	
					mnuList[mnuList.length] = word;
				}
				pos = i + 1;
				if (word)			{
					wordarray[indx] = word;
					indx++;
				} else {
					ret = 0;
				}
				word=""; 
			}
		}
		word = respstr.slice(pos,i-1);
		if(word !=''){	
			mnuList[mnuList.length] = word;
		}
		wordarray[indx] = word;
		done = 1;
		menu.addMenuArray(mnuList);
	},
	
	scrollPrevNext: function(divid,id,settings,dir){
		this.setSettings(id, settings);
		this.config[id].scrollMenuIndex +=dir;
		sre_menu.dataMenuCall(id,this.config[id].currsetting,this.config[id].msg,
				       this.config[id].action,this.config[id].func,this.config[id].ajxid,
				       this.config[id].scrollMenucount,this.config[id].scrollMenuIndex);
		
		this.drawGrid(divid,id);
	},
	scrollMenu: function(id,pagenm,dir){
		
		str ="";
		str += '_MenuScroll("';
		str += id;
		str += '",';
		str += dir;
		str += ')';
		eval( pagenm + str);
	},
	dataScrollArrows: function(id,headfoot,settings) {
			this.setSettings(id, settings);
	totalcnt = this.config[id].totcnt	
		
		if(this.config[id].scrollMenuIndex > -1) {
			this.config[id].prev=1;
		} else {
			this.config[id].prev=0;
		}
		if(this.config[id].scrollMenucount + this.config[id].scrollMenuIndex > totalcnt){
			this.config[id].nxt=0;
		}else{
			this.config[id].nxt=1;
		}
	
		html='';
		pagename = this.config[id].PageName;
		if(this.config[id].scrollableData == 1){
			if(headfoot =='H'){
				html +='<table border="0" width="100%"><tr><td align="center" onclick="sre_menu.scrollMenu(\''+id+'\',\''+pagename+'\',-1)">';
				html +='<img src="/EN/SRESYS/Pic/Previous.gif" height="18"></img>';
				html +='</td></tr></table>';
			}
			if(headfoot =='F'){
				html +='<table border="0" width="100%"><tr><td align="center" onclick="sre_menu.scrollMenu(\''+id+'\',\''+pagename+'\',1)">';
				html +='<img src="/EN/SRESYS/Pic/Next.gif" height="18"></img>';
				html +='</td></tr></table>';
			}
		}
	
		return html;
	},	

	drawGrid: function (cont,num) {
		var html = ''; WordR = new Array();
		this.refresh(num);
		var maxRow = this.config[num].maxRow;
		var startR = this.config[num].startR;
		rwSelected=this.config[num].currentRow;
		colSelected=this.config[num].currentCol;
		var GridWidth = this.config[num].GridWidth;
		v = document.getElementById(cont);
		totRow = this.config[num].TreeElement.length;
		if(totRow > maxRow)   {
			moreRec = 1;
		}	
			if(this.config[num].GridType == 'L' ) {
			  html +='<div id="sre_pop_div" style="background-color:rgb(240,240,256)">';
			  html +='<table border="0" cellpadding="0" cellspacing="0" style="border-top:0px transparent; border-left:0px transparent;border-bottom:1px solid gray; border-right:1px solid gray;">';

			 
			  html +='<tr><td align="right" height="15" style="background-color:rgb(200,200,226)">';
			  	   
    		  html+='<img border="0" style="cursor:pointer;background-color:transparent" src="/EN/SRESYS/Pic/commonstyle/closesm.png" height="20" onclick="cancelDiv(\''+this.config[num].DivId+'\')"></img>';
			  html +='</td></tr><tr><td>';	
			}


		html+=  '<table border="0" cellpadding="0" cellspacing="0">';
		
		  html +='<tr>';
			html +='<td width="100%"  align="center">';
						if(this.config[num].prev==1){
							if(this.config[num].scrollableData == 1){
								ht='';
								ht =sre_menu.dataScrollArrows(num,'H',this.config[num].currsetting) ;
							   html +=ht;		
							}
						}
			
			
			html +='</td>';
		  html +='</tr>';
		  html +='<tr>';
			html +='<td width="100%"  align="center">';
		  
				html+=  '<table border="1" cellpadding="2" cellspacing="0">';

		if(this.config[num].suppressHeader ==0) {
			html+= '<tr><td>';
			html+=  '<table id="' + 'TestR' + '" border="0" cellpadding="2"  cellspacing="0" ><tr width='+GridWidth+'>';  
    				html+= '<td width="5" class="'+this.config[num].HeaderRow+'">&nbsp;</td>'; 
			
			//		for(b = 0; b < this.config[num].HeaderElement.length; b++){
			//sre_core.breakWords(this.config[num].HeaderElement[b],Words);
			//this.ColElements[b] = {

			
			for(c = 0; c < this.config[num].HeaderElement.length; c++){
				if(this.ColElements[c].Hidden !='Y') {
					var clsname='';
					if(this.config[num].currentCol != c)	{
						clsname = this.config[num].GridNoSelectedCls;
					} else {
						clsname = this.config[num].GridSelectedCls;
					}
					  tempField = '<td valign="bottom" class="'+clsname+'" width="'+this.ColElements[c].Width +'"' 
			  			  + ' col="' + c + '">' 
							  +	'<table width="'+this.ColElements[c].Width +'" height="100%" width="100%" border="0" cellspacing="0" cellpadding="0"><tr>' 
							  +	'<td width="'+this.ColElements[c].Width +'"  style="background-color:rgb(240,240,256)">' 
							  +  this.ColElements[c].Desc  
							  + '</td>'
							  + '<td style="width:8">&nbsp;&nbsp;</td>'
							  + '</tr></table>'
							  + '</td>';
						html += tempField;
				}
			}
			html += "</tr>";
		}
			var rowStyle;
			for(r = startR; r < startR + maxRow; r++){
				sre_core.breakWords(this.config[num].TreeElement[r],WordR);
				if(WordR !='undefined') {
	  			rowStyle = 'oddrow';
	  			if (r % 2 == 0)  { 
					rowStyle = this.config[num].evenRow;
				} else {
					rowStyle = this.config[num].oddRow; 
				}
				html += "<tr" + " class='" + rowStyle + "'" + ">";
					if(r == this.config[num].currentRow)	{
						html+= '<td width="5" class="'+this.config[num].HeaderRowSel+'">&nbsp;</td>';
							cellStyle = this.config[num].selrowCls;
					} else {
						html+= '<td width="5" class="'+this.config[num].HeaderRow+'">&nbsp;</td>';
						cellStyle = "Text";
					}
				for(c = 0; c < this.config[num].HeaderElement.length; c++) {
					if(c == this.config[num].currentCol)	{
						colStyle = this.config[num].selColCls;
					} 
					if(this.ColElements[c].Hidden !='Y') {
						if( c != colSelected) 	{
							html += '<td  style="background-color:rgb(240,240,256)" width="'+this.ColElements[c].Width +'"';
							html += ' onclick="' + 'sre_grid.SelectionRow(' 
	  						+ r + ','+ c + ',\'' + cont +'\',\''+num+'\')"'; 
							html += ' class="' + cellStyle + '"';
							html += '>' + WordR[c] +'<nobr>&nbsp;</nobr>';
							html += '</td>';
						}	else	{	
							if( r == rwSelected)	{
							
						//	if (this.ColElements[c].Assist !='Y')	{
								if (this.ColElements[c].Edit !='Y')	{
									html += '<td  style="background-color:rgb(240,240,256)" width="'+this.ColElements[c].Width +'"';
									html += ' onclick="' + 'sre_grid.SelectionRow(' 
	  								+ r + ','+ c + ',\'' + cont +'\',\''+num+'\')"'; 
									html += ' class="' + cellStyle + '"';
									html += '>' + WordR[c] +'<nobr>&nbsp;</nobr>';
									html += '</td>';

								} else {
									thtml='';
									thtml += '<td id="idabc" nowrap>' 
									thtml += '<input id="currtxt" type="text" name="currCell" value="'
									+ WordR[c]	+'" onBlur="' + 'sre_grid.EditCell(' 
	  			    			+ r + ','+ c + ',\'' + cont +'\',\''+num+'\',this.value )">';
									thtml += '</td>';
									html += thtml;
								}
						//	}
						//	else //Visual assist
						//	{
						//		var len = (Words[c].length) * 6;
						//		html += '<td><table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td align="left">'; 
						//		html += '<input align="left" style="font-family:Arial,sans-serif;  font-weight:normal;background-color:' + bkclr + ';width:'+len+ ';height:10;border-height:0;border-width:0; text-align:top" type="text" name="currCell" value="'
						//		+ WordR[c]
						//		+'" ></td><td align="right">';
						//		html +='<img src="ok.gif" border="2" align="right" style="background-color:' + bkclr + ';width:12;height:12; border-height:1;border-width:1;border-left:1 solid white;border-top:0 solid white,border-right:2 solid gray;border-bottom:1 solid gray"'
						//		+'onClick="Msg(' + r;
						//		html += "+ '";
						//		html += '--';
						//		html += "' +";
						//		html += c;
						//		html += ')";'
						//		+'>';
						//			 
						//		html += '</td></tr></table></td>';
						//	}

						}	else {
							html += '<td  width="'+this.ColElements[c].Width +'"';
 							html += ' onclick="' + 'sre_grid.SelectionRow(' 
	  			    			+ r + ','+ c + ',\'' + cont +'\',\''+num+'\')"'; 
							html += ' class="' + colStyle
							html += '">';
							html += WordR[c]
								+'<nobr>&nbsp;</nobr>';
							html += '</td>';
						}
					}
	  			}	
			}
			}
	  		html += "</tr>"; 
		  } // end of row loop
		html += '</table>';
		html += '</td>';
/*		
		html += '<td height="100%">';
		html += '<table border="0" height="100%">';
		html += '<tr height ="10" >';
		html += '<td style="cursor:pointer">';
		html += '<img src="../../../EN/SRESYS/Pic/Previous.gif" border="0" valign="top" style="width:12;height:12;"';
		html += 'onclick="sre_grid.MovePos('+ -1+',\''+ cont+'\',\''+num+'\')"></img>';
		html += '</td>';
		html += '</tr>';
		html += '<tr height="100%">';
		html += '<td class="scroll" height="100%" align="center">';
		html += ' <img src="/EN/SRESYS/Pic/grip.png" width="8" height="100%"></img>';
		html += '</td>';
		html += '</tr>';
		html += '<tr  height ="10" >';
		html += '<td style="cursor:pointer">';
		html += '<img src="../../../EN/SRESYS/Pic/Next.gif" border="0" valign="top" style="width:12;height:12;"';
		html += 'onclick="sre_grid.MovePos('+ 1+',\''+ cont+'\',\''+num+'\')"></img>';
		html += '</td>';
		html += '</tr>';
		html += '</table>';
		html += '</td>';
*/		
		html += '</tr>';
		  html +='<tr>';
			html +='<td width="100%" align="center">ujtyutyut';
					if(this.config[num].nxt==1){
						if(this.config[num].scrollableData == 1){
							ht='';
							ht =sre_menu.dataScrollArrows(num,'F',this.config[num].currsetting) ;
						   html +=ht;		
						}
					}
			
			html +='</td>';
		  html +='</tr>';
		
		html += '</table>';
			if(this.config[num].GridType == 'L' ) {
			  html +='</td></tr></table>';	
			  html +='<div>';
			}

		v.innerHTML = html;
	},
	dropDown: function (num){
		//[sremenulist.length]=n;
		for(x=0;x < sremenulist.length; x++ ){
			//this.refresh(sremenulist[x]);
			var oth = "hpdrop" + sremenulist[x];
			ot = document.getElementById(oth);
			if(ot) {ot.innerHTML = '';} //
		}
		var drp = "hpdrop" + num;
		v = document.getElementById(drp);
		if(this.config[num].dropStatus == 0) {
		//alert("menuname : "+ this.config[num].MenuId);
			this.display(drp,this.config[num].GridId,this.config[num]);
			this.config[num].GridType = 'H';
			this.config[num].GridId = num;
			this.config[num].dropStatus = 1 ;
		} else {
			v.innerHTML = '';
			this.config[num].dropStatus = 0 ;
		}
	},
	drawHyper: function (cont,num){
		var html='';var status = 0; var Words = new Array();
		vv = document.getElementById(cont);
		html += '<table border="0" width="'+this.config[num].GridWidth+'" cellpadding="0" cellspacing="0" style="background-color:'+this.config[num].BackColor+';">';
		html += '<tr>';
		html += '<td class="'+this.config[num].hyperDisplayCls+'" onclick="sre_grid.dropDown(\''+num+'\')" width="100%" style="cursor:pointer;background-color:#ffffff"  >';
			html += '<span id="hpdisplay'+num+'"    >&nbsp;';
			html += this.config[num].hyperDisplay;
			html += '</span>';
		html += '</td>';
		html += '<td valign="bottom" style="cursor:pointer;padding-left:0; padding-right:0;height:15px;" >';
		html += '<img style="height:15px;" border="0" src="'+this.config[num].hyperDropDownPic+'" onclick="sre_grid.dropDown(\''+num+'\')" class="menureg"></img>';
		html += '</td>';
		html += '</tr>';
		html += '<tr>';
		html += '<td colspan="2">';
		if(sre_core.isMSIE() ){
			html += '<div id="hpdrop'+num+'" style="position:absolute;z-index:100;filter:progid:DXImageTransform.Microsoft.Alpha(opacity='+this.config[num].hyperOpacity+');" class="menureg"></div>';
		} else {
			html += '<div id="hpdrop'+num+'" style="position:absolute;z-index:100;opacity:'+parseInt(this.config[num].hyperOpacity)/100+';" class="menureg"></div>';
		}
		//alert(this.config[num].hyperOpacity);
		html += '</td>';
		html += '</tr>';
		html += '</table>';
		//alert(html);
		if(vv) {
			vv.innerHTML = html;
		}
	},	
	render: function(divid,html) {	
		v = document.getElementById(divid);
		v.innerHTML = html;
	},
	cancelDiv: function (cont,num) {
		pagename = this.config[num].PageName;
		str ="";
		str += '_MenuCancel("';
		str += num;
		str += '")';
		eval( this.config[num].PageName + str);
	},
	displayHyper: function(divid,id,settings) {	
		this.setSettings(id, settings);
		this.config[id].GridId = id;
		this.config[id].GridType = 'H';
		this.config[id].DivId = divid;	
		this.config[id].dropStatus = 0;
		this.drawHyper(divid,id);
		
	},
	displayLookup: function(divid,id,settings,top,left) {	
		this.setSettings(id, settings);
		this.config[id].GridId = id;
		this.config[id].GridType = 'L';
		this.config[id].DivId = divid;	
		dv = document.getElementById(divid);
		dv.style.position ='absolute';
		ly = parseInt(this.config[id].Layer) + 1;
		dv.style.zIndex =ly;
		dv.style.top = top;
		this.config[id].Top = top;
		dv.style.left = left;
		this.config[id].Left = left;
		this.drawGrid(divid,id);

	},
	display: function(divid,id,settings) {	
		this.setSettings(id, settings);
		this.config[id].GridId = id;
		this.config[id].GridType = 'N';
		this.config[id].DivId = divid;	
		this.drawGrid(divid,id);
	}
};
/* -----------------------END(sre_grid)---------------------------------- */
/* ---------------------Begin(sre_color)---------------------------------- *\
 * eMiliue v1.0 Copyright (c) 2010 Sreejon LLC 
 * Contact us at sreejon2006@msn.com
 * This copyright notice MUST stay intact for use.
 *
 * $Revision: 1.0 $

Dependency :	[Meant to work with Sreejon message structure ]
				None

Description :	All core color routines 
Usage:

\* ---------------------------------------------------------------------- */

var sre_color = {
	Settings: function() {
		this.ColorId = '';
		this.ColorType = 'N';
		this.DivId = '';	
		this.Top=0;
		this.Left=0;
		this.Layer=5;
		this.PageName='';
		this.ColorWidth='210';

	},
config: new Array(),
setSettings: function(n, settings) {

	if(typeof(settings) != "object") {
		this.config[n] = new this.Settings();
	}
	else {
		this.config[n] = settings;
	}
},
previewColor: function (color) {
	document.getElementById('sre_color.previewColor').style.backgroundColor = color;

},
selectColor: function (num,color) {
	if(!this.config[num].PageName) {this.config[num].PageName = SRESelectedPage; }
	pagename = this.config[num].PageName;

	var str ="";
	str += '_ColorPick("';
	str += num;
	str += '","';
	str += color;
	str += '")';
	eval( pagename + str);

	if(this.config[num].ColorType =='L') {
		dv = document.getElementById(this.config[num].DivId);
		dv.innerHTML='';
	}
	return color;
},	
render: function(divid,html) {	
		v = document.getElementById(divid);
		v.innerHTML = html;
},
displayLookup: function(divid,id,settings,top,left) {	
	this.setSettings(id, settings);
	this.config[id].ColorId = id;
	this.config[id].ColorType = 'L';
	this.config[id].DivId = divid;	
	dv = document.getElementById(divid);
	dv.style.position ='absolute';
	ly = parseInt(this.config[id].Layer) + 1;
	dv.style.zIndex =ly;
	dv.style.top = top;
	this.config[id].Top = top;
	dv.style.left = left;
	this.config[id].Left = left;
	this.showColor(id,divid);
},
	cancelDiv: function (cont,num) {
		pagename = this.config[num].PageName;
		str ="";
		str += '_MenuCancel("';
		str += num;
		str += '")';
		eval( this.config[num].PageName + str);
	},

display: function(divid,id,settings) {	
	this.setSettings(id, settings);
	this.config[id].ColorId = id;
	this.config[id].ColorType = 'N';
	this.showColor(id,divid);
},
showColor: function (num,cont) {

  colhtml='';
  v = document.getElementById(cont);
			if(this.config[num].ColorType == 'L' ) {
			  colhtml +='<div id="sre_pop_div" style="background-color:rgb(240,240,256)">';
			  colhtml +='<table border="0" cellpadding="0" cellspacing="0" style="border-top:0px transparent; border-left:0px transparent;border-bottom:1px solid gray; border-right:1px solid gray;">';
			  colhtml +='<tr><td align="right" height="15" style="background-color:rgb(200,200,226)">';
			  	   
    		  colhtml+='<img border="0" style="cursor:pointer;background-color:transparent" src="/EN/SRESYS/Pic/closesm.png" height="20" onclick="cancelDiv(\''+this.config[num].DivId+'\')"></img>';
			  colhtml +='</td></tr><tr><td>';	
			}
  colhtml +='<table border=0 cellspacing=1 cellpadding=0 style="cursor:pointer;background-color:rgb(240,240,256)" >';
  colhtml +='<tr>';
  colhtml +='<td valign=center><div style="background-color:rgb(240,240,256);padding:1;height:21px;width:50px"><div id="sre_color.previewColor" style="height:100%; width:100%"></div></td>';
  colhtml +='<td>';
  colhtml +='</tr>';
  colhtml +='<tr>';
  colhtml +='<td background-color:rgb(240,240,256);"></td>';
  colhtml +='<td bgcolor="#000000" onMouseOver="sre_color.previewColor(\'#000000\')" onClick="sre_color.selectColor(\''+num+'\',\'#000000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000000" onMouseOver="sre_color.previewColor(\'#000000\')" onClick="sre_color.selectColor(\''+num+'\',\'#000000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000000" onMouseOver="sre_color.previewColor(\'#000000\')" onClick="sre_color.selectColor(\''+num+'\',\'#000000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#003300" onMouseOver="sre_color.previewColor(\'#003300\')" onClick="sre_color.selectColor(\''+num+'\',\'#003300\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#006600" onMouseOver="sre_color.previewColor(\'#006600\')" onClick="sre_color.selectColor(\''+num+'\',\'#006600\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#009900" onMouseOver="sre_color.previewColor(\'#009900\')" onClick="sre_color.selectColor(\''+num+'\',\'#009900\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#00CC00" onMouseOver="sre_color.previewColor(\'#00CC00\')" onClick="sre_color.selectColor(\''+num+'\',\'#00CC00\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#00FF00" onMouseOver="sre_color.previewColor(\'#00FF00\')" onClick="sre_color.selectColor(\''+num+'\',\'#00FF00\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#330000" onMouseOver="sre_color.previewColor(\'#330000\')" onClick="sre_color.selectColor(\''+num+'\',\'#330000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#333300" onMouseOver="sre_color.previewColor(\'#333300\')" onClick="sre_color.selectColor(\''+num+'\',\'#333300\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#336600" onMouseOver="sre_color.previewColor(\'#336600\')" onClick="sre_color.selectColor(\''+num+'\',\'#336600\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#339900" onMouseOver="sre_color.previewColor(\'#339900\')" onClick="sre_color.selectColor(\''+num+'\',\'#339900\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#33CC00" onMouseOver="sre_color.previewColor(\'#33CC00\')" onClick="sre_color.selectColor(\''+num+'\',\'#33CC00\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#33FF00" onMouseOver="sre_color.previewColor(\'#33FF00\')" onClick="sre_color.selectColor(\''+num+'\',\'#33FF00\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#660000" onMouseOver="sre_color.previewColor(\'#660000\')" onClick="sre_color.selectColor(\''+num+'\',\'#660000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#663300" onMouseOver="sre_color.previewColor(\'#663300\')" onClick="sre_color.selectColor(\''+num+'\',\'#663300\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#666600" onMouseOver="sre_color.previewColor(\'#666600\')" onClick="sre_color.selectColor(\''+num+'\',\'#666600\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#669900" onMouseOver="sre_color.previewColor(\'#669900\')" onClick="sre_color.selectColor(\''+num+'\',\'#669900\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#66CC00" onMouseOver="sre_color.previewColor(\'#66CC00\')" onClick="sre_color.selectColor(\''+num+'\',\'#66CC00\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#66FF00" onMouseOver="sre_color.previewColor(\'#66FF00\')" onClick="sre_color.selectColor(\''+num+'\',\'#66FF00\')" height="10" width="10"></td>';
colhtml +=' </tr>';
 colhtml +='<tr>';
  colhtml +='<td background-color:rgb(240,240,256);"></td>';
  colhtml +='<td bgcolor="#333333" onMouseOver="sre_color.previewColor(\'#333333\')" onClick="sre_color.selectColor(\''+num+'\',\'#333333\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000000" onMouseOver="sre_color.previewColor(\'#000000\')" onClick="sre_color.selectColor(\''+num+'\',\'#000000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000033" onMouseOver="sre_color.previewColor(\'#000033\')" onClick="sre_color.selectColor(\''+num+'\',\'#000033\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#003333" onMouseOver="sre_color.previewColor(\'#003333\')" onClick="sre_color.selectColor(\''+num+'\',\'#003333\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#006633" onMouseOver="sre_color.previewColor(\'#006633\')" onClick="sre_color.selectColor(\''+num+'\',\'#006633\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#009933" onMouseOver="sre_color.previewColor(\'#009933\')" onClick="sre_color.selectColor(\''+num+'\',\'#009933\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#00CC33" onMouseOver="sre_color.previewColor(\'#00CC33\')" onClick="sre_color.selectColor(\''+num+'\',\'#00CC33\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#00FF33" onMouseOver="sre_color.previewColor(\'#00FF33\')" onClick="sre_color.selectColor(\''+num+'\',\'#00FF33\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#330033" onMouseOver="sre_color.previewColor(\'#330033\')" onClick="sre_color.selectColor(\''+num+'\',\'#330033\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#333333" onMouseOver="sre_color.previewColor(\'#333333\')" onClick="sre_color.selectColor(\''+num+'\',\'#333333\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#336633" onMouseOver="sre_color.previewColor(\'#336633\')" onClick="sre_color.selectColor(\''+num+'\',\'#336633\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#339933" onMouseOver="sre_color.previewColor(\'#339933\')" onClick="sre_color.selectColor(\''+num+'\',\'#339933\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#33CC33" onMouseOver="sre_color.previewColor(\'#33CC33\')" onClick="sre_color.selectColor(\''+num+'\',\'#33CC33\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#33FF33" onMouseOver="sre_color.previewColor(\'#33FF33\')" onClick="sre_color.selectColor(\''+num+'\',\'#33FF33\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#660033" onMouseOver="sre_color.previewColor(\'#660033\')" onClick="sre_color.selectColor(\''+num+'\',\'#660033\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#663333" onMouseOver="sre_color.previewColor(\'#663333\')" onClick="sre_color.selectColor(\''+num+'\',\'#663333\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#666633" onMouseOver="sre_color.previewColor(\'#666633\')" onClick="sre_color.selectColor(\''+num+'\',\'#666633\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#669933" onMouseOver="sre_color.previewColor(\'#669933\')" onClick="sre_color.selectColor(\''+num+'\',\'#669933\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#66CC33" onMouseOver="sre_color.previewColor(\'#66CC33\')" onClick="sre_color.selectColor(\''+num+'\',\'#66CC33\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#66FF33" onMouseOver="sre_color.previewColor(\'#66FF33\')" onClick="sre_color.selectColor(\''+num+'\',\'#66FF33\')" height="10" width="10"></td>';
colhtml +=' </tr>';
 colhtml +='<tr>';
  colhtml +='<td background-color:rgb(240,240,256);"></td>';
  colhtml +='<td bgcolor="#666666" onMouseOver="sre_color.previewColor(\'#666666\')" onClick="sre_color.selectColor(\''+num+'\',\'#666666\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000000" onMouseOver="sre_color.previewColor(\'#000000\')" onClick="sre_color.selectColor(\''+num+'\',\'#000000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000066" onMouseOver="sre_color.previewColor(\'#000066\')" onClick="sre_color.selectColor(\''+num+'\',\'#000066\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#003366" onMouseOver="sre_color.previewColor(\'#003366\')" onClick="sre_color.selectColor(\''+num+'\',\'#003366\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#006666" onMouseOver="sre_color.previewColor(\'#006666\')" onClick="sre_color.selectColor(\''+num+'\',\'#006666\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#009966" onMouseOver="sre_color.previewColor(\'#009966\')" onClick="sre_color.selectColor(\''+num+'\',\'#009966\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#00CC66" onMouseOver="sre_color.previewColor(\'#00CC66\')" onClick="sre_color.selectColor(\''+num+'\',\'#00CC66\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#00FF66" onMouseOver="sre_color.previewColor(\'#00FF66\')" onClick="sre_color.selectColor(\''+num+'\',\'#00FF66\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#330066" onMouseOver="sre_color.previewColor(\'#330066\')" onClick="sre_color.selectColor(\''+num+'\',\'#330066\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#333366" onMouseOver="sre_color.previewColor(\'#333366\')" onClick="sre_color.selectColor(\''+num+'\',\'#333366\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#336666" onMouseOver="sre_color.previewColor(\'#336666\')" onClick="sre_color.selectColor(\''+num+'\',\'#336666\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#339966" onMouseOver="sre_color.previewColor(\'#339966\')" onClick="sre_color.selectColor(\''+num+'\',\'#339966\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#33CC66" onMouseOver="sre_color.previewColor(\'#33CC66\')" onClick="sre_color.selectColor(\''+num+'\',\'#33CC66\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#33FF66" onMouseOver="sre_color.previewColor(\'#33FF66\')" onClick="sre_color.selectColor(\''+num+'\',\'#33FF66\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#660066" onMouseOver="sre_color.previewColor(\'#660066\')" onClick="sre_color.selectColor(\''+num+'\',\'#660066\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#663366" onMouseOver="sre_color.previewColor(\'#663366\')" onClick="sre_color.selectColor(\''+num+'\',\'#663366\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#666666" onMouseOver="sre_color.previewColor(\'#666666\')" onClick="sre_color.selectColor(\''+num+'\',\'#666666\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#669966" onMouseOver="sre_color.previewColor(\'#669966\')" onClick="sre_color.selectColor(\''+num+'\',\'#669966\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#66CC66" onMouseOver="sre_color.previewColor(\'#66CC66\')" onClick="sre_color.selectColor(\''+num+'\',\'#66CC66\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#66FF66" onMouseOver="sre_color.previewColor(\'#66FF66\')" onClick="sre_color.selectColor(\''+num+'\',\'#66FF66\')" height="10" width="10"></td>';
colhtml +=' </tr>';
 colhtml +='<tr>';
  colhtml +='<td background-color:rgb(240,240,256);"></td>';
  colhtml +='<td bgcolor="#999999" onMouseOver="sre_color.previewColor(\'#999999\')" onClick="sre_color.selectColor(\''+num+'\',\'#999999\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000000" onMouseOver="sre_color.previewColor(\'#000000\')" onClick="sre_color.selectColor(\''+num+'\',\'#000000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000099" onMouseOver="sre_color.previewColor(\'#000099\')" onClick="sre_color.selectColor(\''+num+'\',\'#000099\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#003399" onMouseOver="sre_color.previewColor(\'#003399\')" onClick="sre_color.selectColor(\''+num+'\',\'#003399\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#006699" onMouseOver="sre_color.previewColor(\'#006699\')" onClick="sre_color.selectColor(\''+num+'\',\'#006699\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#009999" onMouseOver="sre_color.previewColor(\'#009999\')" onClick="sre_color.selectColor(\''+num+'\',\'#009999\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#00CC99" onMouseOver="sre_color.previewColor(\'#00CC99\')" onClick="sre_color.selectColor(\''+num+'\',\'#00CC99\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#00FF99" onMouseOver="sre_color.previewColor(\'#00FF99\')" onClick="sre_color.selectColor(\''+num+'\',\'#00FF99\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#330099" onMouseOver="sre_color.previewColor(\'#330099\')" onClick="sre_color.selectColor(\''+num+'\',\'#330099\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#333399" onMouseOver="sre_color.previewColor(\'#333399\')" onClick="sre_color.selectColor(\''+num+'\',\'#333399\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#336699" onMouseOver="sre_color.previewColor(\'#336699\')" onClick="sre_color.selectColor(\''+num+'\',\'#336699\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#339999" onMouseOver="sre_color.previewColor(\'#339999\')" onClick="sre_color.selectColor(\''+num+'\',\'#339999\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#33CC99" onMouseOver="sre_color.previewColor(\'#33CC99\')" onClick="sre_color.selectColor(\''+num+'\',\'#33CC99\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#33FF99" onMouseOver="sre_color.previewColor(\'#33FF99\')" onClick="sre_color.selectColor(\''+num+'\',\'#33FF99\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#660099" onMouseOver="sre_color.previewColor(\'#660099\')" onClick="sre_color.selectColor(\''+num+'\',\'#660099\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#663399" onMouseOver="sre_color.previewColor(\'#663399\')" onClick="sre_color.selectColor(\''+num+'\',\'#663399\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#666699" onMouseOver="sre_color.previewColor(\'#666699\')" onClick="sre_color.selectColor(\''+num+'\',\'#666699\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#669999" onMouseOver="sre_color.previewColor(\'#669999\')" onClick="sre_color.selectColor(\''+num+'\',\'#669999\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#66CC99" onMouseOver="sre_color.previewColor(\'#66CC99\')" onClick="sre_color.selectColor(\''+num+'\',\'#66CC99\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#66FF99" onMouseOver="sre_color.previewColor(\'#66FF99\')" onClick="sre_color.selectColor(\''+num+'\',\'#66FF99\')" height="10" width="10"></td>';
colhtml +=' </tr>';
 colhtml +='<tr>';
  colhtml +='<td background-color:rgb(240,240,256);"></td>';
  colhtml +='<td bgcolor="#CCCCCC" onMouseOver="sre_color.previewColor(\'#CCCCCC\')" onClick="sre_color.selectColor(\''+num+'\',\'#CCCCCC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000000" onMouseOver="sre_color.previewColor(\'#000000\')" onClick="sre_color.selectColor(\''+num+'\',\'#000000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#0000CC" onMouseOver="sre_color.previewColor(\'#0000CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#0000CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#0033CC" onMouseOver="sre_color.previewColor(\'#0033CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#0033CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#0066CC" onMouseOver="sre_color.previewColor(\'#0066CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#0066CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#0099CC" onMouseOver="sre_color.previewColor(\'#0099CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#0099CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#00CCCC" onMouseOver="sre_color.previewColor(\'#00CCCC\')" onClick="sre_color.selectColor(\''+num+'\',\'#00CCCC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#00FFCC" onMouseOver="sre_color.previewColor(\'#00FFCC\')" onClick="sre_color.selectColor(\''+num+'\',\'#00FFCC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#3300CC" onMouseOver="sre_color.previewColor(\'#3300CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#3300CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#3333CC" onMouseOver="sre_color.previewColor(\'#3333CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#3333CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#3366CC" onMouseOver="sre_color.previewColor(\'#3366CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#3366CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#3399CC" onMouseOver="sre_color.previewColor(\'#3399CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#3399CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#33CCCC" onMouseOver="sre_color.previewColor(\'#33CCCC\')" onClick="sre_color.selectColor(\''+num+'\',\'#33CCCC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#33FFCC" onMouseOver="sre_color.previewColor(\'#33FFCC\')" onClick="sre_color.selectColor(\''+num+'\',\'#33FFCC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#6600CC" onMouseOver="sre_color.previewColor(\'#6600CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#6600CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#6633CC" onMouseOver="sre_color.previewColor(\'#6633CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#6633CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#6666CC" onMouseOver="sre_color.previewColor(\'#6666CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#6666CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#6699CC" onMouseOver="sre_color.previewColor(\'#6699CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#6699CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#66CCCC" onMouseOver="sre_color.previewColor(\'#66CCCC\')" onClick="sre_color.selectColor(\''+num+'\',\'#66CCCC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#66FFCC" onMouseOver="sre_color.previewColor(\'#66FFCC\')" onClick="sre_color.selectColor(\''+num+'\',\'#66FFCC\')" height="10" width="10"></td>';
colhtml +=' </tr>';
 colhtml +='<tr>';
  colhtml +='<td background-color:rgb(240,240,256);"></td>';
  colhtml +='<td bgcolor="#FFFFFF" onMouseOver="sre_color.previewColor(\'#FFFFFF\')" onClick="sre_color.selectColor(\''+num+'\',\'#FFFFFF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000000" onMouseOver="sre_color.previewColor(\'#000000\')" onClick="sre_color.selectColor(\''+num+'\',\'#000000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#0000FF" onMouseOver="sre_color.previewColor(\'#0000FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#0000FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#0033FF" onMouseOver="sre_color.previewColor(\'#0033FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#0033FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#0066FF" onMouseOver="sre_color.previewColor(\'#0066FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#0066FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#0099FF" onMouseOver="sre_color.previewColor(\'#0099FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#0099FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#00CCFF" onMouseOver="sre_color.previewColor(\'#00CCFF\')" onClick="sre_color.selectColor(\''+num+'\',\'#00CCFF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#00FFFF" onMouseOver="sre_color.previewColor(\'#00FFFF\')" onClick="sre_color.selectColor(\''+num+'\',\'#00FFFF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#3300FF" onMouseOver="sre_color.previewColor(\'#3300FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#3300FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#3333FF" onMouseOver="sre_color.previewColor(\'#3333FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#3333FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#3366FF" onMouseOver="sre_color.previewColor(\'#3366FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#3366FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#3399FF" onMouseOver="sre_color.previewColor(\'#3399FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#3399FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#33CCFF" onMouseOver="sre_color.previewColor(\'#33CCFF\')" onClick="sre_color.selectColor(\''+num+'\',\'#33CCFF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#33FFFF" onMouseOver="sre_color.previewColor(\'#33FFFF\')" onClick="sre_color.selectColor(\''+num+'\',\'#33FFFF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#6600FF" onMouseOver="sre_color.previewColor(\'#6600FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#6600FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#6633FF" onMouseOver="sre_color.previewColor(\'#6633FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#6633FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#6666FF" onMouseOver="sre_color.previewColor(\'#6666FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#6666FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#6699FF" onMouseOver="sre_color.previewColor(\'#6699FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#6699FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#66CCFF" onMouseOver="sre_color.previewColor(\'#66CCFF\')" onClick="sre_color.selectColor(\''+num+'\',\'#66CCFF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#66FFFF" onMouseOver="sre_color.previewColor(\'#66FFFF\')" onClick="sre_color.selectColor(\''+num+'\',\'#66FFFF\')" height="10" width="10"></td>';
colhtml +=' </tr>';
 colhtml +='<tr>';
  colhtml +='<td background-color:rgb(240,240,256);"></td>';
  colhtml +='<td bgcolor="#FF0000" onMouseOver="sre_color.previewColor(\'#FF0000\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF0000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000000" onMouseOver="sre_color.previewColor(\'#000000\')" onClick="sre_color.selectColor(\''+num+'\',\'#000000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#990000" onMouseOver="sre_color.previewColor(\'#990000\')" onClick="sre_color.selectColor(\''+num+'\',\'#990000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#993300" onMouseOver="sre_color.previewColor(\'#993300\')" onClick="sre_color.selectColor(\''+num+'\',\'#993300\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#996600" onMouseOver="sre_color.previewColor(\'#996600\')" onClick="sre_color.selectColor(\''+num+'\',\'#996600\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#999900" onMouseOver="sre_color.previewColor(\'#999900\')" onClick="sre_color.selectColor(\''+num+'\',\'#999900\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#99CC00" onMouseOver="sre_color.previewColor(\'#99CC00\')" onClick="sre_color.selectColor(\''+num+'\',\'#99CC00\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#99FF00" onMouseOver="sre_color.previewColor(\'#99FF00\')" onClick="sre_color.selectColor(\''+num+'\',\'#99FF00\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC0000" onMouseOver="sre_color.previewColor(\'#CC0000\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC0000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC3300" onMouseOver="sre_color.previewColor(\'#CC3300\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC3300\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC6600" onMouseOver="sre_color.previewColor(\'#CC6600\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC6600\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC9900" onMouseOver="sre_color.previewColor(\'#CC9900\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC9900\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CCCC00" onMouseOver="sre_color.previewColor(\'#CCCC00\')" onClick="sre_color.selectColor(\''+num+'\',\'#CCCC00\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CCFF00" onMouseOver="sre_color.previewColor(\'#CCFF00\')" onClick="sre_color.selectColor(\''+num+'\',\'#CCFF00\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF0000" onMouseOver="sre_color.previewColor(\'#FF0000\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF0000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF3300" onMouseOver="sre_color.previewColor(\'#FF3300\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF3300\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF6600" onMouseOver="sre_color.previewColor(\'#FF6600\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF6600\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF9900" onMouseOver="sre_color.previewColor(\'#FF9900\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF9900\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FFCC00" onMouseOver="sre_color.previewColor(\'#FFCC00\')" onClick="sre_color.selectColor(\''+num+'\',\'#FFCC00\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FFFF00" onMouseOver="sre_color.previewColor(\'#FFFF00\')" onClick="sre_color.selectColor(\''+num+'\',\'#FFFF00\')" height="10" width="10"></td>';
colhtml +=' </tr>';
 colhtml +='<tr>';
  colhtml +='<td background-color:rgb(240,240,256);"></td>';
  colhtml +='<td bgcolor="#00FF00" onMouseOver="sre_color.previewColor(\'#00FF00\')" onClick="sre_color.selectColor(\''+num+'\',\'#00FF00\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000000" onMouseOver="sre_color.previewColor(\'#000000\')" onClick="sre_color.selectColor(\''+num+'\',\'#000000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#990033" onMouseOver="sre_color.previewColor(\'#990033\')" onClick="sre_color.selectColor(\''+num+'\',\'#990033\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#993333" onMouseOver="sre_color.previewColor(\'#993333\')" onClick="sre_color.selectColor(\''+num+'\',\'#993333\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#996633" onMouseOver="sre_color.previewColor(\'#996633\')" onClick="sre_color.selectColor(\''+num+'\',\'#996633\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#999933" onMouseOver="sre_color.previewColor(\'#999933\')" onClick="sre_color.selectColor(\''+num+'\',\'#999933\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#99CC33" onMouseOver="sre_color.previewColor(\'#99CC33\')" onClick="sre_color.selectColor(\''+num+'\',\'#99CC33\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#99FF33" onMouseOver="sre_color.previewColor(\'#99FF33\')" onClick="sre_color.selectColor(\''+num+'\',\'#99FF33\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC0033" onMouseOver="sre_color.previewColor(\'#CC0033\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC0033\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC3333" onMouseOver="sre_color.previewColor(\'#CC3333\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC3333\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC6633" onMouseOver="sre_color.previewColor(\'#CC6633\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC6633\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC9933" onMouseOver="sre_color.previewColor(\'#CC9933\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC9933\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CCCC33" onMouseOver="sre_color.previewColor(\'#CCCC33\')" onClick="sre_color.selectColor(\''+num+'\',\'#CCCC33\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CCFF33" onMouseOver="sre_color.previewColor(\'#CCFF33\')" onClick="sre_color.selectColor(\''+num+'\',\'#CCFF33\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF0033" onMouseOver="sre_color.previewColor(\'#FF0033\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF0033\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF3333" onMouseOver="sre_color.previewColor(\'#FF3333\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF3333\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF6633" onMouseOver="sre_color.previewColor(\'#FF6633\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF6633\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF9933" onMouseOver="sre_color.previewColor(\'#FF9933\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF9933\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FFCC33" onMouseOver="sre_color.previewColor(\'#FFCC33\')" onClick="sre_color.selectColor(\''+num+'\',\'#FFCC33\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FFFF33" onMouseOver="sre_color.previewColor(\'#FFFF33\')" onClick="sre_color.selectColor(\''+num+'\',\'#FFFF33\')" height="10" width="10"></td>';
colhtml +=' </tr>';
 colhtml +='<tr>';
  colhtml +='<td background-color:rgb(240,240,256);"></td>';
  colhtml +='<td bgcolor="#0000FF" onMouseOver="sre_color.previewColor(\'#0000FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#0000FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000000" onMouseOver="sre_color.previewColor(\'#000000\')" onClick="sre_color.selectColor(\''+num+'\',\'#000000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#990066" onMouseOver="sre_color.previewColor(\'#990066\')" onClick="sre_color.selectColor(\''+num+'\',\'#990066\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#993366" onMouseOver="sre_color.previewColor(\'#993366\')" onClick="sre_color.selectColor(\''+num+'\',\'#993366\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#996666" onMouseOver="sre_color.previewColor(\'#996666\')" onClick="sre_color.selectColor(\''+num+'\',\'#996666\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#999966" onMouseOver="sre_color.previewColor(\'#999966\')" onClick="sre_color.selectColor(\''+num+'\',\'#999966\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#99CC66" onMouseOver="sre_color.previewColor(\'#99CC66\')" onClick="sre_color.selectColor(\''+num+'\',\'#99CC66\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#99FF66" onMouseOver="sre_color.previewColor(\'#99FF66\')" onClick="sre_color.selectColor(\''+num+'\',\'#99FF66\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC0066" onMouseOver="sre_color.previewColor(\'#CC0066\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC0066\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC3366" onMouseOver="sre_color.previewColor(\'#CC3366\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC3366\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC6666" onMouseOver="sre_color.previewColor(\'#CC6666\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC6666\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC9966" onMouseOver="sre_color.previewColor(\'#CC9966\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC9966\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CCCC66" onMouseOver="sre_color.previewColor(\'#CCCC66\')" onClick="sre_color.selectColor(\''+num+'\',\'#CCCC66\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CCFF66" onMouseOver="sre_color.previewColor(\'#CCFF66\')" onClick="sre_color.selectColor(\''+num+'\',\'#CCFF66\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF0066" onMouseOver="sre_color.previewColor(\'#FF0066\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF0066\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF3366" onMouseOver="sre_color.previewColor(\'#FF3366\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF3366\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF6666" onMouseOver="sre_color.previewColor(\'#FF6666\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF6666\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF9966" onMouseOver="sre_color.previewColor(\'#FF9966\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF9966\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FFCC66" onMouseOver="sre_color.previewColor(\'#FFCC66\')" onClick="sre_color.selectColor(\''+num+'\',\'#FFCC66\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FFFF66" onMouseOver="sre_color.previewColor(\'#FFFF66\')" onClick="sre_color.selectColor(\''+num+'\',\'#FFFF66\')" height="10" width="10"></td>';
colhtml +=' </tr>';
 colhtml +='<tr>';
  colhtml +='<td background-color:rgb(240,240,256);"></td>';
  colhtml +='<td bgcolor="#FFFF00" onMouseOver="sre_color.previewColor(\'#FFFF00\')" onClick="sre_color.selectColor(\''+num+'\',\'#FFFF00\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000000" onMouseOver="sre_color.previewColor(\'#000000\')" onClick="sre_color.selectColor(\''+num+'\',\'#000000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#990099" onMouseOver="sre_color.previewColor(\'#990099\')" onClick="sre_color.selectColor(\''+num+'\',\'#990099\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#993399" onMouseOver="sre_color.previewColor(\'#993399\')" onClick="sre_color.selectColor(\''+num+'\',\'#993399\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#996699" onMouseOver="sre_color.previewColor(\'#996699\')" onClick="sre_color.selectColor(\''+num+'\',\'#996699\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#999999" onMouseOver="sre_color.previewColor(\'#999999\')" onClick="sre_color.selectColor(\''+num+'\',\'#999999\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#99CC99" onMouseOver="sre_color.previewColor(\'#99CC99\')" onClick="sre_color.selectColor(\''+num+'\',\'#99CC99\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#99FF99" onMouseOver="sre_color.previewColor(\'#99FF99\')" onClick="sre_color.selectColor(\''+num+'\',\'#99FF99\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC0099" onMouseOver="sre_color.previewColor(\'#CC0099\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC0099\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC3399" onMouseOver="sre_color.previewColor(\'#CC3399\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC3399\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC6699" onMouseOver="sre_color.previewColor(\'#CC6699\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC6699\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC9999" onMouseOver="sre_color.previewColor(\'#CC9999\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC9999\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CCCC99" onMouseOver="sre_color.previewColor(\'#CCCC99\')" onClick="sre_color.selectColor(\''+num+'\',\'#CCCC99\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CCFF99" onMouseOver="sre_color.previewColor(\'#CCFF99\')" onClick="sre_color.selectColor(\''+num+'\',\'#CCFF99\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF0099" onMouseOver="sre_color.previewColor(\'#FF0099\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF0099\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF3399" onMouseOver="sre_color.previewColor(\'#FF3399\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF3399\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF6699" onMouseOver="sre_color.previewColor(\'#FF6699\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF6699\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF9999" onMouseOver="sre_color.previewColor(\'#FF9999\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF9999\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FFCC99" onMouseOver="sre_color.previewColor(\'#FFCC99\')" onClick="sre_color.selectColor(\''+num+'\',\'#FFCC99\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FFFF99" onMouseOver="sre_color.previewColor(\'#FFFF99\')" onClick="sre_color.selectColor(\''+num+'\',\'#FFFF99\')" height="10" width="10"></td>';
colhtml +=' </tr>';
 colhtml +='<tr>';
  colhtml +='<td background-color:rgb(240,240,256);"></td>';
  colhtml +='<td bgcolor="#00FFFF" onMouseOver="sre_color.previewColor(\'#00FFFF\')" onClick="sre_color.selectColor(\''+num+'\',\'#00FFFF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000000" onMouseOver="sre_color.previewColor(\'#000000\')" onClick="sre_color.selectColor(\''+num+'\',\'#000000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#9900CC" onMouseOver="sre_color.previewColor(\'#9900CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#9900CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#9933CC" onMouseOver="sre_color.previewColor(\'#9933CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#9933CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#9966CC" onMouseOver="sre_color.previewColor(\'#9966CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#9966CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#9999CC" onMouseOver="sre_color.previewColor(\'#9999CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#9999CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#99CCCC" onMouseOver="sre_color.previewColor(\'#99CCCC\')" onClick="sre_color.selectColor(\''+num+'\',\'#99CCCC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#99FFCC" onMouseOver="sre_color.previewColor(\'#99FFCC\')" onClick="sre_color.selectColor(\''+num+'\',\'#99FFCC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC00CC" onMouseOver="sre_color.previewColor(\'#CC00CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC00CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC33CC" onMouseOver="sre_color.previewColor(\'#CC33CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC33CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC66CC" onMouseOver="sre_color.previewColor(\'#CC66CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC66CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC99CC" onMouseOver="sre_color.previewColor(\'#CC99CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC99CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CCCCCC" onMouseOver="sre_color.previewColor(\'#CCCCCC\')" onClick="sre_color.selectColor(\''+num+'\',\'#CCCCCC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CCFFCC" onMouseOver="sre_color.previewColor(\'#CCFFCC\')" onClick="sre_color.selectColor(\''+num+'\',\'#CCFFCC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF00CC" onMouseOver="sre_color.previewColor(\'#FF00CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF00CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF33CC" onMouseOver="sre_color.previewColor(\'#FF33CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF33CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF66CC" onMouseOver="sre_color.previewColor(\'#FF66CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF66CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF99CC" onMouseOver="sre_color.previewColor(\'#FF99CC\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF99CC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FFCCCC" onMouseOver="sre_color.previewColor(\'#FFCCCC\')" onClick="sre_color.selectColor(\''+num+'\',\'#FFCCCC\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FFFFCC" onMouseOver="sre_color.previewColor(\'#FFFFCC\')" onClick="sre_color.selectColor(\''+num+'\',\'#FFFFCC\')" height="10" width="10"></td>';
colhtml +=' </tr>';
 colhtml +='<tr>';
  colhtml +='<td background-color:rgb(240,240,256);"></td>';
  colhtml +='<td bgcolor="#FF00FF" onMouseOver="sre_color.previewColor(\'#FF00FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF00FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#000000" onMouseOver="sre_color.previewColor(\'#000000\')" onClick="sre_color.selectColor(\''+num+'\',\'#000000\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#9900FF" onMouseOver="sre_color.previewColor(\'#9900FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#9900FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#9933FF" onMouseOver="sre_color.previewColor(\'#9933FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#9933FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#9966FF" onMouseOver="sre_color.previewColor(\'#9966FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#9966FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#9999FF" onMouseOver="sre_color.previewColor(\'#9999FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#9999FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#99CCFF" onMouseOver="sre_color.previewColor(\'#99CCFF\')" onClick="sre_color.selectColor(\''+num+'\',\'#99CCFF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#99FFFF" onMouseOver="sre_color.previewColor(\'#99FFFF\')" onClick="sre_color.selectColor(\''+num+'\',\'#99FFFF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC00FF" onMouseOver="sre_color.previewColor(\'#CC00FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC00FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC33FF" onMouseOver="sre_color.previewColor(\'#CC33FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC33FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC66FF" onMouseOver="sre_color.previewColor(\'#CC66FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC66FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CC99FF" onMouseOver="sre_color.previewColor(\'#CC99FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#CC99FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CCCCFF" onMouseOver="sre_color.previewColor(\'#CCCCFF\')" onClick="sre_color.selectColor(\''+num+'\',\'#CCCCFF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#CCFFFF" onMouseOver="sre_color.previewColor(\'#CCFFFF\')" onClick="sre_color.selectColor(\''+num+'\',\'#CCFFFF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF00FF" onMouseOver="sre_color.previewColor(\'#FF00FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF00FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF33FF" onMouseOver="sre_color.previewColor(\'#FF33FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF33FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF66FF" onMouseOver="sre_color.previewColor(\'#FF66FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF66FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FF99FF" onMouseOver="sre_color.previewColor(\'#FF99FF\')" onClick="sre_color.selectColor(\''+num+'\',\'#FF99FF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FFCCFF" onMouseOver="sre_color.previewColor(\'#FFCCFF\')" onClick="sre_color.selectColor(\''+num+'\',\'#FFCCFF\')" height="10" width="10"></td>';
  colhtml +='<td bgcolor="#FFFFFF" onMouseOver="sre_color.previewColor(\'#FFFFFF\')" onClick="sre_color.selectColor(\''+num+'\',\'#FFFFFF\')" height="10" width="10"></td>';
colhtml +=' </tr>';
colhtml +='</table>';
			if(this.config[num].ColorType == 'L' ) {
			  colhtml +='</td></tr></table>';	
			  colhtml +='<div>';
			}

	v.innerHTML = colhtml;

}

};

/* -----------------------END(sre_color)---------------------------------- */
/* ---------------------Begin(sre_menu_slider)---------------------------------- *\
\* ---------------------------------------------------------------------- */
var sre_menu_slider=function(){
	var m,e,g,s,q,i; e=[]; q=8; i=8;
	return{
		init:function(j,k){
			m=document.getElementById(j); e=m.getElementsByTagName('li');
			var i,l,w,p; i=0; l=e.length;
			for(i;i<l;i++){
				var c,v; c=e[i]; v=c.value; if(v==1){s=c; w=c.offsetWidth; p=c.offsetLeft}
				c.onmouseover=function(){sre_menu_slider.mo(this)}; c.onmouseout=function(){sre_menu_slider.mo(s)};
			}
			g=document.getElementById(k); g.style.width=w+'px'; g.style.left=p+'px';
		},
		mo:function(d){
			clearInterval(m.tm);
			var el,ew; el=parseInt(d.offsetLeft); ew=parseInt(d.offsetWidth);
			m.tm=setInterval(function(){sre_menu_slider.mv(el,ew)},i);
		},
		mv:function(el,ew){
			var l,w; l=parseInt(g.offsetLeft); w=parseInt(g.offsetWidth);
			if(l!=el||w!=ew){
				if(l!=el){var ld,lr,li; ld=(l>el)?-1:1; lr=Math.abs(el-l); li=(lr<q)?ld*lr:ld*q; g.style.left=(l+li)+'px'}
				if(w!=ew){var wd,wr,wi; wd=(w>ew)?-1:1; wr=Math.abs(ew-w); wi=(wr<q)?wd*wr:wd*q; g.style.width=(w+wi)+'px'}
			}else{clearInterval(m.tm)}
}};}();
/* -----------------------END(sre_menu_slider)---------------------------------- */
function sre_clientWidth() {
	return sre_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function sre_clientHeight() {
	return sre_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function sre_scrollLeft() {
	return sre_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function sre_scrollTop() {
	return sre_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function sre_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
/* ---------------------Begin(sre_popup)---------------------------------- *\
 * eMiliue v1.0 Copyright (c) 2010 Sreejon LLC 
 * Contact us at sreejon2006@msn.com
 * This copyright notice MUST stay intact for use.
 *
 * $Revision: 1.0 $

Dependency :	[Meant to work with Sreejon message structure ]
				No individual controls for popup must exist

Description :	All popup jects rountines needed for asynchronous calls 

Usage: Automatically called by the controls (with or without the dynaform)



<div id="area1" style="width:150px;height:300px;"></div>
----------
/FieldLabel|FieldType|Enable|VarName|Size(width)|Height|Mandatory|PickValue|Tab|Topic";
var DynDetail =  new Array();
DynDetail[0] = "Force value pick|TEXT|D|RegLookup|20|3|N|MENU_fullmenu|0| "; //MENU_[menu setting] in pickvalue (menu data must exist)
DynDetail[1] = "Date pick|TEXT|D|BirthDate|12|3|N|CLDR_fullcal|0| "; //CLDR_[Calendar setting] in pickvalue (calendar data may exist)
DynDetail[2] = "Pick from grid|TEXT|D|Who|12|3|N|GRID_fullgrid|0| "; ////GRID_[grid setting] in pickvalue (grid data and definition must exist)
DynDetail[2] = "Pick from grid|TEXT|D|Who|12|3|N|COLR_fullgrid|0| "; ////GRID_[grid setting] in pickvalue (grid data and definition must exist)

DynForm("area1");


Following events will be supported 
Normal menu calendar or grid event are supported,

\* ---------------------------------------------------------------------- */
function cancelDiv(dv,type){

//	if(dv='') {dv =  $('sre_popup_div');}
	$(dv).innerHTML="";
	if(type !=''){
		
		len = type.length ;
		typ = type.slice(0,4);
		rest = type.slice(5,len);

		if (typ == "CLDR" ){
			
			sre_calendar.cancelDiv(dv,rest); 
		} else if (typ == "MNYR" ){
			sre_monthyear.cancelDiv(dv,rest);  
		} else if (typ == "MENU" ){
			sre_menu.cancelDiv(dv,rest);  
		}else if (typ == "GRID" ){
			sre_grid.cancelDiv(dv,rest); 
		} else if (typ == "COLR" ){
			sre_color.cancelDiv(dv,rest); 
		}else if (typ == "PAGE" ){
			sre_page.cancelDiv(dv,rest); 
		}

	}
}
function tpopup(){
	html='';
	html+='<table border="0" width="500" height="300" cellpadding="0" cellspacing="0" >';
	html+='<tr><td align="center" valign="top">';
	html+='<span  style="font-weight:bold;">';
	html+='<iframe src="'+turl+'" width="500" height="290" scroll="y" frameborder="0">';
	html+='</iframe>';
	html+='</span></td></tr>';
	html+='</table>';	
	return html;
}
/*
function  popupHeader(header,width,canceldiv) {
html='';
	html+='<div  id="sre_pop_div">';
	html+='<table border="0" style"width:auto;height:auto" cellpadding="0" cellspacing="0" >';
	html+='<tr><td width="2" rowspan="3" style="background-color:rgb(51,78,113);border-collapse:collapse"></td>'
	html+='<td align="left" style="background-color:rgb(51,78,113)"> <span class="blkBigRev" style="font-weight:bold">&nbsp;&nbsp;';
	html+=header;
	html+='</span></td>';
	html+='<td width="20" align="right" style="background-color:rgb(51,78,113)" >';
	html+='<img border="0" style="cursor:pointer;background-color:transparent" src="/EN/SRESYS/Pic/close1.png" height="20" onclick="cancelDiv('+canceldiv+')"></img>';

	html+='</td><td width="5" rowspan="3" style="background-color:rgb(51,78,113)"></td></tr>';
	html+='<tr><td colspan="3" height="2" style="background-color:rgb(51,78,113)">';
	html+='</td></tr>';
	html+='<tr><td colspan="2" style="padding-left:0;background-color:rgb(163,184,214)">';
	html+='<table border="0" cellpadding="2" cellspacing="0" width="100%"><tr><td style="width:2;background-color:rgb(51,78,113)"></td>';
	html+='<td style="background-color:rgb(163,184,214)">';
	return html;
}
function popupFooter(){
	html='';
	html+='</td><td style="width:2;background-color:rgb(51,78,113)"></td></tr></table>';
	html+='</td>';	
	html+='</tr>';
	html+='</table>';	
	html+='</div>';
	return html;
}
*/
function  getElePos(ob,e,w,h) {
	etyp = 0;
t = sre_scrollTop();
l = sre_scrollLeft();

wh =sre_core.windowSize('H') ;
wv = sre_core.windowSize('V') ;
	var top = 0, left = 0;
//alert(ob);	
	obj = document.getElementById(ob);
	if(obj){
		do {
				left += obj.offsetLeft;
				top += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	if((top > 0) || (left > 0)) {
		etyp =1;
	}
	if(document.event) {
		if((left == 0) && (e)) {
			left = e.clientX;
		}
		if((top == 0) && (e)){
			top = e.clientY;
		}
	} else {
		sl = document.body.scrollLeft;
		st = document.body.scrollTop;

		top +=st;
		left += sl;
	}
//alert(obj.offsetLeft+'--'+obj.offsetTop);
if(etyp == 1) {
	left = left - l;
	top = top - t;

}
//adjust for size outside window  *** NEED TO ADJUST FOR LOWER END LATER
	if( (left + w) > wh) {
		left = wh - w;
	}
	if( (top + h) > wv) {
		top = wv - h;
	}

	return [left, top];
}

function showPopup(type,object,e,oriid,imgid,w,h){
	len = type.length ;
	typ = type.slice(0,4);
	rest = type.slice(5,len);
	pos	= getElePos(imgid,e,w,h);
	left_s = pos[0];
	top_s = pos[1];
	setting = eval(rest);
	if (typ == "CLDR" ){
		sre_calendar.displayLookup(object,oriid,setting,top_s,left_s);
	} else if (typ == "MNYR" ){
		sre_monthyear.displayLookup(object,oriid,setting,top_s,left_s);  
	} else if (typ == "MENU" ){
		sre_menu.displayLookup(object,oriid,setting,top_s,left_s);  
	}else if (typ == "GRID" ){
		sre_grid.displayLookup(object,oriid,setting,top_s,left_s)
	} else if (typ == "COLR" ){
		sre_color.displayLookup(object,oriid,setting,top_s,left_s)
	} else if (typ == "PAGE" ){
		sre_page.displayLookup(object,oriid,setting,top_s,left_s)
	}
	//sre_rounded.Rounded("div#sre_pop_div","transparent",
	//"rgb(200,200,200)","rgb(200,200,200)","small"); //
}

function findPositionWithScrolling( objid,flag ) {  //NOT TESTED*******
	oElement = document.getElementById(objid);
  if( typeof( oElement.offsetParent ) != 'undefined' ) {
    var originalElement = oElement;
    for( var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent ) {
      posX += oElement.offsetLeft;
      posY += oElement.offsetTop;
      if( oElement != originalElement && oElement != document.body && oElement != document.documentElement ) {
        posX -= oElement.scrollLeft;
        posY -= oElement.scrollTop;
      }
    }
	if(flag == 1) {
		return posX;
	} else {
		return posY;
	}	 
    //return [ posX, posY ];
  } else {
  	if(flag == 1) {
		return oElement.getX;
	} else {
		return oElement.getY;
	}	 

   // return [ oElement.x, oElement.y ];
  }
}
/* -----------------------END(sre_popup)---------------------------------- */



/* ---------------------Begin(sre_rounded)---------------------------------- *\
Usage:
To have solid rounded color
<div id="container" >
<table border="0" width="250" cellpadding="0" cellspacing="0" >
<tr><td style="background-color:#000000"> the Header </td></tr> //Match Top half rounding colors
<tr><td style="background-color:#777777">'; //Match Bottom half rounding colors
<span style="color:#ffffff;font-weight:bold">fsdfsdfsdfsdfsdfsdfsfsfs<p>gfdgfdg<p>gfgdf dg<p></span>
</td>	
</tr>
</table>	
</div>

sre_rounded.Rounded("div#container","transparent","#000000","#777777","small");
sre_rounded.RoundedTop("div#container","transparent","#777777","small");
sre_rounded.RoundedBottom("div#container","transparent","#777777","small");

\* ---------------------------------------------------------------------- */
var sre_rounded = {
/*	Settings: function() {
		this.ColorId = '';
		
	},
config: new Array(),
setSettings: function(n, settings) {

	if(typeof(settings) != "object") {
		this.config[n] = new this.Settings();
	}
	else {
		this.config[n] = settings;
	}
},
*/
Rounded: function (selector,bk,colorT,bolorB,size){
	var i;
	var v=this.getElementsBySelector(selector);
	var l=v.length;
	for(i=0;i<l;i++){
		this.AddTop(v[i],bk,colorT,size);
		this.AddBottom(v[i],bk,bolorB,size);
		}
},
RoundedTop: function (selector,bk,color,size){
	var i;
	var v=this.getElementsBySelector(selector);
	for(i=0;i<v.length;i++)
		this.AddTop(v[i],bk,color,size);
},
RoundedBottom: function (selector,bk,color,size){
	var i;
	var v=this.getElementsBySelector(selector);
	for(i=0;i<v.length;i++)
		this.AddBottom(v[i],bk,color,size);
},
AddTop: function (el,bk,color,size){
	var i;
	var d=document.createElement("b");
	var cn="r";
	var lim=2;
	if(size && size=="small"){ cn="rs"; lim=1}
	d.className="rtop";
	d.style.backgroundColor=bk;
	for(i=1;i<=lim;i++){
		var x=document.createElement("b");
		x.className=cn + i;
		x.style.backgroundColor=color;
	//	x.style.height="1px";
	//	x.innerHTML='<!-- -->';
	//	x.style.display="inline";
	//	x.Style.VerticalAlign = "bottom";
		d.appendChild(x);
		}
	el.insertBefore(d,el.firstChild);
},
AddBottom: function (el,bk,color,size){
	var i;
	var d=document.createElement("b");
	var cn="r";
	var lim=2;
	if(size && size=="small"){ cn="rs"; lim=1}
	d.className="rbottom";
	d.style.backgroundColor=bk;
	for(i=lim;i>0;i--){
		var x=document.createElement("b");
		x.className=cn + i;
			x.style.backgroundColor=color;
		d.appendChild(x);
		}
	el.appendChild(d,el.firstChild);
},
getElementsBySelector: function(selector) {
	var i;
	var s=[];
	var selid="";
	var selclass="";
	var tag=selector;
	var objlist=[];
	if(selector.indexOf(" ")>0){  //descendant selector like "tag#id tag"
		s=selector.split(" ");
		var fs=s[0].split("#");
		if(fs.length==1) return(objlist);
		return(document.getElementById(fs[1]).getElementsByTagName(s[1]));
		}
	if(selector.indexOf("#")>0){ //id selector like "tag#id"
		s=selector.split("#");
		tag=s[0];
		selid=s[1];
		}
	if(selid!=""){
		objlist.push(document.getElementById(selid));
		return(objlist);
		}
	if(selector.indexOf(".")>0){  //class selector like "tag.class"
		s=selector.split(".");
		tag=s[0];
		selclass=s[1];
		}
	var v=document.getElementsByTagName(tag);  // tag selector like "tag"
	if(selclass=="")
		return(v);
	for(i=0;i<v.length;i++){
		if(v[i].className==selclass){
			objlist.push(v[i]);
			}
		}
	return(objlist);
}
};


/* -----------------------END(sre_rounded)---------------------------------- */





/* ---------------------Begin(sre_toggle_menu)---------------------------------- *\
MUST set up div at the top of the page like this:

<div id="sre_down_hit" onmouseover="sre_toggle_menu.toggleMenu('mnuid','D');"></div>
   <div id="menu_holder">
</div>
<div id="sre_up_hit" onmouseover="sre_toggle_menu.toggleMenu('mnuid','U');">
Usage:
	mnu = new sre_toggle_menu.Settings();
	sre_toggle_menu.init ("mnuid",mnu,"toggle function name");
toggle function return s html that will be used to create the content of the menu.
\* ---------------------------------------------------------------------- */
var sre_toggle_menu = {
	Settings: function() {
		this.Color = "rgb(193,193,193)";//"#444444";//
		this.togMenuId = "";
		this.moving = 0;
		this.menuWidth = 800;
		this.menuLeft = 0;
		this.currStat = "U";
		this.winWidth=0;
		this.MenuDiv = "sre_tag_menu"; // this is div for menu body
		this.DivDown = "sre_down_hit"; // this is the div that pushes menu down
		this.DivGrip = "sre_grip"; // this is the div for grip
		this.menuHeight = 60; // this is the defaultheight of the menu
		this.timer;
	},
config: new Array(),
initMenu: function(num, settings,togfunc) {
	this.setSettings(num, settings);
	html ='';
	//Create the menu content
html+='<div id="';
html+=this.config[num].MenuDiv; 
html+='" >';
html+='<table border="0" width="';
html+=this.config[num].menuWidth ;
html+='" cellpadding="0" height="'+this.config[num].menuHeight+'" cellspacing="0" style="opacity:0.4;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=40);background-color:';
html+=this.config[num].Color; 
html+=';background-image:url(\'/EN/SRESYS/Pic/blue_gradsm.JPG\');background-repeat:repeat;" onmouseover="sre_toggle_menu.mouseoverFunc(\''+num+'\')" >';
html+='<tr><td height="2">';
html+='</td></tr>'
html+='<tr><td style="opacity:0.9;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=90);">';
html += eval(togfunc+ "()");
html+='</td></tr>';
/*
html+='<tr><td>&nbsp;';
html+='</td>';	
html+='</tr>';
*/
html+='<tr>';
html+='<td height="20" align="center">';

ghtml='';
ghtml+='<table border="0" cellpadding="0" cellspacing="0" >';
ghtml+='<tr>';
ghtml+='<td id="grptd" class="grip" style="background-color:';
ghtml+='transparent';
ghtml+='" width="25" >';	
ghtml+='</td>';	
ghtml+='</tr>';
ghtml+='</table>';
html+=ghtml;

html+='</td>';	
html+='</tr>';

html+='</table>';
html+='</div>';
	strdv = "div#"
	strdv += this.config[num].DivDown;
	// need "div#container" format for div to work
	sre_rounded.RoundedBottom(strdv,"transparent",
		this.config[num].Color,"small");
/*	
ghtml='';
ghtml+='<table border="2" height="10" cellpadding="0" cellspacing="0" onmouseover="sre_toggle_menu.mouseoverFunc(\''+num+'\')" onmouseout="sre_toggle_menu.mouseoutFunc(\''+num+'\')">';
ghtml+='<tr>';
ghtml+='<td class="grip" style="background-color:';
ghtml+='transparent';
ghtml+='" width="25" >&nbsp;';	
ghtml+='</td>';	
ghtml+='</tr>';
ghtml+='</table>';
*/
	gr = document.getElementById(this.config[num].DivGrip);
	gr.innerHTML = ghtml;
	fl = document.getElementById(this.config[num].MenuDiv);
	fl.innerHTML = html;
	vd = $(this.config[num].DivDown);
	vd.style.visibility = "visible";
	this.config[num].winWidth = sre_core.windowSize('H');
	this.config[num].menuLeft = Math.ceil((this.config[num].winWidth - this.config[num].menuWidth)/ 2);
	vd.style.top= 0; vd.style.left = parseInt(this.config[num].menuLeft);
	gr.style.top= parseInt(parseInt(vd.style.top) + parseInt(this.config[num].menuHeight) +2);
	//gr.style.left =Math.ceil((this.config[num].winWidth - 50)/ 2);
	if(fl.style.height > this.config[num].menuHeight) {
		this.config[num].menuHeight = fl.style.height;
	}
	vd.style.height= parseInt(this.config[num].menuHeight);
	if(fl.style.width > this.config[num].menuWidth) {
		this.config[num].menuWidth = fl.style.width;
	}
	vd.style.width= parseInt(this.config[num].menuWidth);
	//
	gr.style.width=this.config[num].menuWidth - 20;
	gr.style.left = this.config[num].menuLeft + 10;
	
	//gr.style.visibility = "hidden";
	//alert(num);
	this.toggleMenu(num,'U');
},
setSettings: function(n, settings) {
	if(typeof(settings) != "object") {
		this.config[n] = new this.Settings();
	}
	else {
		this.config[n] = settings;
	}
	this.config[n].togMenuId = n;
},
mouseoutFunc:function(num){
	sre_toggle_menu.toggleMenu(num,'U');
},
mouseoverFunc:function(num){
	if(this.config[num].moving == 0){
	 window.clearTimeout ( this.config[num].timer );
	}
},
reposition:function(num){
	//alert(num);
	this.config[num].winWidth = sre_core.windowSize('H');
	this.config[num].menuLeft = Math.ceil((this.config[num].winWidth - this.config[num].menuWidth)/ 2);
	//gr = document.getElementById(this.config[num].DivGrip);
	//gr.style.left =Math.ceil((this.config[num].winWidth - 50)/ 2);
	vd = $(this.config[num].DivDown);
	vd.style.left = parseInt(this.config[num].menuLeft);
	gr.style.width=this.config[num].menuWidth - 20;
	gr.style.left = this.config[num].menuLeft + 10;

},
toggleMenu: function (num,stat) {
	vd = $(this.config[num].DivDown);
	vid = vd.id;
	if(this.config[num].moving == 1) return;
	this.config[num].moving = 1;
	if (stat == "U") {
		this.config[num].timer = window.setTimeout("sre_toggle_menu.moveButton('"+vid+"','U','"+num+"');", 20, "JavaScript");
		
	} else {
		sre_core.lightUp(vid,100);
		this.config[num].timer = window.setTimeout("sre_toggle_menu.moveButton('"+vid+"','D','"+num+"');", 20, "JavaScript");
		
	}
	this.config[num].currStat = stat;
	vd.style.visibility="visible";
},
moveButton: function (vid,UpDown,num) {
	vd = $(vid);
	vd.style.left = this.config[num].menuLeft;
	gr = document.getElementById(this.config[num].DivGrip);
//

	diff = parseInt(vd.style.top); //parseInt(vd.style.left) - parseInt(winHeight);
	if (UpDown == "U") {
		var spn = (-1 *  (parseInt(this.config[num].menuHeight)));
		
		if (diff >= (spn )) {
			vd.style.top = parseInt(parseInt(vd.style.top) - parseInt(1));
			gr.style.top= parseInt(parseInt(vd.style.top) + parseInt(this.config[num].menuHeight) + 2);
			this.config[num].timer = window.setTimeout("sre_toggle_menu.moveButton('"+vid+"','U','"+num+"');", 20, "JavaScript");
		} else {
			sre_core.lightUp(vid,0);
			gr.style.visibility = "visible";
			this.config[num].moving = 0;
		}
	} else {
		if ( diff <= (0)) {
			vd.style.top = parseInt(parseInt(vd.style.top) + parseInt(1));
			gr.style.top= parseInt(parseInt(vd.style.top) + parseInt(this.config[num].menuHeight) + 2);
			this.config[num].timer = window.setTimeout("sre_toggle_menu.moveButton('"+vid+"','D','"+num+"');", 20, "JavaScript");
		} else {
			this.config[num].moving = 0;
		}
	}
}
};
/* -----------------------END(sre_toggle_menu)---------------------------------- */

/* ---------------------Begin(sre_slideout_menu)---------------------------------- *\
MUST set up div at the top of the page like this:

<div id="sre_down_hit" onmouseover="sre_toggle_menu.toggleMenu('mnuid','D');"></div>
   <div id="menu_holder">
</div>
<div id="sre_up_hit" onmouseover="sre_toggle_menu.toggleMenu('mnuid','U');">
Usage:
	mnu = new sre_toggle_menu.Settings();
	sre_toggle_menu.init ("mnuid",mnu,"toggle function name");
toggle function return s html that will be used to create the content of the menu.
\* ---------------------------------------------------------------------- */
/*var sre_slideout_menu = {
	Settings: function() {
		this.Color = "rgb(193,193,193)";//"#444444";//
		this.togMenuId = "";
		this.moving = 0;
		this.menuWidth = 200;
		this.menuLeft = 0;
		this.currStat = "U";
		this.winWidth=0;
		this.MenuDiv = "sre_tag_menu"; // this is div for menu body
		this.DivDown = "sre_down_hit"; // this is the div that pushes menu down
		this.DivGrip = "sre_grip"; // this is the div for grip
		this.menuHeight = 50; // this is the defaultheight of the menu
		this.timer;
	},
config: new Array(),
initMenu: function(num, settings,togfunc) {
	this.setSettings(num, settings);
	html ='';
	//Create the menu content
html+='<div id="';
html+=this.config[num].MenuDiv; 
html+='" >';
html+='<table border="0" width="';
html+=this.config[num].menuWidth ;
html+='" cellpadding="0" height="'+this.config[num].menuHeight+'" cellspacing="0" style="opacity:0.4;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=40);background-color:';
html+=this.config[num].Color; 
html+=';background-image:url(\'/EN/SRESYS/Pic/blue_gradsm.JPG\');background-repeat:repeat;" onmouseover="sre_toggle_menu.mouseoverFunc(\''+num+'\')" >';
html+='<tr><td height="2">';
html+='</td></tr>'
html+='<tr><td style="opacity:0.9;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=90);">';
html += eval(togfunc+ "()");
html+='</td></tr>';

html+='<tr><td>&nbsp;';
html+='</td>';	
html+='</tr>';


html+='<tr>';
html+='<td height="20" align="center">';

ghtml='';
ghtml+='<table border="0" cellpadding="0" cellspacing="0" >';
ghtml+='<tr>';
ghtml+='<td id="grptd" class="grip" style="background-color:';
ghtml+='transparent';
ghtml+='" width="25" >';	
ghtml+='</td>';	
ghtml+='</tr>';
ghtml+='</table>';
html+=ghtml;

html+='</td>';	
html+='</tr>';

html+='</table>';
html+='</div>';
//	strdv = "div#"
//	strdv += this.config[num].DivDown;
	// need "div#container" format for div to work
//	sre_rounded.RoundedBottom(strdv,"transparent",
//		this.config[num].Color,"small");
	
ghtml='';
ghtml+='<table border="2" height="10" cellpadding="0" cellspacing="0" onmouseover="sre_toggle_menu.mouseoverFunc(\''+num+'\')" onmouseout="sre_toggle_menu.mouseoutFunc(\''+num+'\')">';
ghtml+='<tr>';
ghtml+='<td class="grip" style="background-color:';
ghtml+='transparent';
ghtml+='" width="25" >&nbsp;';	
ghtml+='</td>';	
ghtml+='</tr>';
ghtml+='</table>';

//	gr = document.getElementById(this.config[num].DivGrip);
//	gr.innerHTML = ghtml;
	fl = document.getElementById(this.config[num].MenuDiv);
	fl.innerHTML = html;
//	vd = $(this.config[num].DivDown);
//	vd.style.visibility = "visible";
	this.config[num].winWidth = sre_core.windowSize('H');
	this.config[num].menuLeft = Math.ceil((this.config[num].winWidth - this.config[num].menuWidth)/ 2);
//	vd.style.top= 0; vd.style.left = parseInt(this.config[num].menuLeft);
//	gr.style.top= parseInt(parseInt(vd.style.top) + parseInt(this.config[num].menuHeight) +2);
	//gr.style.left =Math.ceil((this.config[num].winWidth - 50)/ 2);
//	if(fl.style.height > this.config[num].menuHeight) {
		this.config[num].menuHeight = fl.style.height;
//	}
//	vd.style.height= parseInt(this.config[num].menuHeight);
//	if(fl.style.width > this.config[num].menuWidth) {
		this.config[num].menuWidth = fl.style.width;
//	}
//	vd.style.width= parseInt(this.config[num].menuWidth);
	//
//	gr.style.width=this.config[num].menuWidth - 20;
//	gr.style.left = this.config[num].menuLeft + 10;
	
	//gr.style.visibility = "hidden";
	//alert(num);
	this.sre_slideout_menu(num,'U');
},
setSettings: function(n, settings) {
	if(typeof(settings) != "object") {
		this.config[n] = new this.Settings();
	}
	else {
		this.config[n] = settings;
	}
	this.config[n].togMenuId = n;
},
mouseoutFunc:function(num){
	sre_toggle_menu.toggleMenu(num,'U');
},
mouseoverFunc:function(num){
	if(this.config[num].moving == 0){
	 window.clearTimeout ( this.config[num].timer );
	}
},
reposition:function(num){
	//alert(num);
	this.config[num].winWidth = sre_core.windowSize('H');
	this.config[num].menuLeft = Math.ceil((this.config[num].winWidth - this.config[num].menuWidth)/ 2);
	//gr = document.getElementById(this.config[num].DivGrip);
	//gr.style.left =Math.ceil((this.config[num].winWidth - 50)/ 2);
	vd = $(this.config[num].DivDown);
	vd.style.left = parseInt(this.config[num].menuLeft);
	gr.style.width=this.config[num].menuWidth - 20;
	gr.style.left = this.config[num].menuLeft + 10;

},
toggleMenu: function (num,stat) {
	vd = $(this.config[num].DivDown);
	vid = vd.id;
	if(this.config[num].moving == 1) return;
	this.config[num].moving = 1;
	if (stat == "U") {
		this.config[num].timer = window.setTimeout("sre_toggle_menu.moveButton('"+vid+"','U','"+num+"');", 20, "JavaScript");
		
	} else {
		sre_core.lightUp(vid,100);
		this.config[num].timer = window.setTimeout("sre_toggle_menu.moveButton('"+vid+"','D','"+num+"');", 20, "JavaScript");
		
	}
	this.config[num].currStat = stat;
	vd.style.visibility="visible";
},
moveButton: function (vid,UpDown,num) {
	vd = $(vid);
	vd.style.left = this.config[num].menuLeft;
	gr = document.getElementById(this.config[num].DivGrip);
//

	diff = parseInt(vd.style.top); //parseInt(vd.style.left) - parseInt(winHeight);
	if (UpDown == "U") {
		var spn = (-1 *  (parseInt(this.config[num].menuHeight)));
		
		if (diff >= (spn )) {
			vd.style.top = parseInt(parseInt(vd.style.top) - parseInt(1));
			gr.style.top= parseInt(parseInt(vd.style.top) + parseInt(this.config[num].menuHeight) + 2);
			this.config[num].timer = window.setTimeout("sre_toggle_menu.moveButton('"+vid+"','U','"+num+"');", 20, "JavaScript");
		} else {
			sre_core.lightUp(vid,0);
			gr.style.visibility = "visible";
			this.config[num].moving = 0;
		}
	} else {
		if ( diff <= (0)) {
			vd.style.top = parseInt(parseInt(vd.style.top) + parseInt(1));
			gr.style.top= parseInt(parseInt(vd.style.top) + parseInt(this.config[num].menuHeight) + 2);
			this.config[num].timer = window.setTimeout("sre_toggle_menu.moveButton('"+vid+"','D','"+num+"');", 20, "JavaScript");
		} else {
			this.config[num].moving = 0;
		}
	}
}
};
 */
/* -----------------------END(sre_slideout_menu)---------------------------------- */

/* ---------------------Begin(sre_helpbar)---------------------------------- *\
MUST set up div at the top of the page like this:

<div id="sre_hlp_down_hit onmouseover="sre_helpbar.toggleMenu('mnuid','D');"></div>
   <div id="menu_holder">
</div>
<div id="sre_hlp_up_hit" onmouseover="sre_helpbar.toggleMenu('mnuid','R');">
Usage:
	mnu = new sre_helpbar.Settings();
	sre_helpbar.init ("mnuid",mnu,"toggle function name");
toggle function return s html that will be used to create the content of the menu.
\* ---------------------------------------------------------------------- */
var sre_helpbar = {
	Settings: function() {
		this.Color = "rgb(215,215,255)"//"rgb(98,124,193)";//"#444444";//
		this.BkColor = "rgb(185,185,255)"//"rgb(98,124,193)";//"#444444";//
		this.togMenuId = "";
		this.moving = 0;
		this.menuWidth = 190;
		this.menuTop = 0;
		this.currStat = 'R';
	//	this.winWidth=0;
		this.ObjLeft=200;
		//this.MenuDiv = "help_body"; // this is div for menu body
		this.DivDown = "sre_rightpanelbody"; // this is the div that pushes menu down
	//	this.DivGrip = "sre_grip"; // this is the div for grip
		this.menuHeight = 320; // this is the defaultheight of the menu
	},
config: new Array(),

initHelp: function(num, settings,togfunc) {
	this.setSettings(num, settings);
	html ='';
	//Create the menu content
//html+='<div id="';
//html+=this.config[num].MenuDiv; 
//html+='" >';
html+='<table border="0" width="';
html+=this.config[num].menuWidth ;
html+='" cellpadding="0" cellspacing="0" style="opacity:0.6;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=60);background-color:';
html+=this.config[num].Color; 
html+=';background-image:url(\'/EN/SRESYS/Pic/blue_gradsm.JPG\');background-repeat:repeat;';
html+='">';
html+='<tr><td style="background-color:';
html+=this.config[num].BkColor ;
html+='">';
html += eval(togfunc+ "()");
html+='</td></tr>';
html+='<tr><td>&nbsp;';
html+='</td>';	
html+='</tr>';
html+='</table>';
//html+='</div>';
//H = sre_core.windowSize('H')
//V = sre_core.windowSize('V')
//	fl = document.getElementById(this.config[num].DivDown);
//	fl.innerHTML = html;

	vd = $(this.config[num].DivDown);
	
	vd.innerHTML = html;

	//strdv = "div#"
	//strdv += this.config[num].MenuDiv;
	// need "div#container" format for div to work
	//sre_rounded.Rounded(strdv,"transparent",this.config[num].Color,this.config[num].Color,"smallvv");

	vd.style.visibility = "visible";
	//this.config[num].winWidth = this.config[num].ObjLeft;//sre_core.windowSize('H');
	vd.style.width= 0;//parseInt(this.config[num].menuWidth);
	
	vd.style.left =  parseInt(this.config[num].menuWidth) ;//parseInt(0) - parseInt(vd.style.width);
	this.config[num].menuLeft = vd.style.left;/*Math.ceil((this.config[num].winWidth - this.config[num].menuWidth)/ 2);*/

	vd.style.top= 0;
	vd.style.height= parseInt(this.config[num].menuHeight);
//alert(vd.style.left);
//	vd.style.left = parseInt(this.config[num].menuLeft);
//	if(fl.style.height > this.config[num].menuHeight) {
//		this.config[num].menuHeight = fl.style.height;
//	}
//	if(fl.style.width > this.config[num].menuWidth) {
//		this.config[num].menuWidth = fl.style.width;
//	}
//	this.config[num].menuWidth;

//	sre_helpbar.toggleHelp(num,'R');

},
setSettings: function(n, settings) {
	if(typeof(settings) != "object") {
		this.config[n] = new this.Settings();
	}
	else {
		this.config[n] = settings;
	}
	this.config[n].togMenuId = n;
},
toggleHelp: function (num,stat) {

	vd = $(this.config[num].DivDown);
	vid = vd.id;
	if(this.config[num].moving == 1) return;
	this.config[num].moving = 1;
	
	if (stat == "R") {
		hideAdv();
		sre_core.lightUp(vid,60);
		//timer = window.setTimeout("sre_helpbar.moveButton('"+vid+"','L','"+num+"');", 20, "JavaScript");
		sre_helpbar.moveButton(vid,'L',num);
		
	} else {
		
		sre_core.lightUp(vid,60);
		//timer = window.setTimeout("sre_helpbar.moveButton('"+vid+"','R','"+num+"');", 20, "JavaScript");
		sre_helpbar.moveButton(vid,'R',num);
		
	}
	this.config[num].currStat = stat;
	vd.style.visibility="visible";
	
},

moveButton: function (vid,LeftRight,num) {
	vd = $(vid);
	vd.style.top = this.config[num].menuTop;
	
	diff = parseInt(vd.style.left) + parseInt(this.config[num].menuWidth) ; //parseInt(vd.style.left) - parseInt(H);
	var spn = parseInt(this.config[num].menuWidth) ;
	if (LeftRight == 'R') {//0,200,r,
		//	$("SRE_ToolTip").innerHTML=diff +'**'+spn+'**'+LeftRight+'**'+vd.style.width;
		if (diff <= (1 + (2 * spn))) {
			vd.style.left = parseInt(parseInt(vd.style.left) + parseInt(1));
			if((parseInt(vd.style.width) - parseInt(1)) >= 0) {
				vd.style.width = parseInt(vd.style.width) - parseInt(1) ;
			}
			timer = window.setTimeout("sre_helpbar.moveButton('"+vid+"','R','"+num+"');", 1, "JavaScript");
		} else {
			sre_core.lightUp(vid,0);
			this.config[num].moving = 0;
			bringAdv();
		}
		
	} else {
		
		//$("SRE_ToolTip").innerHTML=diff +'**'+spn+'**'+LeftRight+'**'+vd.style.width;
		if ( diff >= (1 + spn)) {
			vd.style.left = parseInt(parseInt(vd.style.left) - parseInt(1));
			if((parseInt(vd.style.width) - parseInt(1)) <= (2 * parseInt(vd.style.width))) {
				vd.style.width = parseInt(vd.style.width) + parseInt(1);
			}
			timer = window.setTimeout("sre_helpbar.moveButton('"+vid+"','L','"+num+"');", 1, "JavaScript");
		} else {
			this.config[num].moving = 0;
			
		}
	}
}

};
/* ---------------------Begin(sre_toolbar)---------------------------------- *\
MUST set up div at the top of the page like this:

<div id="sre_hlp_down_hit onmouseover="sre_helpbar.toggleMenu('mnuid','D');"></div>
   <div id="menu_holder">
</div>
<div id="sre_hlp_up_hit" onmouseover="sre_helpbar.toggleMenu('mnuid','R');">
Usage:
	mnu = new sre_helpbar.Settings();
	sre_helpbar.init ("mnuid",mnu,"toggle function name");
toggle function return s html that will be used to create the content of the menu.
\* ---------------------------------------------------------------------- */
var sre_toolbar = {
	Settings: function() {
		this.Color = "transparent";//"rgb(98,124,193)";//"#444444";//
		this.BkColor = "transparent";//"rgb(98,124,193)";//"#444444";//
		this.togMenuId = "";
		this.moving = 0;
		this.menuWidth = 960;
		this.menuTop = 0;
		this.ObjLeft=0;
		this.speed = 2;
		this.accl = 1.2;
		this.savespeed=2;//set same as speed
		this.funcName='';
		this.DonefuncName='';
		this.DivBody = "toolscroll"; // this is the div that pushes menu down
		this.DivDummy = "portdummy";
		this.DivContent = "portalTool";
		this.menuHeight = 50; // this is the defaultheight of the menu
	},
config: new Array(),
initTool: function(num, settings,togfunc,donefunc) {
	this.setSettings(num, settings);
	this.config[num].funcName=togfunc;
	this.config[num].DonefuncName=donefunc;
	vd=$(this.config[num].DivBody);
	cont=$(this.config[num].DivContent);
	dum=$(this.config[num].DivDummy);
	dum.style.visibility = "visible";
	dum.style.width= this.config[num].menuWidth;//parseInt(this.config[num].menuWidth);
	dum.style.left =  vd.style.left ;//parseInt(0) - parseInt(vd.style.width);
	dum.style.top= vd.style.top;
	dum.style.height= parseInt(this.config[num].menuHeight);
	cont.style.visibility = "hidden";
	cont.style.width= 0;//parseInt(this.config[num].menuWidth);
	cont.style.left =  parseInt(this.config[num].menuWidth) ;//parseInt(0) - parseInt(vd.style.width);
	this.config[num].menuLeft = cont.style.left;/*Math.ceil((this.config[num].winWidth - this.config[num].menuWidth)/ 2);*/
	cont.style.top= vd.style.top;
	cont.style.height= parseInt(this.config[num].menuHeight);
	sre_toolbar.toggleTool(num,'R',donefunc);
},
setScreen: function(num){
	togfunc =this.config[num].funcName;
	strdv = 'rnd_'+num;
	html ='';
	html+='<div id="'+strdv+'">';
	html+='<table border="0" height="92%" width="';
	html+=this.config[num].menuWidth ;
	html+='" cellpadding="0" cellspacing="0" >';
	html+='<tr><td style="background-color:';
	html+=this.config[num].BkColor ;
	html+='">';
	html += eval(togfunc+ "()");
	html+='</td></tr>';
	html+='</table>';
	html+='</div>';
	return html;
},
setSettings: function(n, settings) {
	if(typeof(settings) != "object") {
		this.config[n] = new this.Settings();
	}
	else {
		this.config[n] = settings;
	}
	this.config[n].togMenuId = n;
},
toggleTool: function (num,stat,donefunc) {
	vd=$(this.config[num].DivBody);
	cont=$(this.config[num].DivContent);
	cid= cont.id;
	dum=$(this.config[num].DivDummy);
	did = dum.id;
	dum.style.visibility = "visible";
	dum.style.width= this.config[num].menuWidth;//parseInt(this.config[num].menuWidth);
	dum.style.left =  vd.style.left ;//parseInt(0) - parseInt(vd.style.width);
	dum.style.top= vd.style.top;
	dum.style.height= parseInt(this.config[num].menuHeight);
	cont.style.width= 0;//parseInt(this.config[num].menuWidth);
	cont.style.left =  parseInt(this.config[num].menuWidth) ;//parseInt(0) - parseInt(vd.style.width);
	this.config[num].menuLeft = cont.style.left;/*Math.ceil((this.config[num].winWidth - this.config[num].menuWidth)/ 2);*/
	cont.style.top= vd.style.top;
	cont.style.height= parseInt(this.config[num].menuHeight);
	dum.innerHTML=cont.innerHTML;
	sre_core.lightUp(did,100);
	html ='';
	html = this.setScreen(num);
	cont.innerHTML = html;
	lum=100;
	this.fadeDummy(did,lum);
	cont.style.visibility="visible";
	if(this.config[num].moving == 1) return;
	this.config[num].moving = 1;
	sre_core.lightUp(cid,90);
	spd = parseInt(this.config[num].speed);
	//eval(donefunc+ "()");
	this.moveButton(spd,num,donefunc);
},
fadeDummy: function(did,lum){
	if(lum > 0){
		sre_core.lightUp(did,lum);
		lum-=5;
		timer = window.setTimeout("sre_toolbar.fadeDummy('"+did+"',"+lum+");", 100, "JavaScript");
	}
},
moveButton: function (spd,num,donefunc) {	
	vd=$(this.config[num].DivBody);
	lft = parseInt(sreConvertPxToInt(vd.style.left));
	acc= this.config[num].accl;
	spd = parseInt(Math.ceil(acc * spd));
	this.config[num].speed = spd;
	dum=$(this.config[num].DivDummy);
	cont=$(this.config[num].DivContent);
	diff = parseInt(sreConvertPxToInt(cont.style.left));// + parseInt(this.config[num].menuWidth) ; //parseInt(vd.style.left) - parseInt(H);
	var spn = parseInt(this.config[num].menuWidth) ;
		if ( diff >=  parseInt(spd)) {
			
			dum.style.right = parseInt(sreConvertPxToInt(dum.style.right)) - parseInt(spd);
			cont.style.left = parseInt(parseInt(sreConvertPxToInt(cont.style.left)) - parseInt(spd));
			cont.style.width = parseInt(parseInt(cont.style.width) + parseInt(spd));
			timer = window.setTimeout("sre_toolbar.moveButton("+spd+",'"+num+"','"+donefunc+"');", 100, "JavaScript");
		} else {
			//eval(donefunc+ "()");
			cont.style.width =this.config[num].menuWidth;
			cont.style.left = vd.style.left;
			this.config[num].moving = 0;
			dum.innerHTML='';
			this.config[num].speed = this.config[num].savespeed;
			if(donefunc !='') eval(donefunc+ "()");
		}
}
};
/* ---------------------Begin(sre_pop_msg)---------------------------------- *\
Usage:
Make sure we have the whole body element has ONE envelop table element. All other table elements can go withing it. This envelop table
element MUST have an ID [preferably : sre_page_container].
A div MUST exist right after the body tag BEFORE the envleop table. Div MUSt have an ID [preferably : sre_pop_msg]:
<div id="sre_pop_msg" style="position:absolute;z-index:9999;visibility:hidden;opacity:0.0;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);"></div>
Usage:
	msg = new sre_pop_msg.Settings();
	msg.setHeader("This is the header");
	msg.popWidth = "250";
	sre_pop_msg.msgPop ("msgid",msg,"page setup function name");

the page set up function should return html that will be shown in the content of the page. This page
MUST have event [MUST BE CALLED ] 
sre_pop_msg.msgClose ("msgid","S [for submit]","param to be sent to event"); 

\* ---------------------------------------------------------------------- */
/*var sre_pop_msg = {
	Settings: function() {
		this.TopColor = "rgb(0,0,224)";
		this.BottomColor = "rgb(0,0,224)";
		this.popMsgId = "";
		this.headerMsg = "";
		this.backFade = 0;
		this.rounding = 'smallsss';
		this.PageName='';
		this.tabDiv = "sre_page_container_shadow"; // this is the envelop table for the page
		this.popDiv = "sre_pop_msg"; // this is the parent div for the popup
		this.popWidth = "500";  //this is the default width of the popup, can be "50%" etc
		this.popHeight = "300";  //this is the default width of the popup, can be "50%" etc

		this.popTop = 0;  //this is the default top of the popup, if "AUTO" set at middle of page
		this.popLeft = 100;  //this is the default top of the popup, if "AUTO" set at middle of page

	//	this.MaxHeight = 300;
		this.setHeader = function(header) {
				this.headerMsg = header;
		};
	},
config: new Array(),
setSettings: function(n, settings) {
	if(typeof(settings) != "object") {
		this.config[n] = new this.Settings();
	}
	else {
		this.config[n] = settings;
	}
	this.config[n].popMsgId = n;
},
setScrollPos: function(){
        var shadow = document.getElementById("sre_page_container_shadow");
	t = sre_scrollTop();
	l = sre_scrollLeft();
	shadow.style.top = t;
	shadow.style.left = l;
},
setLayerPosition: function(){
        var shadow = document.getElementById("sre_page_container_shadow");
	var bws = this.getBrowserHeight();
        shadow.style.width = bws.width + "px";
        shadow.style.height = bws.height + "px";
	this.setScrollPos();
},
disablePage: function(){
        var shadow = document.getElementById("sre_page_container_shadow");
	this.setLayerPosition();
	shadow.style.display = "block";
	
},
enablePage: function(){
        var shadow = document.getElementById("sre_page_container_shadow");
	this.setLayerPosition();	
	shadow.style.display = "none";
},
getBrowserHeight: function () {
        var intH = 0;
        var intW = 0;
        if(typeof window.innerWidth  == 'number' ) {
                intH = window.innerHeight;
                intW = window.innerWidth;
        } 
        else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
                intH = document.documentElement.clientHeight;
                intW = document.documentElement.clientWidth;
        }
        else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
                intH = document.body.clientHeight;
                intW = document.body.clientWidth;
	}
        return { width: parseInt(intW), height: parseInt(intH) };
},  
msgClose: function (num,action,param) { //action C: cancel S: submit
//alert(num+'--'+action+'--'+param);	
	//formulate event call
	if((!action) || (action =='undefined')){
		action = 'S';
	}
	if(!this.config[num].PageName) {this.config[num].PageName = SRESelectedPage; }
	pagename = this.config[num].PageName;
	var str ="";
	str += '_PopMsgClose("';
	str += this.config[num].popMsgId;
	str += '","';
	str += action;
	str += '","';
	str += param;
	str += '")';
	// hide the popmsg
	fl = document.getElementById(this.config[num].popDiv);
	fl.innerHTML = '';
	fl.style.visibility = "hidden";
	//sre_core.lightUp(this.config[num].popDiv,50);
	this.enablePage();
	//light up the background
	sre_core.lightUp(this.config[num].tabDiv,100);
	//$("sre_embody").disabled=false;
	scr = $(this.config[num].tabDiv);
//	alert(scr);
	scr.disabled="false";

	//call the event	
	eval( pagename + str);
},	
msgPop: function (num,settings,popfunc,noeval){
	//alert("gggg");
	html=''; if(!noeval) noeval =false;
	//apply setting
	this.setSettings(num, settings);
//	this.config[num].MaxHeight = hei;
//	if(div) this.config[num].popDiv = div;

	//fade background
	this.disablePage();
	sre_core.lightUp(this.config[num].tabDiv,this.config[num].backFade);
	
	//$("sre_embody").disabled=true;
	// set up pop up div
	scr = $(this.config[num].tabDiv);
//	alert(scr);
	scr.disabled="true";
html+='<div id="popout">';	
html+='<table border="0" cellpadding="3" cellspacing="0" width="100%"  style="background-color:aaaaaa">';
html+='<tr>';
html+='<td >';
html+='<div id="poptryus" >';
html+='<table border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color:rgb(255,255,255);">';
//html+='<tr>';
//html+='<td colspan="3" height="5" >';
//html+='</td>';
//html+='</tr>';
html+='<tr>';
html+='<td colspan="3" align="left" height="5" width="100%" style="background-image:url(\'/EN/SRESYS/Pic/HeaderBack.JPG\');background-repeat:no-repeat;" >';
html+='<table border="0" cellpadding="0" cellspacing="0" width="100%">';
html+='<tr>';
html+='<td width="100%">';

html+='<span class="blkMedBold" >&nbsp;&nbsp;';
html+=this.config[num].headerMsg ;
html+='</span>';
html+='</td>';
html+='<td nowrap colspan="2" align="right" height="5" width="72" >';
html+='<span  nowrap style="cursor:pointer;padding-top:4;color:#000077;text-align:right;padding-right:10;font-family:Arial;font-size:9pt;font-style:normal;font-weight:bold;" onmouseover="showToolTip(\'Close window\',event)" onmouseout="hideToolTip()" onclick="sre_pop_msg.msgClose(\''+num+'\',\'SRE_CANCEL\',\'\')">Close &nbsp;';

html+='<img src="/EN/SRESYS/Pic/commonstyle/cancel.PNG" height="20" width="20" ></img>';
html+='</span>';

html+='</td>';
html+='</tr>';
html+='</table>';
html+='</td>';
//html+='<td width="5">';
//html+='</td>';
html+='</tr>';
html+='<tr>';
html+='<td  colspan="3" style="background-color:rgb(112,146,190);padding-left:4;padding-right:4;height:1;"></td>';
html+='</tr>';
html+='<tr>';
//html+='<td  height="100%" colspan="1" width="10" style="background-image:url(\'/EN/SRESYS/Pic/HeaderBack.JPG\');background-repeat:repeat;background-color:000000"></td>';
html+='<td   colspan="3" style="padding-left:0;padding-right:0;">';
html+='<div id="TryusInner" >';
html+='<table border="0" cellpadding="0" cellspacing="0" width="100%" >';
//html+='<tr>';
//html+='<td colspan="4" height="8" align="center" valign="middle" style="padding-bottom:5;background-color:rgb(255,255,255)">';	
//html+='</td>';
//html+='</tr>';
html+='<tr>';
html+='<td align="center"  valign="middle" style="background-color:rgb(255,255,255)">';

html+='<table border="0" cellpadding="3" cellspacing="0" width="90%"  style="background-color:transparent">';
html+='<tr>';
html+='<td style="padding-top:0;padding-bottom:0;">';
html+='<div id="divembed" ></div>'; 
html+='<div class="menuscroll" style="height:'+this.config[num].popHeight+'" >';
if(noeval == true) {
	html += popfunc;
} else {
html += eval(popfunc+ "()");
}
html+='</div>';
html+='</td>';
html+='</tr>';
html+='</table>';
html+='</td>';
html+='</tr>';
html+='</table>';
html+='</div>';
html+='</td>';
html+='</tr>';
html+='</table>';
html+='</div>';
html+='</td>';
html+='</tr>';
html+='</table>';
html+='</div>';
	fl = document.getElementById(this.config[num].popDiv);
	fl.innerHTML = html;
	fl.style.visibility = "visible";

	//	this.popTop = "200";  //this is the default top of the popup, if "AUTO" set at middle of page

	//if(this.config[num].popTop == "AUTO"){
	//	winHeight = sre_core.windowSize('V');
	//	winHeight = Math.ceil(winHeight / 2);
	//} else {
	//	winHeight = this.config[num].popTop;
	//}
//	hei = sre_core.windowSize('V');
//	this.popWidth =wd;  
//	this.popTop = 0; 
st = sre_scrollTop();
sl = sre_scrollLeft();

	winwidth = sre_core.windowSize('H');
	winHeight = sre_core.windowSize('V');

if(this.config[num].popHeight > winHeight) {
	this.config[num].popHeight = winHeight;
}

	//winwidth = Math.ceil((winwidth - this.config[num].popWidth)/ 2);
	fl.style.top = st +this.config[num].popTop;//winHeight;
	fl.style.left = sl +this.config[num].popLeft;//winwidth;
	
	fl.style.height = this.config[num].popHeight;//winHeight -50;
	fl.style.width = this.config[num].popWidth;//winwidth -30;
	strdv = "div#"
	strdv += this.config[num].popDiv;
	// need "div#container" format for div to work
	sre_core.lightUp(this.config[num].popDiv,100);
sre_rounded.Rounded("div#TryusInner","transparent","rgb(255,255,255)","rgb(255,255,255)","small");
//sre_rounded.Rounded("div#poptryus","transparent","rgb(212,212,212)","rgb(212,212,212)","small");
//sre_rounded.Rounded("div#popout","transparent","transparent","transparent","smallss");
}
};
*/
/* -----------------------END(sre_pop_msg)---------------------------------- */


/* ---------------------Begin(sre_dialog)---------------------------------- *\
 * eMiliue v1.0 Copyright (c) 2010 Sreejon LLC 
 * Contact us at sreejon2006@msn.com
 * This copyright notice MUST stay intact for use.
 *
 * $Revision: 1.0 $

Dependency :	[Meant to work with Sreejon message structure ]
				No individual controls for popup must exist

Description :	All screen dialogs like tooltip, error, heading etc  

Usage: Simple function call

\* ---------------------------------------------------------------------- */




function genericBodyLoad(){
	//srehlp = new sre_helpbar.Settings();
	//sre_helpbar.initHelp ("hlpid",srehlp,"getHelpData");

	//sre_menu_slider.init('slide_menu','sre_slide');
	//setTimeout("sredisableBackButton()", 0);
	//history.navigationMode = 'compatible';
	//opera.setOverrideHistoryNavigationMode('compatible');
	//window.onbeforeunload = srewindowClosed;
}
function genericPageTitle(cont){
	vv = document.getElementById(cont);
	var html='';
	html += "&nbsp;&nbsp;"+PageTitle;
	vv.innerHTML = html;
}
/*********** obsolete ***** call goOptions instead *******************/

function showHandyMenu(arr){
	var srehandy = new sre_menu.Settings();
	srehandy.MenuHeight = "350px";
	srehandy.MenuNoChld = 'menureg';
	srehandy.MenuChld = 'menureg';
	srehandy.MenuWidth = 350;
	srehandy.MenuHvr = 'menuhov';
	srehandy.PageName = SRESelectedPage;
	srehandy.addMenuArray(arr);
	sre_menu.display("sre_leftpanelhandy",'sreHandy',srehandy);  // second param is the menu name
}

function showMandatory(){
	html ='';
	vv = document.getElementById("sre_showmandatory");
//	html+= '<table border="0"><tr><td>';
	html+= '<span class="dropsmall" >&nbsp;';
	html+= 'Fields marked </span>';
	html+= '<img src="../../../EN/SRESYS/Pic/commonstyle/requiredBang.gif" height="6" width="6"></img>';
	html+= '<span class="dropsmall">&nbsp;';
	html+= 'are mandatory</span><br>';
//	html+= '</td></tr></table>';
	vv.innerHTML = html;
}
function buttonHover(tooltipid,id,e) {
	nm='bt_'+id;
	//alert(e);
	p=window.parent;
	if ((p) ){
		p.showToolTip(tooltipid,e,nm);
	} else {
		showToolTip(tooltipid,e,nm);
	}
	$("bt_"+id).className="actbttonhov";

}
function buttonHoverOut(id) {
	$("bt_"+id).className="actbtton";
	hideToolTip();
}

function addActionButton(type,display,name,value,onclk,tooltip)
{
	bhtml ='';
	if(display=="BUTTON") {
		if(type=="SUBMIT") {
			bhtml+= '&nbsp;<input id="bt_'+name+'" type="SUBMIT"  class="actbtton" style="background-color:transparent;" name="';
			bhtml+= name;
			bhtml+= '" value="';
			bhtml+= value;
			bhtml+= '" onclick="';
			bhtml+= onclk;
			bhtml+= '()" onmouseover="buttonHover(\'';
			bhtml+= tooltip;
			bhtml+= '\',\''+name+'\',event)" onmouseout="buttonHoverOut(\''+name+'\')" onfocus="SREActionFocus=\'bt_'+name+'\'"></input>';
		} else if(type=="BUTTON"){
			bhtml+= '&nbsp;<input id="bt_'+name+'" type="BUTTON" class="actbtton" style="background-color:transparent;" name="';
			bhtml+= name;
			bhtml+= '" value="';
			bhtml+= value;
			bhtml+= '" onclick="';
			bhtml+= onclk;
			bhtml+= '()" onmouseover="buttonHover(\'';
			bhtml+= tooltip;
			bhtml+= '\',\''+name+'\',event)" onmouseout="buttonHoverOut(\''+name+'\')" onfocus="SREActionFocus=\'bt_'+name+'\'"></input>';
		}else if(type=="IMAGE"){
			bhtml+= '&nbsp;<img id="bt_'+name+'" type="BUTTON"  style="background-color:transparent;;border-bottom:1px solid black; border-right:1px solid black;" name="';
			bhtml+= name;
			bhtml+= '" src="';
			bhtml+= value;
			bhtml+= '" onclick="';
			bhtml+= onclk;
			bhtml+= '()" onmouseover="buttonHover(\'';
			bhtml+= tooltip;
			bhtml+= '\',\''+name+'\',event)" height="20" onmouseout="buttonHoverOut(\''+name+'\')" onfocus="SREActionFocus=\'bt_'+name+'\'"></img>';
		}
	} else if (display=="LINK") {
			bhtml+= '&nbsp;<span id="bt_'+name+'" class="actbtton" style="cursor:pointer;background-color:transparent;font-size:12px;" onclick="';
			bhtml+= onclk;
			bhtml+= '()" onmouseover="buttonHover(\'';
			bhtml+= tooltip;
			bhtml+= '\',\''+name+'\',event)" onmouseout="buttonHoverOut(\''+name+'\')" onfocus="SREActionFocus=\'bt_'+name+'\'">';
			bhtml+= value;
			bhtml+= '</span>';
	}
	return bhtml;
}
function displayActionButton(html,cont) {
	bhtml='';
	bhtml+= '<div id="sre_action_range">'
	bhtml+= '<table border="0" width="100%" style="border-collapse:collapse;background-color:transparent;"><tr><td align="right">'
	bhtml+= html;
	bhtml+= '</td><td width="20"></td></tr>';
	bhtml+= '<tr><td height="18" colspan="2"></td></tr>';

	bhtml+= '</table>';
	bhtml+= '</div>'
	vv = document.getElementById(cont);
	vv.innerHTML = bhtml;
//	sre_rounded.Rounded("div#sre_action_range","transparent","rgb(213,222,236)","rgb(213,222,236)","small");
}

var sre_droppage = {
	Settings: function() {
		this.ButtonId;
		this.FuncName = '';
		this.DivId=0;
		this.PageName;
		this.timer=0;
		this.timeout	= 500;
		this.closetimer	= 0;
	},
	config: new Array(),
	setSettings: function(n, settings) {
		if(typeof(settings) != "object") {
			this.config[n] = new this.Settings();
		}
		else {
			this.config[n] = settings;
		}
	},
	drawDroppage: function (cont,num,settings,func){
		this.setSettings(num,settings);
		this.config[num].DivId = cont;
		this.config[num].FuncName = func;
		eval(func+ "('"+cont +"')");
		pc =$(cont);
		pc.style.backgroundColor='#EAEBD8';
		pc.style.visibility = 'visible';
	},
	closeDroppage: function (num,settings){
		
		this.setSettings(num,settings);
		dv = $(this.config[num].DivId);
		if(dv) {
			dv.style.visibility = 'hidden';
		}
	},
	closetime: function (num,settings){
		this.setSettings(num,settings);
		this.config[num].closetimer = window.setTimeout(function(){sre_droppage.closeDroppage(num,settings)}, this.config[num].timeout);
	},
	cancelclosetime: function (num,settings){
		this.setSettings(num,settings);
		if(this.config[num].closetimer)	{
			window.clearTimeout(this.config[num].closetimer);
			this.config[num].closetimer = null;
		}
	}	
};


var almDt = new sre_calendar.Settings();
almDt.PageName='SRESelectedPage';

var hrs = new sre_menu.Settings();
hrs.MenuWidth = "60px";
hrs.MenuHeight = "50px";
hrs.PageName = 'index';
var hrsList = new Array();
hrsList[0] ="0|-1|0| ";
hrsList[1] ="1|-1|1| ";
hrsList[2] ="0|-1|2| ";
hrsList[3] ="1|-1|3| ";
hrsList[4] ="0|-1|4| ";
hrsList[5] ="1|-1|5| ";
hrsList[6] ="0|-1|6| ";
hrsList[7] ="1|-1|7| ";
hrsList[8] ="0|-1|8| ";
hrsList[9] ="1|-1|9| ";
hrsList[10] ="0|-1|10| ";
hrsList[11] ="1|-1|11| ";
hrs.addMenuArray(hrsList);

var mint = new sre_menu.Settings();
mint.MenuWidth = "60px";
mint.MenuHeight = "50px";
mint.PageName = 'index';
var mintList = new Array();
mintList[0] ="00|-1|:00| ";
mintList[1] ="15|-1|:15| ";
mintList[2] ="30|-1|:30| ";
mintList[3] ="45|-1|:45| ";
mint.addMenuArray(mintList);

var ampm = new sre_menu.Settings();
ampm.MenuWidth = "60px";
ampm.MenuHeight = "50px";
ampm.PageName = 'index';
var ampmList = new Array();
ampmList[0] ="AM|-1|am| ";
ampmList[1] ="PM|-1|pm| ";
ampm.addMenuArray(ampmList);
alrmDT='';alrmHR='';alrmMN='';alrmAP='';
	var alrm = new Array();
	alrm[0] = "Date|TEXT|E|alrmDT|20|40|N|CLDR_almDt|N| ";
	alrm[1] = "Hour|TEXT|E|alrmHR|20|40|N|MENU_hrs|N| ";
	alrm[2] = "Minute|TEXT|E|alrmMN|8|8|N|MENU_mint|N| ";
	alrm[3] = "AM / PM|TEXT|E|alrmAP|5|5|N|MENU_ampm|N| ";

function sreSetAlarm(cont){

	h='';
	h +='<table border="1" cellpadding="0" cellspacing="0">';
	h +='<tr>';
	h +='<td ><div id="curralarm"></div></td>';
	h +='</tr>';
	h +='<tr>';
	h +='<td ><div><div id="newAlerm"></div></div></td>';
	h +='</tr>';
	h +='<tr>';
	h +='<td ><div id="alarmbut"></div></td>';
	h +='</tr>';
	h +='</table>';
	v= $(cont);
	v.innerHTML = h;
htm='';

	alrmins = new sre_dynform.Settings();
	alrmins.fromName=SRESelectedPage;
	alrmins.divName="newAlerm";
	alrmins.addDynArray(alrm);
	sre_dynform.dynForm ("newAlerm",alrmins);
	
	pg1=SRESelectedPage +'_alrmDT_dv'; sre_calendar.displayHyper(pg1,'alrmDT',almDt);
	pg2=SRESelectedPage +'_alrmHR_dv';sre_menu.displayHyper(pg2,'alrmHR',hrs);
	pg3=SRESelectedPage +'_alrmMN_dv';sre_menu.displayHyper(pg3,'alrmMN',mint);
	pg4=SRESelectedPage +'_alrmAP_dv';sre_menu.displayHyper(pg4,'alrmAP',ampm);

	//		
		htm +=addActionButton('BUTTON','BUTTON','SRE_SETALARM','Set Alarm','SETAlarm','AUTH_00001');
		displayActionButton(htm,"alarmbut"); 



}
function SETAlarm(){
	alert("SETAlarm");
}
function GetLocTime(){
	d = new Date();
	var hr = d.getHours();
	var ap ="am";
	if(hr >= 12) {
		ap ="pm";	
		hr -=12;
	}
	var min = d.getMinutes();
	if(min < 10) {
		min = "0" + min;
	}
	var dt = d.getDate();
		var mn = d.getMonth();
		var yr = d.getFullYear();
		var dy = d.getDay();
	if (hr== '0'){
		hr = '12';		
	}
	vp = document.getElementById("sre_clock");
	var html='';
	html +='<table  border="0" >';
	html +='<tr><td align="right">';
	html +='<span  class="clock"  >';
	html += '&nbsp;';
	html += sremonth[mn];
	html += '&nbsp;';
	html += dt;
	html += ',&nbsp;';
	html += yr;
	html += '&nbsp;&nbsp;';
	html += sreday[dy];
	html += '&nbsp;&nbsp;';
	html += hr;
	html += ':';
	html += min;
	html += '&nbsp;';
	html += ap;
	html += '&nbsp;&nbsp;';
	//html += '<div id="port_clk" onmouseover="cancelclosetime()" onmouseout="closetime()" style="z-index: 30;position: absolute;display:visibility:hidden; block;margin: 0;padding: 5px 10px;width: auto;white-space: nowrap;text-align: left;text-decoration: none;background:transparent;color:rgb(0,0,128);font: 11px arial"></div>';
	html +='</span>';
	html +='</td></table>';
	vp.innerHTML = html;
	window.setTimeout("GetLocTime()",clockTime,"JavaScript");
}
function showDidYouKnow(pagetype){
	Page='';
	Page +='<pagetype>'+pagetype+'</pagetype>'; //P for public S for securec - also I for inactive
	Page +='<language>EN</language>'; //P for public S for securec - also I for inactive
	var redirecturl = "/srp/srp_system/sub/sub_didyouknow.srp";
	srePHPAsyncSubmit(Page,redirecturl,didYouKnowFetched,true,'SRE_DID_YOU_KNOW','N');
}
function didYouKnowFetched(response,obj,id){
	htmld='';
	diyouknowmsg = sre_ajax.parseAsyncNameValueResponse(response,'didyouknowtext','|',0);
	htmld +='<table border="0" cellpadding="0" cellspacing="0" width="100%">';
	htmld +='<tr>';
	htmld +='<td width="20"></td><td>';
//	htmld +=sre_core.trim(diyouknowmsg);

	htmld +='<table border="0" cellpadding="0" cellspacing="0" width="175" height="100%" >';
	htmld +='<tr>';
	htmld +='<td class="blkBigHeader">';
	htmld +='Did you know ?';
	htmld +='</td>';
	htmld +='</tr>';
	htmld +='<tr>';
	htmld +='<td  style="background-color:rgb(112,146,190);padding-left:4;padding-right:4;height:1;">';
	htmld +='</td>';
	htmld +='</tr>';
	htmld +='<tr>';
	htmld +='<td  class="blkBig">';
//	htmld +='<div id="sre_leftpanel">';
htmld +=sre_core.trim(diyouknowmsg);
	htmld +='</div>';
	htmld +='</td>';
	htmld +='</tr>';
	htmld +='</table>';


	htmld +='</td><td width="20"></td>';
	htmld +='</tr>';
	htmld +='</table>';
//	$("right_panel_body").innerHTML = htmld;
}
function pausecomp(millis)
 {
  var date = new Date();
  var curDate = null;
  do { curDate = new Date(); }
  while(curDate-date < millis);
}
function showToolTipEx(key,objid,e){
	Page='';
	
//	v=$(objid); 
//	if(v) {	//pos	= getElePos(objid,e,100);
//		left_s = e.clientX;
//		top_s = e.clientY +15;
//		sre_v = document.getElementById("SRE_ToolTip");
//		sre_v.style.top= top_s;
//		sre_v.style.left= left_s;
//		//alert(sre_v.style.left +'----'+sre_v.style.top);
//	}
		if(objid){
			Page +='<objid>'+objid+'</objid>';
		}
		Page +='<locale>'+SRELocale+'</locale>';
		Page +='<tooltipkey>'+key+'</tooltipkey>';
		var redirecturl = "/srp/srp_system/sub/sub_sretooltip.srp";
	/*   temporarily disabled ************* */
//	 	srePHPAsyncSubmit(Page,redirecturl,toolTipFetched,true,"SRE_TOOL_TIP",'N');
	
}
function toolTipFetched(response,obj,id){
	/*   temporarily disabled ************* */
	tooltipMsg = sre_ajax.parseAsyncNameValueResponse(response,'tooltipMsg','|',0);
	objid = sre_ajax.parseAsyncNameValueResponse(response,'objid','|',0);
	showToolTip(tooltipMsg);
	
}
function showToolTipMenu(key,e,objid){
	var sre_vl = document.getElementById("sre_localtooltip");
	sre_vl.innerHTML = "&nbsp;";
	var tiphtml ='';thtml='';
	tiphtml += sre_core.urlClean(key);
	if(tiphtml !='') {
		if(sre_vl){
		thtml+='<table border="0" cellpadding="0" cellspacing="0" width="100%"  style="background-color:aaaaaa">';
			thtml+='<tr>';
				thtml+='<td >';
		thtml+='<table border="0" cellpadding="0" cellspacing="0" width="100%"  style="background-color:ffffff">';
			thtml+='<tr>';
				thtml+='<td class="labelsmall">';
					thtml+=tiphtml +'&nbsp;';
				thtml+='</td>';
			thtml+='</tr>';
		thtml+='</table>';
				thtml+='</td>';
			thtml+='</tr>';
		thtml+='</table>';

			
			sre_vl.innerHTML = thtml;//tiphtml +'&nbsp;';
			window.setTimeout("hideToolTip();", 2000, "JavaScript");;
		}
	} else {
		sre_vl.innerHTML = "&nbsp;";
	}
}
function showParentToolTip(key,e,objid){
	/*   temporarily disabled ************* */
	p=window.parent;
	p.showToolTip(key,e,objid);
	//sre_v=null;
}
function showToolTip(key,e,objid){
	/*   temporarily disabled ************* */
	var sre_v = document.getElementById("SRE_ToolTip");
	
	sre_v.innerHTML = "&nbsp;";
	v=$(objid); 
	pos = getElePos(objid,e,300,10);
	//alert(e);
	if(v) {	//pos	= getElePos(objid,e,100);
	
		//left_s = e.clientX;
		//top_s = e.clientY +15;
		sre_v.style.top= pos[1] + 20;//top_s ;
		sre_v.style.left= pos[0];//left_s ;
		//alert(sre_v.style.left +'----'+sre_v.style.top);
	//alert(pos);
	}
	//pausecomp(1500);
	//sre_Sleep(2);
	/*   temporarily disabled ************* */
	//ttptimer = window.setTimeout("toolTip(\'"+key+"\',\'"+objid+"\');", 3500, "JavaScript");
	toolTip(key,objid);
}
function toolTip(key,objid){
	/*   temporarily disabled ************* */
	var tiphtml ='';thtml='';
	var sre_v = document.getElementById("SRE_ToolTip");
	
	tiphtml += sre_core.urlClean(key);
	key=null;
	if(tiphtml !='') {
		
		if(sre_v){
	//	thtml+='<table border="0" cellpadding="1" cellspacing="0" width="100%"  style="background-color:#000000">';
	//		thtml+='<tr>';
	//			thtml+='<td >';
	//	thtml+='<table border="0" cellpadding="0" cellspacing="0" width="100%" >';
	//		thtml+='<tr>';
	//			thtml+='<td >';
					thtml+=tiphtml +'&nbsp;';
	//			thtml+='</td>';
	//		thtml+='</tr>';
	//	thtml+='</table>';

	//			thtml+='</td>';
	//		thtml+='</tr>';
	//	thtml+='</table>';

			
			sre_v.innerHTML = thtml;//tiphtml +'&nbsp;';
			window.setTimeout("hideToolTip();", 2500, "JavaScript");;
			//sre_v.innerHTML = "&nbsp;";
		}
	} else {
		sre_v.innerHTML = "&nbsp;";
	}
	
}
function hideToolTip(){
	/*   temporarily disabled ************* */
	sre_v = document.getElementById("SRE_ToolTip");
	if(sre_v){
		sre_v.innerHTML = "&nbsp;";
	}
	sre_vl = document.getElementById("sre_localtooltip");
	if(sre_vl){
		sre_vl.innerHTML = "&nbsp;";
	}
	//sre_v=null;
}
function hideParentToolTip(){
	/*   temporarily disabled ************* */
	p=window.parent;
	p.hideToolTip();
	//sre_v=null;
}
function setDictError(errornum){
	SREErrorString +=errornum;
	SREErrorString +='|';
	//alert(SREErrorString);
	ERR_Search(SRELocale,SREErrorString,SREErrorString);
	
}
/*************************************
Following functions will set table based multilingual error messages  - [USE for table based multilingual support] 
Asynchronous function calls are made to the table. Needs the system/sre_error table to work.
Also need sub_sre_error.srp
*************************************/
var SRE_errorstr;
var SRE_errcnt=0;
function ERR_Search(locale,errorcode,erstr)
{
	//alert(errorcode);
	Page='';
	SRE_errorstr = erstr;
		Page +='<locale>'+locale+'</locale>';
		Page +='<errorcode>'+errorcode+'</errorcode>';
		Page +='<session>'+SRESession+'</session>';
		var redirecturl = "/srp/srp_system/sub/sub_sreerror.srp";
		srePHPAsyncSubmit(Page,redirecturl,SREErrorFetched,true,'SRE_ERR');
}
function SREErrorFetched(response,obj,id){
	errorCount=sre_ajax.parseAsyncNameValueResponse(response,'errorCount','|',0);
	//alert(errorCount);
	intval = parseInt(errorCount);
	SRE_errcnt = intval
	//alert(intval);
	if (intval) {
		for (mm=0; mm < intval;mm++) { 
			errorType=sre_ajax.parseAsyncNameValueResponse(response,'errorType','|',mm);
			errorMsg=sre_ajax.parseAsyncNameValueResponse(response,'errorMsg','|',mm);
			erindx = setErrorMsg(SRE_errorstr,errorMsg,errorType,mm);
			
			setError();
		}
	}
}
function errorPopbox(){
	epop = new sre_pop_msg.Settings();
	epop.setHeader("eMilieu error");
	epop.noHeader=1;
	epop.PageName = SRESelectedPage;  //---MUST HAVE parameters
	epop.popWidth = 500; //--- Mandatory set up
	epop.fixHeight = 0; //--- Mandatory set up 	
	sre_pop_msg.msgPop ("sre_tpop",epop,"errpup");	
}
function errpup(){
	html='';
	html+='<table border="0" width="500"  cellpadding="0" cellspacing="0" >';
	html+='<tr><td align="center" valign="top">';
	html+='<span nowrap class="blkBig" style="font-weight:bold;">';
	html+=SREFormatErrorString;
	
	html+='</span></td></tr>';
	html+='</table>';	
	return html;
}
function setErrorMsg(errstr, newstr, newlevel,indx){
	dumpStr ="";
	if(newlevel =='1') { /*warning*/
		dumpStr += ' |<span class="blkSmall" style="color:rgb(128,128,0);text-align:left;padding-left:0;" >';
		dumpStr += newstr;
		dumpStr += '</span>|';
		dumpStr += '../../../EN/SRESYS/Pic/commonstyle/warning.gif';
	} 
	if(newlevel =='2') { /*info*/
		dumpStr += ' |<span class="blkSmall" style="color:rgb(0,64,128);text-align:left;padding-left:0;" >';
		dumpStr += newstr;
		dumpStr += '</span>|';
		dumpStr += '../../../EN/SRESYS/Pic/commonstyle/info.gif';
	} 
	if(newlevel =='-1') { /*error */
		dumpStr += ' |<span class="blkSmall" style="color:#ff3365;text-align:left;padding-left:0;" >';
		dumpStr += newstr;
		dumpStr += '</span>|';
		dumpStr += '../../../EN/SRESYS/Pic/commonstyle/Error.gif';
	}
	SREErrorArr[indx] =dumpStr;
	indx++;
	SREErrorString +=errstr;
	return indx;
}
function clearError(){
SREErrorString ='';
sre_core.initializeList(SREErrorArr);
if($("SRError")) $("SRError").innerHTML='';

}
function closeErrorPopup(){
	clearError();
	sre_pop_msg.msgClose("sre_tpop","SRE_CANCEL");
}
function setError(){
	var errhtml=''; var stop =0;
	var err;
	var Words = new Array();
	err = document.getElementById("SRError");
	errhtml +='<table width="100%" border="0" >';

	if(SREErrorArr !='undefined'){
		
		if(SREErrorArr.length > 0) {
			stop = 1;
		}
		for(x=0;x < SREErrorArr.length;x++){
			sre_core.breakWords(SREErrorArr[x],Words);
			errhtml +='<tr><td width="25">';
			errhtml +='<img src="'+Words[2]+'" height="16" width="16"> </img>';
			errhtml +='</td><td>';
			errhtml += Words[1];
			errhtml +='</td></tr>';
		}
		errhtml +='</table>';
		//curhtml = err.innerHTML;
		SREFormatErrorString = errhtml;
		errorPopbox();
		interval = (parseInt(SRE_errcnt) * 2000);
	
		window.setTimeout("closeErrorPopup();", interval, "JavaScript");
		//err.innerHTML = errhtml;
	}
	SREErrorString='';
	
	return stop;
}
/********************************************************
 *    confirmPopbox(1,'Header|someid|This is some test message'); //0: only ok 1: ok and cancel 2: yes no
 *	confirmPopbox(1,'eMilieu Test|someid|This is some test message');

 *
 ********************************************************/
function confirmPopbox(flag,msg){
	cpop = new sre_pop_msg.Settings();
	//cpop.setHeader(header);
	cpop.noHeader=1;
	cpop.PageName = SRESelectedPage;  //---MUST HAVE parameters
	cpop.popWidth = 500; //--- Mandatory set up
	cpop.fixHeight = 0; //--- Mandatory set up
	if(flag==1) { //ok and cancel
		sre_pop_msg.msgPop ("sre_cpop",cpop,"confokcancel",0,msg);		
	} else if(flag==0) { // just ok
		sre_pop_msg.msgPop ("sre_cpop",cpop,"confok",0,msg);		
	} else if(flag==2) { // just ok
		sre_pop_msg.msgPop ("sre_cpop",cpop,"confyesno",0,msg);		
	}
	
}
//msgPop: function (num,settings,popfunc,noeval,param);

	
function confokcancel(){
	html='';
	v= $("SRE_REQUEST_sre_cpop");
	if(v) {
		wordmsg=new Array();
		wrd=v.value; 
		sre_core.breakWords(wrd,wordmsg); header=wordmsg[0];ids=wordmsg[1];
		msg = wordmsg[2];
		html+='<table border="0" width="500"  cellpadding="0" cellspacing="0" class="sre_backconfirm" >';
		html+='<tr><td colspan="3" height="25" align="center" class="hTabsel"><span class="formctl" style="padding-left:10;font-weight:bold;">';
		html+=header;
		html+='</span></td></tr>';		
		
		html+='<tr><td colspan="3" align="center" valign="top">';
		html+='<span nowrap class="formctlRev" style="font-weight:bold;">';
		html+='<img src="../../../EN/SRESYS/Pic/commonstyle/help-3.png" height="20"></img>&nbsp;&nbsp;';
		html+=msg;
		html+='</span></td></tr>';
		html+='<tr><td colspan="3" height="10">';
		html+='</td></tr>';		
		html+='<tr>';
		html+='<td width="48%" colspan="1" align="right" valign="top"><span class="actbttonconfirm" onclick="sendConfirmation(\''+ids+'\',\'1\')">Ok';
		html+='</span></td>';
		html+='<td width="4%"><span>';
		html+='</span></td>';	
		html+='<td width="48%" colspan="1" align="left" valign="top"><span class="actbttonconfirm" onclick="sendConfirmation(\''+ids+'\',\'0\')">Cancel';
		html+='</span></td>';
		html+='</tr>';
		html+='<tr><td colspan="3" height="10">';
		html+='</td></tr>';		
		
		html+='</table>';
	}
	return html;
}
function confok(){
	html='';
	v= $("SRE_REQUEST_sre_cpop");
	if(v) {
		wordmsg=new Array();
		wrd=v.value; 
		sre_core.breakWords(wrd,wordmsg); header=wordmsg[0];ids=wordmsg[1];
		msg = wordmsg[2];
		html+='<table border="0" width="500"  cellpadding="0" cellspacing="0" class="sre_backconfirm" >';
		html+='<tr><td colspan="3" height="25" align="center" class="sidemenuSel"><span class="formctl" style="padding-left:10;font-weight:bold;">';
		html+=header;
		html+='</span></td></tr>';
		html+='<tr><td align="center" valign="top">';
		html+='<span nowrap class="formctlRev" style="font-weight:bold;">';
		html+='<img src="../../../EN/SRESYS/Pic/commonstyle/help-about-3.png" height="30"></img>&nbsp;&nbsp;';
		html+=msg;
		html+='</span></td></tr>';
		html+='<tr><td colspan="3" height="10">';
		html+='</td></tr>';
		html+='<tr><td colspan="3" align="center" valign="top"><span class="actbttonconfirm" onclick="sendConfirmation(\''+ids+'\',\'1\')">Acknowledge';
		html+='</span></td></tr>';
		html+='<tr><td colspan="3" height="10">';
		html+='</td></tr>';		
		
		html+='</table>';
	}
	return html;
}
function confyesno(){
	html='';
	v= $("SRE_REQUEST_sre_cpop");
	if(v) {
		wordmsg=new Array();
		wrd=v.value; 
		sre_core.breakWords(wrd,wordmsg); header=wordmsg[0];ids=wordmsg[1];
		msg = wordmsg[2];
		html+='<table border="0" width="500"  cellpadding="0" cellspacing="0"  >';
		html+='<tr><td colspan="5" height="25" align="center" class="menubackgr"><span  style="padding-left:10;font-weight:bold;">';
		html+=header;
		html+='</span></td></tr>';		
		html+='<tr><td colspan="5" height="10">';
		html+='</td></tr>';
		html+='<tr><td colspan="1" align="center" valign="top" width="30">';
		html+='<img src="../../../EN/SRESYS/Pic/commonstyle/help-3.png" height="20"></img>&nbsp;&nbsp;';
		html+='</td><td colspan="4">';
		html+='<span nowrap class="formctlRev" style="font-weight:bold;">';
		html+=msg;
		html+='</span></td></tr>';
		html+='<tr><td colspan="5" height="10">';
		html+='</td></tr>';		
		html+='<tr>';
		html+='<td colspan="2"></td>'
		html+='<td width="30" colspan="1" align="right" valign="top"><span class="actbttonconfirm" onclick="sendConfirmation(\''+ids+'\',\'1\')">Yes';
		html+='</span></td>';
		html+='<td width="10"><span>';
		html+='</span></td>';	
		html+='<td width="30" colspan="1" align="left" valign="top"><span class="actbttonconfirm" onclick="sendConfirmation(\''+ids+'\',\'0\')">No';
		html+='</span></td>';
		html+='</tr>';
		html+='<tr><td colspan="5" height="10">';
		html+='</td></tr>';		
		
		html+='</table>';
	}
	return html;
}
function sendConfirmation(num,status){
	sre_pop_msg.msgClose("sre_cpop",status,num);
}
//sre_GetKey(); /* do not delete - move to base load*/


function	sresetAttribute   (node, attr, value) {
		if(value == null || node == null || attr == null) return;
		if(attr.toLowerCase() == "style") {
			this.setStyleAttribute(node, value);
		}
		else {
			node.setAttribute(attr, value);
		}
	}
	/*
function	sregetAttribute   (node, attr) {
		if(value == null || node == null || attr == null) return;
		if(attr.toLowerCase() == "style") {
			this.setStyleAttribute(node, value);
		}
		else {
			node.getAttribute(attr, value);
		}
	}
	*/
	/*
	   var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
	*/
/*	
function	includeJS(file) {
		var script = document.createElement("script");
		sresetAttribute(script, "type", "text/javascript");
		sresetAttribute(script, "src", file);
		var heads = document.getElementsByTagName("head");
		//alert(script.src);
		for(var i=0;i<heads.length;i++) {
			heads[i].appendChild(script);		
		}
	}
*/	
/*   event handler for js include (in case it is loaded async)
      var head= document.getElementsByTagName('head')[0];
   var script= document.createElement('script');
   script.type= 'text/javascript';
   script.onreadystatechange= function () {
      if ((this.readyState == 'complete') || (this.readyState == 'loaded')) {
	helper();
	}//call function when load is complete
	//+++ MAKE SURE EVENT DOES NOT TRIGGER TWICE BECAUSE OF OR STATEMENT
   }
   script.onload= helper; //other event handler, depending on browser
   script.src= 'helper.js';
   head.appendChild(script);
*/
//alert("control reached");
function testEmbedFunc(vendid,value){
	alert("test function finally called with : " + value + "-----"+vendid);
}
function loadjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file
  var fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript")
  fileref.setAttribute("src", filename)
 }
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
 }
 if (typeof fileref!="undefined")
  document.getElementsByTagName("head")[0].appendChild(fileref)
}

//loadjscssfile("myscript.js", "js") //dynamically load and add this .js file
//loadjscssfile("javascript.php", "js") //dynamically load "javascript.php" as a JavaScript file
//loadjscssfile("mystyle.css", "css") ////dynamically load and add this .css file


function removejscssfile(filename, filetype){
 var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist from
 var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none" //determine corresponding attribute to test for
 var allsuspects=document.getElementsByTagName(targetelement)
 for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove
  if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(filename)!=-1)
   allsuspects[i].parentNode.removeChild(allsuspects[i]) //remove element by calling parentNode.removeChild()
 }
}
//removejscssfile("somescript.js", "js") //remove all occurences of "somescript.js" on page
//removejscssfile("somestyle.css", "css") //remove all occurences "somestyle.css" on page

function createjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file
  var fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript")
  fileref.setAttribute("src", filename)
 }
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
 }
 return fileref
}
// replace works for IE7 . remove may not immidiately. Javascript stays in memory.
function replacejscssfile(oldfilename, newfilename, filetype){
 var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist using
 var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none" //determine corresponding attribute to test for
 var allsuspects=document.getElementsByTagName(targetelement)
 for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove
  if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(oldfilename)!=-1){
   var newelement=createjscssfile(newfilename, filetype)
   allsuspects[i].parentNode.replaceChild(newelement, allsuspects[i])
  }
 }
}

/* ---------------------Begin(sre_scroll)---------------------------------- *\
  \* ---------------------------------------------------------------------- */
 /********************************************************************
 *                                         				*
 *   version:  2.1                         				*
 *   author:   gondo                       				*
 *   email:    gondo@webdesigners.sk       				*
 *   wep-page: http://gondo.webdesigners.sk/javascript-scrollbar/   	*
 *				                                         *
 ********************************************************************/

/* number of scrolling objects */
document.No = 0;

var isOpera = (window.navigator.userAgent.indexOf("Opera") > -1);

function ScrollLoad (Area, Content, SettingTracSize)
{
    var code = "var scroller" + document.No + " = new dw_scrollObj (Area, Content, Content, Area, document.No);";
    if (SettingTracSize)
        code += "scroller" + document.No + ".setBarSize();";
    eval (code);
    makeMouseWheeleScrolling(Area);
    document.No++;
}

/* <Mouse wheele scrolling> */
var mouseWheelTimer = 0;

function makeMouseWheeleScrolling(objName)
{
    var obj = document.getElementById(objName);

    if (obj.addEventListener)
    {
        obj.addEventListener("DOMMouseScroll", wheel, false);
    }
    obj.onmousewheel = wheel;
}

function moveUp(parent)
{
    dw_scrollObj.initScroll(parent.id, "up");
    clearInterval(mouseWheelTimer);
    mouseWheelTimer = setTimeout("mouseStop('" + parent.id + "');", 200);
}

function moveDown(parent)
{
    dw_scrollObj.initScroll(parent.id, "down");
    clearInterval(mouseWheelTimer);
    mouseWheelTimer = setTimeout("mouseStop('" + parent.id + "');", 200);
}

function mouseStop(parentId)
{
    dw_scrollObj.stopScroll(parentId);
    mouseWheelTimer = 0;
}

/* mouse wheel functions to scroll on mouse wheel efect over object with my js scrollbar */
function handle(delta, parent)
{
    var s = delta + ": ";
    
    if (delta < 0)
    {
		if (isOpera)
	        moveUp(parent);		
		else
	        moveDown(parent);
    }
    else
    {
		if (isOpera)
	        moveDown(parent);
		else
			moveUp(parent);
    }
}

function wheel(event)
{
    var delta = 0;
    if (!event) event = window.event;
    if (event.wheelDelta)
    {
        delta = event.wheelDelta/120; 
        if (window.opera) delta = -delta;
    }
    else if (event.detail)
    {
        delta = -event.detail/3;
    }
    if (delta)
        handle(delta, this);
}
/* </mouse wheele scrolling> */

/**************************************************************************/

dw_scrollObjs = {};

function dw_scrollObj(wnId,lyrId,cntId,area,No){
    dw_scrollObj.speed=100;
    this.id=wnId;
    dw_scrollObjs[this.id]=this;
    this.animString="dw_scrollObjs."+this.id;
    if(!this.write_scroll_bar(wnId,area,cntId,No)) return;
    this.load(lyrId,cntId);
    this.setUpScrollbar("drag_bar" + No, "track" + No, "v", 0, 0);    
};

dw_scrollObj.prototype.write_scroll_bar = function(content,where,text,No){
    where_obj   = document.getElementById(where);
    text_obj    = document.getElementById(text);
    content_obj = document.getElementById(content);
    if(text_obj.offsetHeight <= where_obj.offsetHeight){
        return false;
    }
    content_obj.style.overflow="hidden";
    var content_width = content_obj.offsetWidth;
    where_obj.innerHTML += '<div id="track' + No + '" class="track"><div id="drag_bar' + No + '" class="drag_bar"></div></div>';
    /* set text width */
    var scroll_width = document.getElementById('track' + No).offsetWidth;
    document.getElementById(text).style.width = content_width - scroll_width - 10 + 'px';
    return true;
}

dw_scrollObj.loadLayer = function(wnId,id,cntId){
    if(dw_scrollObjs[wnId])
        dw_scrollObjs[wnId].load(id,cntId);
};

dw_scrollObj.prototype.load = function(lyrId,cntId){
    if(!document.getElementById)
        return;
    var wndo,lyr;
    if(this.lyrId){
        lyr=document.getElementById(this.lyrId);
        lyr.style.visibility="hidden";
    }
    lyr=document.getElementById(lyrId);
    wndo=document.getElementById(this.id);
    lyr.style.top=this.y=0;
    lyr.style.left=this.x=0;
    this.maxY=(lyr.offsetHeight-wndo.offsetHeight>0)?lyr.offsetHeight-wndo.offsetHeight:0;
    this.wd=cntId?document.getElementById(cntId).offsetWidth:lyr.offsetWidth;
    this.maxX=(this.wd-wndo.offsetWidth>0)?this.wd-wndo.offsetWidth:0;
    this.lyrId=lyrId;
    lyr.style.visibility="visible";
    this.on_load();
    this.ready=true;
};

dw_scrollObj.prototype.on_load=function(){};
dw_scrollObj.prototype.shiftTo=function(lyr,x,y){
    if ((!lyr) || (!lyr.style))
        return;
    lyr.style.left=(this.x=x)+"px";
    lyr.style.top=(this.y=y)+"px";
    if(SCROLLPAGE=='PORTAL'){
	POR_SCROLL_PPORTAL(y);
    } else if(SCROLLPAGE=='PROFILE'){
	    POR_SCROLL_PROFILE(y);
    } else if(SCROLLPAGE=='RESUME'){
	    RESUME_SCROLL_PROFILE(y);
    }
};

dw_scrollObj.GeckoTableBugFix=function(){
    var ua=navigator.userAgent;
    if(ua.indexOf("Gecko")>-1&&ua.indexOf("Firefox")==-1&&ua.indexOf("Safari")==-1&&ua.indexOf("Konqueror")==-1){
        dw_scrollObj.hold=[];
        for(var i=0;arguments[i];i++){
            if(dw_scrollObjs[arguments[i]]){
                var wndo=document.getElementById(arguments[i]);
                var holderId=wndo.parentNode.id;
                var holder=document.getElementById(holderId);
                document.body.appendChild(holder.removeChild(wndo));
                wndo.style.zIndex=1000;
                var pos=getPageOffsets(holder);
                wndo.style.left=pos.x+"px";
                wndo.style.top=pos.y+"px";
                dw_scrollObj.hold[i]=[arguments[i],holderId];
            }
        }
        window.addEventListener("resize",dw_scrollObj.rePositionGecko,true);
    }
};

dw_scrollObj.rePositionGecko=function(){
    if(dw_scrollObj.hold){
        for(var i=0;dw_scrollObj.hold[i];i++){
            var wndo=document.getElementById(dw_scrollObj.hold[i][0]);
            var holder=document.getElementById(dw_scrollObj.hold[i][1]);
            var pos=getPageOffsets(holder);
            wndo.style.left=pos.x+"px";
            wndo.style.top=pos.y+"px";
	   // POR_SCROLL_PROFILE(pos.y);
        }
    }
};

function getPageOffsets(el){
    var left=el.offsetLeft;
    var top=el.offsetTop;
    if(el.offsetParent&&el.offsetParent.clientLeft||el.offsetParent.clientTop){
        left+=el.offsetParent.clientLeft;
        top+=el.offsetParent.clientTop;
    }
    while(el=el.offsetParent){
        left+=el.offsetLeft;
        top+=el.offsetTop;
    }
    return{x:left,y:top};
};

dw_scrollObj.stopScroll = function(wnId) {
  if ( dw_scrollObjs[wnId] ) dw_scrollObjs[wnId].endScroll();
}

dw_scrollObj.doubleSpeed = function(wnId) {
  if ( dw_scrollObjs[wnId] ) dw_scrollObjs[wnId].speed *= 2;
}

dw_scrollObj.resetSpeed = function(wnId) {
  if ( dw_scrollObjs[wnId] ) dw_scrollObjs[wnId].speed /= 2;
}

dw_scrollObj.initScroll = function(wnId, deg, sp) {
  if ( dw_scrollObjs[wnId] ) {
    var cosine, sine;
    if (typeof deg == "string") {
      switch (deg) {
        case "up"    : deg = 90;  break;
        case "down"  : deg = 270; break;
        case "left"  : deg = 180; break;
        case "right" : deg = 0;   break;
        default: return;
       }
    } 
    deg = deg % 360;
    if (deg % 90 == 0) {
      cosine = (deg == 0)? -1: (deg == 180)? 1: 0;
      sine = (deg == 90)? 1: (deg == 270)? -1: 0;
    } else {
      var angle = deg * Math.PI/180;
      cosine = -Math.cos(angle); sine = Math.sin(angle);
    }
    dw_scrollObjs[wnId].fx = cosine / ( Math.abs(cosine) + Math.abs(sine) );
    dw_scrollObjs[wnId].fy = sine / ( Math.abs(cosine) + Math.abs(sine) );
    dw_scrollObjs[wnId].endX = (deg == 90 || deg == 270)? dw_scrollObjs[wnId].x:
      (deg < 90 || deg > 270)? -dw_scrollObjs[wnId].maxX: 0; 
    dw_scrollObjs[wnId].endY = (deg == 0 || deg == 180)? dw_scrollObjs[wnId].y: 
      (deg < 180)? 0: -dw_scrollObjs[wnId].maxY;
    dw_scrollObjs[wnId].startScroll(sp);
  }
}

dw_scrollObj.prototype.startScroll = function(speed) {
  if (!this.ready) return; if (this.timerId) clearInterval(this.timerId);
  this.speed = speed || dw_scrollObj.speed;
  this.lyr = document.getElementById(this.lyrId);
  this.lastTime = ( new Date() ).getTime();
  this.on_scroll_start();  
  this.timerId = setInterval(this.animString + ".scroll()", 10); 
}

dw_scrollObj.prototype.scroll = function() {
  var now = ( new Date() ).getTime();
  var d = (now - this.lastTime)/1000 * this.speed;
  if (d > 0) {
    var x = this.x + this.fx * d; var y = this.y + this.fy * d;
    if (this.fx == 0 || this.fy == 0) {
      if ( ( this.fx == -1 && x > -this.maxX ) || ( this.fx == 1 && x < 0 ) || 
        ( this.fy == -1 && y > -this.maxY ) || ( this.fy == 1 && y < 0 ) ) {
        this.lastTime = now;
        this.shiftTo(this.lyr, x, y);
        this.on_scroll(x, y);
	
      } else {
        clearInterval(this.timerId); this.timerId = 0;
        this.shiftTo(this.lyr, this.endX, this.endY);
        this.on_scroll_end(this.endX, this.endY);
      }
    } else {
      if ( ( this.fx < 0 && x >= -this.maxX && this.fy < 0 && y >= -this.maxY ) ||
        ( this.fx > 0 && x <= 0 && this.fy > 0 && y <= 0 ) ||
        ( this.fx < 0 && x >= -this.maxX && this.fy > 0 && y <= 0 ) ||
        ( this.fx > 0 && x <= 0 && this.fy < 0 && y >= -this.maxY ) ) {
        this.lastTime = now;
        this.shiftTo(this.lyr, x, y);
        this.on_scroll(x, y);
	
      } else {
        clearInterval(this.timerId); this.timerId = 0;
        this.on_scroll_end(this.x, this.y);
      }
    }
  }
}

dw_scrollObj.prototype.endScroll = function() {
  if (!this.ready) return;
  if (this.timerId) clearInterval(this.timerId);
  this.timerId = 0;  this.lyr = null;
}

dw_scrollObj.prototype.on_scroll = function() {}
dw_scrollObj.prototype.on_scroll_start = function() {}
dw_scrollObj.prototype.on_scroll_end = function() {}
  
dw_scrollObj.slideDur = 500;

dw_scrollObj.scrollBy = function(wnId, x, y, dur) {
  if ( dw_scrollObjs[wnId] ) dw_scrollObjs[wnId].glideBy(x, y, dur);
}

dw_scrollObj.scrollTo = function(wnId, x, y, dur) {
  if ( dw_scrollObjs[wnId] ) dw_scrollObjs[wnId].glideTo(x, y, dur);
}

dw_scrollObj.prototype.glideBy = function(dx, dy, dur) {
  if ( !document.getElementById || this.sliding ) return;
  this.slideDur = dur || dw_scrollObj.slideDur;
  this.destX = this.destY = this.distX = this.distY = 0;
  this.lyr = document.getElementById(this.lyrId);
  this.startX = this.x; this.startY = this.y;
  if (dy < 0) this.distY = (this.startY + dy >= -this.maxY)? dy: -(this.startY  + this.maxY);
  else if (dy > 0) this.distY = (this.startY + dy <= 0)? dy: -this.startY;
  if (dx < 0) this.distX = (this.startX + dx >= -this.maxX)? dx: -(this.startX + this.maxX);
  else if (dx > 0) this.distX = (this.startX + dx <= 0)? dx: -this.startX;
  this.destX = this.startX + this.distX; this.destY = this.startY + this.distY;
  this.slideTo(this.destX, this.destY);
}

dw_scrollObj.prototype.glideTo = function(destX, destY, dur) {
    if ( !document.getElementById || this.sliding) return;
    this.slideDur = dur || dw_scrollObj.slideDur;
    this.lyr = document.getElementById(this.lyrId); 
    this.startX = this.x; this.startY = this.y;
    this.destX = -Math.max( Math.min(destX, this.maxX), 0);
    this.destY = -Math.max( Math.min(destY, this.maxY), 0);
    this.distY = this.destY - this.startY;
    this.distX =  this.destX - this.startX;
    this.slideTo(this.destX, this.destY);
}

dw_scrollObj.prototype.slideTo = function(destX, destY) {
    this.per = Math.PI/(2 * this.slideDur); this.sliding = true;
    this.slideStart = (new Date()).getTime();
    this.aniTimer = setInterval(this.animString + ".doSlide()",10);
    this.on_slide_start(this.startX, this.startY);
}

dw_scrollObj.prototype.doSlide = function() {
    var elapsed = (new Date()).getTime() - this.slideStart;
    if (elapsed < this.slideDur) {
        var x = this.startX + this.distX * Math.sin(this.per*elapsed);
        var y = this.startY + this.distY * Math.sin(this.per*elapsed);
        this.shiftTo(this.lyr, x, y); this.on_slide(x, y);
    } else {
        clearInterval(this.aniTimer); this.sliding = false;
        this.shiftTo(this.lyr, this.destX, this.destY);
        this.lyr = null; this.on_slide_end(this.destX, this.destY);
    }
}
dw_scrollObj.prototype.on_slide_start = function() {}
dw_scrollObj.prototype.on_slide = function() {}
dw_scrollObj.prototype.on_slide_end = function() {}
var dw_slidebar = {
  obj: null,
  slideDur: 500,
  init: function (bar, track, axis, x, y) {
    x = x || 0; y = y || 0;
    bar.style.left = x + "px"; bar.style.top = y + "px";
    bar.axis = axis; track.bar = bar;
    if (axis == "h") {
      bar.trkWd = track.offsetWidth;
      bar.maxX = bar.trkWd - bar.offsetWidth - x; 
      bar.minX = x; bar.maxY = y; bar.minY = y;
    } else {
      bar.trkHt = track.offsetHeight;
      bar.maxY = bar.trkHt - bar.offsetHeight - y; 
      bar.maxX = x; bar.minX = x; bar.minY = y;
    }
    bar.on_drag_start =  bar.on_drag =   bar.on_drag_end = 
    bar.on_slide_start = bar.on_slide =  bar.on_slide_end = function() {}
    bar.onmousedown = this.startDrag; track.onmousedown = this.startSlide;
  },
  startSlide: function(e) {
    if ( dw_slidebar.aniTimer ) clearInterval(dw_slidebar.aniTimer);
    e = e? e: window.event;
    var bar = dw_slidebar.obj = this.bar;
    e.offX = (typeof e.layerX != "undefined")? e.layerX: e.offsetX;
    e.offY = (typeof e.layerY != "undefined")? e.layerY: e.offsetY;
    bar.startX = parseInt(bar.style.left); bar.startY = parseInt(bar.style.top);
    if (bar.axis == "v") {
      bar.destX = bar.startX;
      bar.destY = (e.offY < bar.startY)? e.offY: e.offY - bar.offsetHeight;
      bar.destY = Math.min( Math.max(bar.destY, bar.minY), bar.maxY );
    } else {
      bar.destX = (e.offX < bar.startX)? e.offX: e.offX - bar.offsetWidth;
      bar.destX = Math.min( Math.max(bar.destX, bar.minX), bar.maxX );
      bar.destY = bar.startY;
    }
    bar.distX = bar.destX - bar.startX; bar.distY = bar.destY - bar.startY;
    dw_slidebar.per = Math.PI/(2 * dw_slidebar.slideDur);
    dw_slidebar.slideStart = (new Date()).getTime();
    bar.on_slide_start(bar.startX, bar.startY);
    dw_slidebar.aniTimer = setInterval("dw_slidebar.doSlide()",10);
  },
  doSlide: function() {
    if ( !dw_slidebar.obj ) { clearInterval(dw_slidebar.aniTimer); return; }    
    var bar = dw_slidebar.obj;     
    var elapsed = (new Date()).getTime() - this.slideStart;
    if (elapsed < this.slideDur) {
        var x = bar.startX + bar.distX * Math.sin(this.per*elapsed);
        var y = bar.startY + bar.distY * Math.sin(this.per*elapsed);
        bar.style.left = x + "px"; bar.style.top = y + "px";
        bar.on_slide(x, y);
    } else {
        clearInterval(this.aniTimer);
        bar.style.left = bar.destX + "px"; bar.style.top = bar.destY + "px";
        bar.on_slide_end(bar.destX, bar.destY);
        this.obj = null;
    }
  },
  startDrag: function (e) {
    e = dw_event.DOMit(e);
    if ( dw_slidebar.aniTimer ) clearInterval(dw_slidebar.aniTimer);
    var bar = dw_slidebar.obj = this;
    bar.downX = e.clientX; bar.downY = e.clientY;
    bar.startX = parseInt(bar.style.left);
    bar.startY = parseInt(bar.style.top);
    bar.on_drag_start(bar.startX, bar.startY);
    dw_event.add( document, "mousemove", dw_slidebar.doDrag, true );
    dw_event.add( document, "mouseup",   dw_slidebar.endDrag,  true );
    e.stopPropagation();
  },
  doDrag: function (e) {
    e = e? e: window.event;
    if (!dw_slidebar.obj) return;
    var bar = dw_slidebar.obj; 
    var nx = bar.startX + e.clientX - bar.downX;
    var ny = bar.startY + e.clientY - bar.downY;
    nx = Math.min( Math.max( bar.minX, nx ), bar.maxX);
    ny = Math.min( Math.max( bar.minY, ny ), bar.maxY);
    bar.style.left = nx + "px"; bar.style.top  = ny + "px";
    bar.on_drag(nx,ny);
    
    return false;  
  },
  endDrag: function () {
    dw_event.remove( document, "mousemove", dw_slidebar.doDrag, true );
    dw_event.remove( document, "mouseup",   dw_slidebar.endDrag,  true );
    if ( !dw_slidebar.obj ) return;
    dw_slidebar.obj.on_drag_end( parseInt(dw_slidebar.obj.style.left), parseInt(dw_slidebar.obj.style.top) );
    dw_slidebar.obj = null;  
  }
}
dw_scrollObj.prototype.setUpScrollbar = function(id, trkId, axis, offx, offy) {
  if (!document.getElementById) return;
  var bar = document.getElementById(id);
  var trk = document.getElementById(trkId);
  dw_slidebar.init(bar, trk, axis, offx, offy);
  bar.wn = dw_scrollObjs[this.id];
  if (axis == "v") this.vBarId = id; else this.hBarId = id;
  bar.on_drag_start = bar.on_slide_start = dw_scrollObj.getWndoLyrRef;
  bar.on_drag_end =   bar.on_slide_end =   dw_scrollObj.tossWndoLyrRef;
  bar.on_drag =       bar.on_slide =       dw_scrollObj.UpdateWndoLyrPos;
}

dw_scrollObj.getWndoLyrRef = function()  { this.wnLyr = document.getElementById(this.wn.lyrId); }
dw_scrollObj.tossWndoLyrRef = function() { this.wnLyr = null; }
dw_scrollObj.UpdateWndoLyrPos = function(x, y) {
  var nx, ny;
  if (this.axis == "v") {
    nx = this.wn.x;
    ny = -(y - this.minY) * ( this.wn.maxY / (this.maxY - this.minY) ) || 0;
  } else {
    ny = this.wn.y;
    nx = -(x - this.minX) * ( this.wn.maxX / (this.maxX - this.minX) ) || 0;
  }
  this.wn.shiftTo(this.wnLyr, nx, ny);
}

dw_scrollObj.prototype.updateScrollbar = function(x, y) {
  var nx, ny;
  if ( this.vBarId ) {
    if (!this.maxY) return;
    ny = -( y * ( (this.vbar.maxY - this.vbar.minY) / this.maxY ) - this.vbar.minY );
    ny = Math.min( Math.max(ny, this.vbar.minY), this.vbar.maxY);  
    nx = parseInt(this.vbar.style.left);
    this.vbar.style.left = nx + "px"; this.vbar.style.top = ny + "px";
    
  } if ( this.hBarId ) {
    if (!this.maxX) return;
    nx = -( x * ( (this.hbar.maxX - this.hbar.minX) / this.maxX ) - this.hbar.minX );
    nx = Math.min( Math.max(nx, this.hbar.minX), this.hbar.maxX);
    ny = parseInt(this.hbar.style.top);
    this.hbar.style.left = nx + "px"; this.hbar.style.top = ny + "px";
    
  } 
  
}

dw_scrollObj.prototype.restoreScrollbars = function() {
  var bar;
  if (this.vBarId) {
    bar = document.getElementById(this.vBarId);
    bar.style.left = bar.minX + "px"; bar.style.top = bar.minY + "px";
  }
  if (this.hBarId) {
    bar = document.getElementById(this.hBarId);
    bar.style.left = bar.minX + "px"; bar.style.top = bar.minY + "px";
  }
}
  
dw_scrollObj.prototype.setBarSize = function() {
  var bar;
  var lyr = document.getElementById(this.lyrId);
  var wn = document.getElementById(this.id);
  if (this.vBarId) {
    bar = document.getElementById(this.vBarId);
    bar.style.height = (lyr.offsetHeight > wn.offsetHeight)? bar.trkHt / ( lyr.offsetHeight / wn.offsetHeight ) + "px": bar.trkHt - 2*bar.minY + "px";
    bar.maxY = bar.trkHt - bar.offsetHeight - bar.minY; 
  }
  if (this.hBarId) {
    bar = document.getElementById(this.hBarId);
    bar.style.width = (this.wd > wn.offsetWidth)? bar.trkWd / ( this.wd / wn.offsetWidth ) + "px": bar.trkWd - 2*bar.minX + "px";
    bar.maxX = bar.trkWd - bar.offsetWidth - bar.minX; 
  }
}

dw_scrollObj.prototype.on_load = function() { 
  this.restoreScrollbars();
}

dw_scrollObj.prototype.on_scroll = dw_scrollObj.prototype.on_slide = function(x,y) { this.updateScrollbar(x,y); }

dw_scrollObj.prototype.on_scroll_start = dw_scrollObj.prototype.on_slide_start = function() {
  if ( this.vBarId ) this.vbar = document.getElementById(this.vBarId);
  if ( this.hBarId ) this.hbar = document.getElementById(this.hBarId);
}

dw_scrollObj.prototype.on_scroll_end = dw_scrollObj.prototype.on_slide_end = function(x, y) { 
  this.updateScrollbar(x,y);
  this.lyr = null; this.bar = null; 
}
var dw_event = {
   add: function(obj, etype, fp, cap) {
    cap = cap || false;
    if (obj.addEventListener) obj.addEventListener(etype, fp, cap);
    else if (obj.attachEvent) obj.attachEvent("on" + etype, fp);
  }, 
  remove: function(obj, etype, fp, cap) {
    cap = cap || false;
    if (obj.removeEventListener) obj.removeEventListener(etype, fp, cap);
    else if (obj.detachEvent) obj.detachEvent("on" + etype, fp);
  }, 
  DOMit: function(e) { 
    e = e? e: window.event;
    e.tgt = e.srcElement? e.srcElement: e.target;
    if (!e.preventDefault) e.preventDefault = function () { return false; }
    if (!e.stopPropagation) e.stopPropagation = function () { if (window.event) window.event.cancelBubble = true; }
    return e;
  }
}
/* -----------------------END(sre_scroll)---------------------------------- */

/*
function addElement(cont) {

  var ni = document.getElementById(cont);

  var numi = document.getElementById('theValue');

  var num = (document.getElementById('theValue').value -1)+ 2;

  numi.value = num;

  var newdiv = document.createElement('div');

  var divIdName = 'my'+num+'Div';

  newdiv.setAttribute('id',divIdName);

  newdiv.innerHTML = 'Element Number '+num+' has been added! <a href=\'#\' onclick=\'removeElement('+divIdName+')\'>Remove the div "'+divIdName+'"</a>';

  ni.appendChild(newdiv);

}


function removeElement(divNum) {

  var d = document.getElementById('myDiv');

  var olddiv = document.getElementById(divNum);

  d.removeChild(olddiv);

}
*/
//replacejscssfile("oldscript.js", "newscript.js", "js") //Replace all occurences of "oldscript.js" with "newscript.js"
//replacejscssfile("oldstyle.css", "newstyle", "css") //Replace all occurences "oldstyle.css" with "newstyle.css"
/* -----------------------END(sre_dialog)---------------------------------- */

/* ---------------------Begin(sre_helpbar)---------------------------------- *\
MUST set up div at the top of the page like this:

<div id="sre_hlp_down_hit onmouseover="sre_helpbar.toggleMenu('mnuid','D');"></div>
   <div id="menu_holder">
</div>
<div id="sre_hlp_up_hit" onmouseover="sre_helpbar.toggleMenu('mnuid','R');">
Usage:
	mnu = new sre_helpbar.Settings();
	sre_helpbar.init ("mnuid",mnu,"toggle function name");
toggle function return s html that will be used to create the content of the menu.
\* ---------------------------------------------------------------------- */
/*
var sre_helpbar = {
	Settings: function() {
		this.Color = "rgb(215,215,255)"//"rgb(98,124,193)";//"#444444";//
		this.BkColor = "rgb(185,185,255)"//"rgb(98,124,193)";//"#444444";//
		this.togMenuId = "";
		this.moving = 0;
		this.menuWidth = 800;
		this.menuTop = 0;
		this.currStat = 'R';
		this.winWidth=0;
		this.MenuDiv = "help_body"; // this is div for menu body
		this.DivDown = "sre_rightpanelbody"; // this is the div that pushes menu down
		this.DivGrip = "sre_grip"; // this is the div for grip
		this.menuHeight = 500; // this is the defaultheight of the menu
	},
config: new Array(),

initHelp: function(num, settings,togfunc) {
	this.setSettings(num, settings);
	html ='';
html+='<table border="3" width="';
html+=this.config[num].menuWidth ;
html+='" cellpadding="0" cellspacing="0" style="opacity:0.6;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=60);background-color:';
html+=this.config[num].Color; 
html+=';background-image:url(\'/EN/SRESYS/Pic/commonstyle/blue_gradsm.JPG\');background-repeat:repeat;';
html+='">';
html+='<tr><td style="background-color:';
html+=this.config[num].BkColor ;
html+='">';
html += eval(togfunc+ "()");
html+='</td></tr>';
html+='<tr><td>&nbsp;';
html+='</td>';	
html+='</tr>';
html+='</table>';

	vd = $(this.config[num].DivDown);
	vd.innerHTML = html;
	vd.style.visibility = "visible";
	this.config[num].winWidth = sre_core.windowSize('H');
//	vd.style.width= 0;//parseInt(this.config[num].menuWidth);
//	vd.style.left = parseInt(this.config[num].menuWidth) ;//parseInt(0) - parseInt(vd.style.width);
//	this.config[num].menuLeft = vd.style.left;
//	vd.style.top= 0;
	vd.style.height= parseInt(this.config[num].menuHeight);
},
setSettings: function(n, settings) {
	if(typeof(settings) != "object") {
		this.config[n] = new this.Settings();
	}
	else {
		this.config[n] = settings;
	}
	this.config[n].togMenuId = n;
},
toggleHelp: function (num,stat) {
	vd = $(this.config[num].DivDown);
	vid = vd;
	if(this.config[num].moving == 1) return;
	this.config[num].moving = 1;
	if (stat == "R") {
		hideAdv();
		sre_core.lightUp(vid,60);
		sre_helpbar.moveButton(vid,'L',num);
	} else {
		sre_core.lightUp(vid,60);
		sre_helpbar.moveButton(vid,'R',num);
	}
	this.config[num].currStat = stat;
	vd.style.visibility="visible";
},
moveButton: function (vid,LeftRight,num) {
	vd = $(vid);
	vd.style.top = this.config[num].menuTop;
	diff = parseInt(vd.style.left) + parseInt(this.config[num].menuWidth) ; //parseInt(vd.style.left) - parseInt(H);
	var spn = parseInt(this.config[num].menuWidth) ;
	if (LeftRight == 'R') {//0,200,r,
		//	$("SRE_ToolTip").innerHTML=diff +'**'+spn+'**'+LeftRight+'**'+vd.style.width;
		if (diff <= (1 + (2 * spn))) {
			vd.style.left = parseInt(parseInt(vd.style.left) + parseInt(1));
			if((parseInt(vd.style.width) - parseInt(1)) >= 0) {
				vd.style.width = parseInt(vd.style.width) - parseInt(1) ;
			}
			timer = window.setTimeout("sre_helpbar.moveButton('"+vid+"','R','"+num+"');", 1, "JavaScript");
		} else {
			sre_core.lightUp(vid,0);
			this.config[num].moving = 0;
			bringAdv();
		}
	} else {
		if ( diff >= (1 + spn)) {
			vd.style.left = parseInt(parseInt(vd.style.left) - parseInt(1));
			if((parseInt(vd.style.width) - parseInt(1)) <= (2 * parseInt(vd.style.width))) {
				vd.style.width = parseInt(vd.style.width) + parseInt(1);
			}
			timer = window.setTimeout("sre_helpbar.moveButton('"+vid+"','L','"+num+"');", 1, "JavaScript");
		} else {
			this.config[num].moving = 0;
		}
	}
}
};
 */
/* -----------------------END(sre_helpbar)---------------------------------- */
/* ------------------------begin xml parser --------------------------------*/
/*
 * HTML Parser By John Resig (ejohn.org)
 * Original code by Erik Arvidsson, Mozilla Public License
 * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
 *
 * // Use like so:
 * HTMLParser(htmlString, {
 *     start: function(tag, attrs, unary) {},
 *     end: function(tag) {},
 *     chars: function(text) {},
 *     comment: function(text) {}
 * });
 *
 * // or to get an XML string:
 * HTMLtoXML(htmlString);
 *
 * // or to get an XML DOM Document
 * HTMLtoDOM(htmlString);
 *
 * // or to inject into an existing document/DOM node
 * HTMLtoDOM(htmlString, document);
 * HTMLtoDOM(htmlString, document.body);
 *
 */
/*
(function(){

	// Regular Expressions for parsing tags and attributes
	var startTag = /^<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
		endTag = /^<\/(\w+)[^>]*>/,
		attr = /(\w+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
		
	// Empty Elements - HTML 4.01
	var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed");

	// Block Elements - HTML 4.01
	var block = makeMap("address,applet,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul");

	// Inline Elements - HTML 4.01
	var inline = makeMap("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");

	// Elements that you can, intentionally, leave open
	// (and which close themselves)
	var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");

	// Attributes that have their values filled in disabled="disabled"
	var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");

	// Special Elements (can contain anything)
	var special = makeMap("script,style");

	var HTMLParser = this.HTMLParser = function( html, handler ) {
		var index, chars, match, stack = [], last = html;
		stack.last = function(){
			return this[ this.length - 1 ];
		};

		while ( html ) {
			chars = true;

			// Make sure we're not in a script or style element
			if ( !stack.last() || !special[ stack.last() ] ) {

				// Comment
				if ( html.indexOf("<!--") == 0 ) {
					index = html.indexOf("-->");
	
					if ( index >= 0 ) {
						if ( handler.comment )
							handler.comment( html.substring( 4, index ) );
						html = html.substring( index + 3 );
						chars = false;
					}
	
				// end tag
				} else if ( html.indexOf("</") == 0 ) {
					match = html.match( endTag );
	
					if ( match ) {
						html = html.substring( match[0].length );
						match[0].replace( endTag, parseEndTag );
						chars = false;
					}
	
				// start tag
				} else if ( html.indexOf("<") == 0 ) {
					match = html.match( startTag );
	
					if ( match ) {
						html = html.substring( match[0].length );
						match[0].replace( startTag, parseStartTag );
						chars = false;
					}
				}

				if ( chars ) {
					index = html.indexOf("<");
					
					var text = index < 0 ? html : html.substring( 0, index );
					html = index < 0 ? "" : html.substring( index );
					
					if ( handler.chars )
						handler.chars( text );
				}

			} else {
				html = html.replace(new RegExp("(.*)<\/" + stack.last() + "[^>]*>"), function(all, text){
					text = text.replace(/<!--(.*?)-->/g, "$1")
						.replace(/<!\[CDATA\[(.*?)]]>/g, "$1");

					if ( handler.chars )
						handler.chars( text );

					return "";
				});

				parseEndTag( "", stack.last() );
			}

			if ( html == last )
				throw "Parse Error: " + html;
			last = html;
		}
		
		// Clean up any remaining tags
		parseEndTag();

		function parseStartTag( tag, tagName, rest, unary ) {
			if ( block[ tagName ] ) {
				while ( stack.last() && inline[ stack.last() ] ) {
					parseEndTag( "", stack.last() );
				}
			}

			if ( closeSelf[ tagName ] && stack.last() == tagName ) {
				parseEndTag( "", tagName );
			}

			unary = empty[ tagName ] || !!unary;

			if ( !unary )
				stack.push( tagName );
			
			if ( handler.start ) {
				var attrs = [];
	
				rest.replace(attr, function(match, name) {
					var value = arguments[2] ? arguments[2] :
						arguments[3] ? arguments[3] :
						arguments[4] ? arguments[4] :
						fillAttrs[name] ? name : "";
					
					attrs.push({
						name: name,
						value: value,
						escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') //"
					});
				});
	
				if ( handler.start )
					handler.start( tagName, attrs, unary );
			}
		}

		function parseEndTag( tag, tagName ) {
			// If no tag name is provided, clean shop
			if ( !tagName )
				var pos = 0;
				
			// Find the closest opened tag of the same type
			else
				for ( var pos = stack.length - 1; pos >= 0; pos-- )
					if ( stack[ pos ] == tagName )
						break;
			
			if ( pos >= 0 ) {
				// Close all the open elements, up the stack
				for ( var i = stack.length - 1; i >= pos; i-- )
					if ( handler.end )
						handler.end( stack[ i ] );
				
				// Remove the open elements from the stack
				stack.length = pos;
			}
		}
	};
	
	this.HTMLtoXML = function( html ) {
		var results = "";
		
		HTMLParser(html, {
			start: function( tag, attrs, unary ) {
				results += "<" + tag;
		
				for ( var i = 0; i < attrs.length; i++ )
					results += " " + attrs[i].name + '="' + attrs[i].escaped + '"';
		
				results += (unary ? "/" : "") + ">";
			},
			end: function( tag ) {
				results += "</" + tag + ">";
			},
			chars: function( text ) {
				results += text;
			},
			comment: function( text ) {
				results += "<!--" + text + "-->";
			}
		});
		
		return results;
	};
	
	this.HTMLtoDOM = function( html, doc ) {
		// There can be only one of these elements
		var one = makeMap("html,head,body,title");
		
		// Enforce a structure for the document
		var structure = {
			link: "head",
			base: "head"
		};
	
		if ( !doc ) {
			if ( typeof DOMDocument != "undefined" )
				doc = new DOMDocument();
			else if ( typeof document != "undefined" && document.implementation && document.implementation.createDocument )
				doc = document.implementation.createDocument("", "", null);
			else if ( typeof ActiveX != "undefined" )
				doc = new ActiveXObject("Msxml.DOMDocument");
			
		} else
			doc = doc.ownerDocument ||
				doc.getOwnerDocument && doc.getOwnerDocument() ||
				doc;
		
		var elems = [],
			documentElement = doc.documentElement ||
				doc.getDocumentElement && doc.getDocumentElement();
				
		// If we're dealing with an empty document then we
		// need to pre-populate it with the HTML document structure
		if ( !documentElement && doc.createElement ) (function(){
			var html = doc.createElement("html");
			var head = doc.createElement("head");
			head.appendChild( doc.createElement("title") );
			html.appendChild( head );
			html.appendChild( doc.createElement("body") );
			doc.appendChild( html );
		})();
		
		// Find all the unique elements
		if ( doc.getElementsByTagName )
			for ( var i in one )
				one[ i ] = doc.getElementsByTagName( i )[0];
		
		// If we're working with a document, inject contents into
		// the body element
		var curParentNode = one.body;
		
		HTMLParser( html, {
			start: function( tagName, attrs, unary ) {
				// If it's a pre-built element, then we can ignore
				// its construction
				if ( one[ tagName ] ) {
					curParentNode = one[ tagName ];
					return;
				}
			
				var elem = doc.createElement( tagName );
				
				for ( var attr in attrs )
					elem.setAttribute( attrs[ attr ].name, attrs[ attr ].value );
				
				if ( structure[ tagName ] && typeof one[ structure[ tagName ] ] != "boolean" )
					one[ structure[ tagName ] ].appendChild( elem );
				
				else if ( curParentNode && curParentNode.appendChild )
					curParentNode.appendChild( elem );
					
				if ( !unary ) {
					elems.push( elem );
					curParentNode = elem;
				}
			},
			end: function( tag ) {
				elems.length -= 1;
				
				// Init the new parentNode
				curParentNode = elems[ elems.length - 1 ];
			},
			chars: function( text ) {
				curParentNode.appendChild( doc.createTextNode( text ) );
			},
			comment: function( text ) {
				// create comment node
			}
		});
		
		return doc;
	};

	function makeMap(str){
		var obj = {}, items = str.split(",");
		for ( var i = 0; i < items.length; i++ )
			obj[ items[i] ] = true;
		return obj;
	}
})();

var results = "";


HTMLParser("<p id=test>hello <i>world", {
   start: function( tag, attrs, unary ) {
     results += "<" + tag;

    for ( var i = 0; i < attrs.length; i++ )
       results += " " + attrs[i].name + '="' + attrs[i].escaped + '"';

    results += (unary ? "/" : "") + ">";
   },
   end: function( tag ) {
     results += "</" + tag + ">";
   },
   chars: function( text ) {
     results += text;
   },
   comment: function( text ) {
     results += "<!--" + text + "-->";
   }
});

results == '<p id="test">hello <i>world</i></p>"
*/
/* ------------------------end xml parser -----------------------------------*/

