
var strEventID,MapId,IMID,pageRequested;
var AEID,IMID,ProductType,Print,strUnits;
var ValidExhibitor,isValidSelection,Msg1060,strBSelMode;
var imgFloorplanSrc;
var XMLFileName1='XMLSearch.aspx';
var strBoothIds="";
var IE = document.all?true:false;
var req;
var arrHighlightedBooths = Array();
var count=0;
var formVisible=false, currentTask="";				
var arrHighlightedBooths = Array();
var count=0;
var XMLFileName2 = 'BoothXMLDoc.aspx';
var EventId;
var strTask;
var isIE = false;
var MTS_INCH_CONV_VAL=39.3700787;
var ControlPanelTop, BaseflooorplanTop, cpConstant;
var vartotalArea=0;
var blndesel=false;
var varCurArea=0;
var varCallback=0;
var ids ='';
var strlabels='';


function LoadFloorPlan(Mapid){
	if(Mapid==-1) return;
	if (AEID != "" || IMID != "") window.location.href = pageRequested+"?Index=1&AEID=&IMID="+IMID+"&Mapid="+Mapid;
	else window.location.href = pageRequested+"?Index=1&Mapid="+Mapid;
}

function LocateBooths(BoothIDs){
	var strSplitBoothIds="";
	var intForLoop=0;
	var strBoothID="";
	var strImgBoothID="";
	var topPosition=0;
	var leftPosition=0;
	var intHighlight=0;
	strBoothIds=BoothIDs;
	if(strBoothIds != ""){
		strSplitBoothIds=strBoothIds.split(",");
		for(intForLoop=0;intForLoop<=strSplitBoothIds.length-1;intForLoop++){	
			//strBoothID="BoothID"+strSplitBoothIds[intForLoop];
			strBoothID="img"+strSplitBoothIds[intForLoop];
			strImgBoothID="img"+strSplitBoothIds[intForLoop];				
			if(document.getElementById(strBoothID) != null && document.getElementById(strImgBoothID) != null){	
				document.getElementById(strBoothID).style.filter = "Alpha(Opacity=100)";
				document.getElementById(strImgBoothID).style.borderWidth=2;
				document.getElementById(strImgBoothID).style.borderColor="#FF6633";
				document.getElementById(strImgBoothID).style.borderStyle="solid";
				if(intHighlight==0){
					topPosition=document.getElementById(strBoothID).style.top;
					leftPosition=document.getElementById(strBoothID).style.left;
					window.scrollTo(leftPosition.replace('px','')-window.screen.width/2,eval(topPosition.replace('px','')-window.screen.height/2));
					intHighlight=1;
				}
			}else if (document.getElementById(strBoothID)){
				if (document.getElementById(strBoothID).tagName=="AREA"){
					hightlightPoly(document.getElementById(strBoothID));
				}
			}			
		}
	}
}
	
function ExecuteAtBodyLoad(){
    if (document.getElementById("content_holder") && document.getElementById("imgFloorPlan")){
		var imgFloorplanHeight = parseInt(document.getElementById("imgFloorPlan").offsetHeight);
		if (document.getElementById('divBottom')!=null ) imgFloorplanHeight=imgFloorplanHeight+document.getElementById('divBottom').offsetHeight;
		document.getElementById("content_holder").style.height=(imgFloorplanHeight+400)+"px";		
	}
    if (document.getElementById("imgFloorPlan")){
        //document.getElementById("imgFloorPlan").src=imgFloorplanSrc;
        load_BoothSpans();
    }    
    //setTimeout(createSpans,0);	
}

function window_onload(){
	if(Print!='Yes'){
	    SetExpandImage();
	    if(ProductType!="fp") {
	    if (typeof(ShowHideMenu)=="function") ShowHideMenu(); 
	    }
	    ExecuteAtBodyLoad();
	}
	if (document.getElementById('ControlPanel')){		
		if(document.getElementById('ctlTexturing_ddlColor')){
			setColorOnload();
		}
		if (ProductType!="fp" && Print!="Yes"){
		    document.getElementById('hdnImgLeft').value = getCoords(document.getElementById("lblLegend")).x-getCoords(document.getElementById("maincontent1")).x;
			document.getElementById('ControlPanel').style.top = document.getElementById('hdnImgTop').value - cpConstant ;
			document.getElementById('ControlPanel').style.left = document.getElementById('hdnImgLeft').value;
			document.getElementById('BasefloorPlan').style.left = document.getElementById('hdnImgLeft').value;
			document.getElementById('FloorPlan').style.left = document.getElementById('hdnImgLeft').value;
			if (document.getElementById('divBottom')!=null ){
			    document.getElementById('divBottom').style.left = document.getElementById('hdnImgLeft').value;
			}
		}
		var vlocation = getCoords(document.getElementById("ControlPanel"));
		ControlPanelTop = vlocation.y;
		BaseflooorplanTop = parseInt(document.getElementById("BasefloorPlan").style.top);
	}
	if (pageRequested.toUpperCase()=="E_SALESOFFICE"){
	    if (document.getElementById("btnSubmit")!=null){
            document.getElementById("btnSubmit").disabled =true;
        }
        if (ValidExhibitor==0){
            if (document.getElementById("a_Companydetails")){
	            document.getElementById("a_Companydetails").style.cursor="";
	            document.getElementById("a_fp").style.cursor="";
	            document.getElementById("a_payinfo").style.cursor="";
            }
        }else if (strBoothids!=""){
            if (document.getElementById("a_payinfo")!=null){
                document.getElementById("a_payinfo").style.cursor="pointer";
            }
        }
	}
}
	function cursorPosition(e) {
            e = e || window.event;
            var cursor = {x:0, y:0};
            if (e.pageX || e.pageY) {
                cursor.x = e.pageX;
                cursor.y = e.pageY;
            }else {
                var de = document.documentElement;
                var b = document.body;
                cursor.x = e.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
                cursor.y = e.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
            }
            return cursor;
		}	
//function keepup(ev){
//	if (document.getElementById('overDiv')==null)return 0;
//	if (mousein){
//		if (IE==true){
//		    var intLeftMargin=parseInt(overDiv.offsetWidth);
//		    /*if((ev.clientX+document.body.scrollLeft)>window.screen.width/2){
//				overDiv.style.left = ev.clientX + document.body.scrollLeft - intLeftMargin;
//		    }else{
//				overDiv.style.left = ev.clientX + document.body.scrollLeft;
//		    }*/
//		    overDiv.style.left = ev.clientX + document.body.scrollLeft;
//			overDiv.style.top = ev.clientY + document.body.scrollTop + 20;
//		}else{
//			document.getElementById('overDiv').style.left = ev.pageX;					
//			document.getElementById('overDiv').style.top = (ev.pageY)+10;
//		}
//	}
//}
//Screen Resolution check is added by Sarvesh for issue# 7512 on 27March2007
var screenResolution=screen.width + '*' + screen.height
function keepup(ev) {
    if (mousein){
	    if (IE==true){
            if (screenResolution=='1024*768'){
                overDiv.style.left = event.clientX + document.body.scrollLeft;
			    overDiv.style.top = event.clientY + document.body.scrollTop + 20;
            }else if (screenResolution=='800*600'){
                overDiv.style.left = event.clientX + document.body.scrollLeft;
		        overDiv.style.top = event.clientY + document.body.scrollTop + 15;
            }else if (screenResolution=='1152*864'){
                overDiv.style.left = event.clientX + document.body.scrollLeft-200;
		        overDiv.style.top = event.clientY + document.body.scrollTop + 15;
            }else if (screenResolution=='1280*960'){
                overDiv.style.left = event.clientX + document.body.scrollLeft-235;
		        overDiv.style.top = event.clientY + document.body.scrollTop + 18;
            }else if (screenResolution=='1280*768'){
                overDiv.style.left = event.clientX + document.body.scrollLeft-235;
		        overDiv.style.top = event.clientY + document.body.scrollTop + 20;
            }else if (screenResolution=='1280*600'){
                overDiv.style.left = event.clientX + document.body.scrollLeft-235;
		        overDiv.style.top = event.clientY + document.body.scrollTop + 20;
            }else if (screenResolution=='1280*720'){
                overDiv.style.left = event.clientX + document.body.scrollLeft-235;
		        overDiv.style.top = event.clientY + document.body.scrollTop + 18;
            }else if (screenResolution=='1280*1024'){
                overDiv.style.left = event.clientX + document.body.scrollLeft-285;
			    overDiv.style.top = event.clientY + document.body.scrollTop + 15;
            }else{
			     overDiv.style.left = event.clientX + document.body.scrollLeft;
			     overDiv.style.top = event.clientY + document.body.scrollTop + 20;
            }
        }else{
            if (screenResolution=='1024*768'){
                document.getElementById('overDiv').style.left = ev.pageX;					
			    document.getElementById('overDiv').style.top = (ev.pageY)+20;
            }else if (screenResolution=='800*600'){
                document.getElementById('overDiv').style.left = ev.pageX;					
                document.getElementById('overDiv').style.top = (ev.pageY)+15;
            }else if (screenResolution=='1152*864'){
                document.getElementById('overDiv').style.left = ev.pageX-100;					
                document.getElementById('overDiv').style.top = (ev.pageY)+15;
            }else if (screenResolution=='1280*720'){
                document.getElementById('overDiv').style.left = ev.pageX-245;					
                document.getElementById('overDiv').style.top = (ev.pageY)+18;
            }else if (screenResolution=='1280*600'){
                document.getElementById('overDiv').style.left = ev.pageX-245;					
                document.getElementById('overDiv').style.top = (ev.pageY)+18;
            }else if (screenResolution=='1280*768'){
                document.getElementById('overDiv').style.left = ev.pageX-245;					
                document.getElementById('overDiv').style.top = (ev.pageY)+20;
            }else if (screenResolution=='1280*960'){
                document.getElementById('overDiv').style.left = ev.pageX-245;					
                document.getElementById('overDiv').style.top = (ev.pageY)+20;
            }else if (screenResolution=='1280*1024'){
                document.getElementById('overDiv').style.left = ev.pageX-295;					
                document.getElementById('overDiv').style.top = (ev.pageY)+25;
            }else{
                //Modified by Bhavana on 05-Jan-2006 for #3439
                document.getElementById('overDiv').style.left = ev.pageX-120;					
                document.getElementById('overDiv').style.top = (ev.pageY)+20;
            }
        }
	}
}
function popup (ev,pr,str)
		{
			if (pr != 'Yes')
			{
				mousein = true;
				document.getElementById('overDiv').innerHTML = str;
				
			    ///////////////ADDED BY RAVI SHANKAR TO SHOW THE POPUP IN FLOOR PALN TO ADJUST WITH THE SCREEN FOR THE RIGHT MOST BOOTHS AS THE POPUP ALIGNED TO LEFT-STARTED--ISSUE#14407/////////
                 document.getElementById("overDiv").style.width = '';               
                  document.getElementById("overDiv").style.display = "";                   
                 var cursor = cursorPosition(ev);                                
                var myWidth = 0, myHeight = 0;
                if( typeof( window.innerWidth ) == 'number' ) {                
                myWidth = window.innerWidth;
                myHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {                
                myWidth = document.documentElement.clientWidth;
                myHeight = document.documentElement.clientHeight;
                } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {                
                myWidth = document.body.clientWidth;
                myHeight = document.body.clientHeight;
                }
                var eve=(!ev)?window.event:ev;
                if (IE==true){
                     x = (window.Event) ? e.pageX : event.clientX;
                     y = (window.Event) ? e.pageY : event.clientY;      
                }
                else{
                    
                    x=eve.pageX;
                    y=eve.pageY;
                } 
                if (IE==true){
                    if ((parseInt(x)+parseInt(document.getElementById("overDiv").offsetWidth)+parseInt(15))<myWidth){
                        document.getElementById("overDiv").style.left=(cursor.x-getCoords(document.getElementById("maincontent1")).x)+10+'px';                                           
                    }
                    else{
                        document.getElementById("overDiv").style.left=(cursor.x-getCoords(document.getElementById("maincontent1")).x)-10-parseInt(document.getElementById("overDiv").offsetWidth)+'px';                    
                    }
                    if ((parseInt(y)+parseInt(document.getElementById("overDiv").offsetHeight)+parseInt(10))<myHeight){
                         document.getElementById("overDiv").style.top=cursor.y+10+'px';                    
                    }
                    else{
                         document.getElementById("overDiv").style.top=cursor.y-parseInt(document.getElementById("overDiv").offsetHeight)-10+'px';                     
                    } 
                    }
                else{
                    
                    if ((parseInt(x)+parseInt(document.getElementById("overDiv").offsetWidth)+parseInt(10))<myWidth){
                        document.getElementById("overDiv").style.left=(cursor.x-getCoords(document.getElementById("maincontent1")).x)+15+'px';                        
                    }
                    else{
                        document.getElementById("overDiv").style.left=(cursor.x-getCoords(document.getElementById("maincontent1")).x)-10-parseInt(document.getElementById("overDiv").offsetWidth)+'px';                    
                    }
                    if ((parseInt(y)+parseInt(document.getElementById("overDiv").offsetHeight)+parseInt(10))<myHeight){
                         document.getElementById("overDiv").style.top=cursor.y+10+'px';                                             
                    }
                    else{
                         document.getElementById("overDiv").style.top=cursor.y-parseInt(document.getElementById("overDiv").offsetHeight)-10+'px';                                              
                    }  
                }
                               
                ///////////////ADDED BY RAVI SHANKAR TO SHOW THE POPUP IN FLOOR PALN TO ADJUST WITH THE SCREEN FOR THE RIGHT MOST BOOTHS AS THE POPUP ALIGNED TO LEFT-ENDED--ISSUE#14407/////////
                         	 
            }
		}

function resolve(){
	if (document.getElementById('overDiv')==null)return 0;
	mousein = false;
	document.getElementById('overDiv').style.display = "none";
}

function clickBooth(pr,lnk,boothid,eventid,langid,ProductType,bootharea,boothlabel){
	if (pr != 'Yes'){
	    if (pageRequested.toUpperCase()=="FLOORPLAN.ASPX"){
		    window.open(lnk);
        }else if (pageRequested.toUpperCase()=="E_FLOORPLAN.ASPX"){
            document.location.href=lnk;
        }else if (pageRequested.toUpperCase()=="E_SALESOFFICE.ASPX"){
            if (AEID != ""){
                clickBoothSO(pr,boothid,eventid,langid,lnk,boothlabel);
            }else{
                clickBoothSO(pr,boothid,eventid,langid,lnk,boothlabel,bootharea);
            }
        }else{
            alert("Unknown Page Error !")
        }
	}
}

function clickNES(pr,NESid,eventid,LangID,NESURL){
	if (pr != 'Yes'){
		window.open(NESURL)
	}
}

function imgerr(){
	document.getElementById('FloorPlan').style.visibility="hidden";
	document.getElementById('lblShowErrorMessage').innerHTML = "<b><font color=red>Floorplan not available for this event</font></b><br>"
}		
	
function DeLocateBooths(BoothIDs){
	var strSplitBoothIds="";
	var intForLoop=0;
	var strBoothID="";
	var strImgBoothID="";
	var topPosition=0;
	var leftPosition=0;
	strBoothIds=BoothIDs;
	if(strBoothIds != ""){
		strSplitBoothIds=strBoothIds.split(",");
		for(intForLoop=0;intForLoop<=strSplitBoothIds.length-1;intForLoop++){
			//strBoothID="BoothID"+strSplitBoothIds[intForLoop];
			strBoothID="img"+strSplitBoothIds[intForLoop];
			strImgBoothID="img"+strSplitBoothIds[intForLoop];
			if(document.getElementById(strBoothID) != null  && document.getElementById(strImgBoothID) != null){
				document.getElementById(strBoothID).style.filter = "Alpha(Opacity=0)";
				document.getElementById(strImgBoothID).style.borderWidth=0;
				document.getElementById(strImgBoothID).style.borderColor="";
				document.getElementById(strImgBoothID).style.borderStyle="";				
			}
		}
		unhightlightPoly();
	}	
}

function HighlightBooths(){
	var items = req.responseXML.getElementsByTagName("INFO");			
	DeLocateBooths(strBoothIds);
	strBoothIds="";
	for (var lnLoopCnt=0; lnLoopCnt<items.length; lnLoopCnt++){
		strBoothIds=items[lnLoopCnt].getAttribute("BOOTHID")+","+strBoothIds;
	}
	strBoothIds=strBoothIds.substring(0,strBoothIds.length-1);			
	LocateBooths(strBoothIds);
}
		
function Verify(){ 
	if (req.readyState!=4){
		return false;
	}else{				
		HighlightBooths();
	}
}

function loadXML(url){
	if (window.XMLHttpRequest){
		req = new XMLHttpRequest();
		req.onreadystatechange = Verify;
		req.open("GET", url, true);
		req.send(null);
	}else if (window.ActiveXObject){
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req){
			req.onreadystatechange = Verify;
			req.open("GET", url, true);
			req.send(null);
		}
	}
}

function GetCategories(){
	var strProductID="";
	var strSubProdCatText ="";
	var strSubProdCatID ="";
	
	strProductID=document.frmMain.ddlCategory.options[document.frmMain.ddlCategory.selectedIndex].value;
	strSubProdCatText = strProductID.substr(0, 1);			
	if (strSubProdCatText=="S"){
		strSubProdCatID = strProductID.substr(1, strProductID.length-1);
		loadXML(XMLFileName1+"?MapID="+document.frmMain.hdnMapId.value+"&SubProdCatID="+strSubProdCatID+"&Task=SubProdCategory");		
	}else{
		loadXML(XMLFileName1+"?MapID="+document.frmMain.hdnMapId.value+"&ProductID="+strProductID+"&Task=Category");		
	}
}

function popupnes(strNESURL){
	mousein=true;
	window.status=strNESURL;
	return true;
}
		 
function resolveNES(){
	mousein=false;
	window.status='';
}

function convertToInches(strVal){	
	strVal = strVal*MTS_INCH_CONV_VAL;
	return strVal;
}

function convertToSqInches(strVal){	
	strVal = strVal*MTS_INCH_CONV_VAL*MTS_INCH_CONV_VAL;
	return strVal;
}

function ResetFloor(){
	var img, BoothID, BoothIDTag, boothLabelTag	
	ResetControls();				
	for(i=0;i< arrHighlightedBooths.length;i++){
		BoothID=arrHighlightedBooths[i][0];
		img = "img"+ BoothID;
		//BoothIDTag="BoothID"+ BoothID;
		BoothIDTag="img"+ BoothID;
		if(document.getElementById(BoothIDTag) != null){
			document.getElementById(BoothIDTag).style.filter = "Alpha(Opacity=0)"
			if (document.getElementById(img)){
				document.getElementById(img).src= "../images/booth/Booth_Highlighted.gif";
				document.getElementById(img).style.borderWidth=0;
				document.getElementById(img).style.borderColor = "#000000";
			}	
		}
	}
	unhightlightPoly();	
	arrHighlightedBooths = new Array();
	count = 0
	document.frmMain.SearchBooth.disabled=false;	
}

function ResetControls(){	
	if(document.frmMain.ctlTexturing_ddlPavilion){		
		document.frmMain.ctlTexturing_ddlPavilion.selectedIndex=0;
	}
	if(document.frmMain.ctlTexturing_ddlCategory){
		document.frmMain.ctlTexturing_ddlCategory.selectedIndex=0;
	}
	if(document.frmMain.ctlTexturing_txtWidth){
		document.frmMain.ctlTexturing_txtWidth.value="";
	}
	if(document.frmMain.ctlTexturing_txtHeight){
		document.frmMain.ctlTexturing_txtHeight.value="";
	}
	if(document.frmMain.ctlTexturing_txtArea){
		document.frmMain.ctlTexturing_txtArea.value="";
	}
	if(document.frmMain.ctlTexturing_ddlHall){
		document.frmMain.ctlTexturing_ddlHall.selectedIndex=0;
	}
	if(document.frmMain.ctlTexturing_ddlBoothStatus){
		document.frmMain.ctlTexturing_ddlBoothStatus.selectedIndex=0;
	}
	if(document.frmMain.ctlTexturing_ddlSubExpo){
		document.frmMain.ctlTexturing_ddlSubExpo.selectedIndex=0;
	}
	if(document.frmMain.ctlTexturing_ddlMoveIn){
		document.frmMain.ctlTexturing_ddlMoveIn.selectedIndex=0;
	}
	if(document.frmMain.ctlTexturing_ddlMoveOut){
		document.frmMain.ctlTexturing_ddlMoveOut.selectedIndex=0;
	}
	if(document.frmMain.ctlTexturing_ddlCompOperator){
		document.frmMain.ctlTexturing_ddlCompOperator.selectedIndex=0;
	}
	if(document.frmMain.ctlTexturing_txtBoothNo){
		document.frmMain.ctlTexturing_txtBoothNo.value="";
	}
}
		
function setColorOnload(){	
	var i;
	var item;				
	var str;
	var collOptions = document.frmMain.ctlTexturing_ddlColor.options;			
	for(i=0;i<collOptions.length;i++){					
		item=collOptions[i];
		str=item.value;				
		item.style.backgroundColor="#"+item.value;
		item.text=" "				
	}
	swapColor();
}

function swapColor(){
	if (!document.all){
		var ddlColor = document.frmMain.ctlTexturing_ddlColor;
		ddlColor.style.backgroundColor="#"+ddlColor.value;
	}
}
		
		
function flipPinImage(){
	var src=new String;
	var alt=new String;
	src=document.getElementById("imgPin").src 
	if (src.indexOf("unpinned.gif")>0){    
		src=src.replace(/unpinned/,"pinned");
		alt="Pinned"
	}else{
		src=src.replace(/pinned/,"unpinned"); 
		alt="UnPinned"
	}  
	document.getElementById("imgPin").src = src;
	document.getElementById("imgPin").title = alt;
}

function floatMenu(){		
	var src=new String
	if(document.getElementById("imgPin")){
		src=document.getElementById("imgPin").src
		if(src.indexOf("unpinned.gif")<0) return true
	
		if(Print!='Yes'){	
			if (document.body.scrollTop <= document.getElementById("hdnImgTop").value-cpConstant){
				if(ProductType=="fp"){
					if(document.getElementById('ControlPanel')!=null)document.getElementById('ControlPanel').style.top = cpConstant;
				}else{
					if(document.getElementById('ControlPanel')!=null)document.getElementById('ControlPanel').style.top = document.getElementById('hdnImgTop').value-cpConstant;
				}
			}else{
				if(document.getElementById('ControlPanel')!=null)document.getElementById('ControlPanel').style.top = 0 + document.body.scrollTop;
			}
			if (document.body.scrollLeft <= document.getElementById("hdnImgLeft").value){
				if(document.getElementById('ControlPanel')!=null)document.getElementById('ControlPanel').style.left = document.getElementById("hdnImgLeft").value;
			}else{
				if(document.getElementById('ControlPanel')!=null)document.getElementById('ControlPanel').style.left = 0 + document.body.scrollLeft;
			}
		}
	}

}
window.onscroll = floatMenu;
	
function loadXMLDoc(url){
	if (window.XMLHttpRequest){
		req = new XMLHttpRequest();
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send(null);
	}else if (window.ActiveXObject){
		isIE = true;
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req){			
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send();
		}
	}
}

function processReqChange(){
	if (req.readyState == 4){
		if (req.status == 200){
			buildList();
		}
	}
}
		
function buildList(){
	var topPosition=0;
	var leftPosition=0;
	var items = req.responseXML.getElementsByTagName("INFO");
	if (strTask == 'Highlight'){
		if(items.length > 0){
			//alert("Your search produced a result.");
			//document.frmMain.SearchBooth.disabled=true;
		}else{
			alert("Your search did not produce a result");
		}
	}
	if (strTask == 'Highlight'){
		//alert(items.length);
		for (var i = 0; i < items.length; i++){
			BoothID=items[i].getAttribute("BOOTHID")
			img = "img"+ BoothID;							
			//BoothIDTag="BoothID"+ BoothID;
			BoothIDTag="img"+ BoothID;
			if(document.getElementById(BoothIDTag)!=null){
				if (document.getElementById(BoothIDTag).tagName=="AREA"){
					hightlightPoly(document.getElementById(BoothIDTag));
				}else{
					document.getElementById(BoothIDTag).style.filter = "Alpha(Opacity=100)";
					document.getElementById(img).src= "../images/booth/Booth_Highlighted.gif";
					document.getElementById(img).style.borderWidth=2;
					document.getElementById(img).style.borderColor = document.frmMain.ctlTexturing_ddlColor.value;
					document.getElementById(img).style.borderStyle="solid";
				}
				arrHighlightedBooths[count] = new Array();
				arrHighlightedBooths[count][0] = BoothID;
				arrHighlightedBooths[count][1] = document.frmMain.ctlTexturing_ddlColor.value.replace("#", "");
				count= count+1;
			}			
		}
		if (items.length > 0){
			if (document.getElementById(BoothIDTag).tagName=="AREA"){
				var vlocation=getCoords(document.getElementById(BoothIDTag));
				//Sumit Maingi Issue#11534
	            topPosition=eval(vlocation.y + 500)+"px";
	            leftPosition=vlocation.x+"px";
	            //[END] by Sumit Maingi
			}else{
				topPosition=document.getElementById(BoothIDTag).style.top;
				leftPosition=document.getElementById(BoothIDTag).style.left;
			}
			window.scrollTo(leftPosition.replace('px','')-window.screen.width/2,eval(topPosition.replace('px','')-window.screen.height/2));
		}		
	}	
}
//ravi
function MapbuildList(MapboothIDs){debugger
	var topPosition=0;
	var leftPosition=0;
	var items =MapboothIDs.split(",");		
		for (var i = 0; i < items.length; i++){
			BoothID=items[i]
			img = "img"+ BoothID;		
			BoothIDTag="img"+ BoothID;
			if(document.getElementById(BoothIDTag)!=null){
				if (document.getElementById(BoothIDTag).tagName=="AREA"){
					hightlightPoly(document.getElementById(BoothIDTag));
				}else{
					document.getElementById(BoothIDTag).style.filter = "Alpha(Opacity=100)";
					document.getElementById(img).src= "../images/booth/Booth_Highlighted.gif";
					document.getElementById(img).style.borderWidth=2;
					document.getElementById(img).style.borderColor = document.frmMain.ctlTexturing_ddlColor.value;
					document.getElementById(img).style.borderStyle="solid";
				}
				arrHighlightedBooths[count] = new Array();
				arrHighlightedBooths[count][0] = BoothID;
				arrHighlightedBooths[count][1] = document.frmMain.ctlTexturing_ddlColor.value.replace("#", "");
				count= count+1;
			}			
		}
		if (items.length > 0){
			if (document.getElementById(BoothIDTag).tagName=="AREA"){
				var vlocation=getCoords(document.getElementById(BoothIDTag));				
	            topPosition=eval(vlocation.y + 500)+"px";
	            leftPosition=vlocation.x+"px";	          
			}else{
				topPosition=document.getElementById(BoothIDTag).style.top;
				leftPosition=document.getElementById(BoothIDTag).style.left;
			}
			window.scrollTo(leftPosition.replace('px','')-window.screen.width/2,eval(topPosition.replace('px','')-window.screen.height/2));
		}		
	}	

//ravi
function appendToSelect(select, value, content){
	var opt;
	opt = document.createElement("option");
	opt.value = value;
	opt.appendChild(content);
	select.appendChild(opt);
}

function loadXML(XmlFile){				
	XMLDoc.async="false";
	XMLDoc.onreadystatechange=Verify;
	XMLDoc.load(XmlFile);
	XMLBoothDoc=XMLDoc.documentElement; 				      
}

function Verify(){ 
	if(XMLDoc.readyState!=4) return false; 	
}

function initTraverse(file){
	loadXMLDoc(file);				
}
		
function LocateBooth(){	
	var BoothID, img, boothLabelTag, BoothIDTag;
	var SalesPersonId=PavilionId=SubCatId=ProdCatId=AppId=Width=Height=Area=CompOrPart=HallId=MoveInId=MoveOutId=SubExpoID=0;
	var CompOperator, QueryString, BoothStatus ;	
	var StartDate = '';
	var EndDate = '';
	var LayOutOnly = '';
	var strSubProdCatText = '';	
	var BoothNo = '';
	BoothStatus = -1;
	if(document.frmMain.ctlTexturing_ddlPavilion){
		PavilionId=document.frmMain.ctlTexturing_ddlPavilion.value;
	}
	if(document.frmMain.ctlTexturing_ddlHall){
		HallId=document.frmMain.ctlTexturing_ddlHall.value;	
	}
	if(document.frmMain.ctlTexturing_ddlSubExpo){
		SubExpoID = document.frmMain.ctlTexturing_ddlSubExpo.value;	
	}
	if(document.frmMain.ctlTexturing_ddlMoveIn){
		MoveInId = document.frmMain.ctlTexturing_ddlMoveIn.value;
	}
	if(document.frmMain.ctlTexturing_ddlMoveIn){
		MoveOutId = document.frmMain.ctlTexturing_ddlMoveOut.value;
	}	
	var vEventId, vMapId;
	vEventId=(AEID!="")?AEID:EventId;
	vMapId=(IMID!="")?IMID:MapId;
	QueryString = "?EventId="+ vEventId +"&MapId="+ vMapId;
	
	if(document.frmMain.ctlTexturing_ddlCategory){
		ProdCatId=document.frmMain.ctlTexturing_ddlCategory.options[document.frmMain.ctlTexturing_ddlCategory.selectedIndex].value;
		strSubProdCatText = ProdCatId.substr(0, 1);			
		if (strSubProdCatText=="S"){
			SubCatId = ProdCatId.substr(1, ProdCatId.length-1);
			QueryString=QueryString + "&SubCatId=" + SubCatId;					
		}else{
			QueryString=QueryString + "&CatId=" + ProdCatId;
		}
	}
	
	if (document.frmMain.ctlTexturing_txtBoothNo.value != ""){			
		BoothNo=document.frmMain.ctlTexturing_txtBoothNo.value;
		QueryString=QueryString + "&BoothNo=" + BoothNo;
	}
	
	if(document.getElementById('chkAdvancedSearch').checked==true){
		if(document.frmMain.ctlTexturing_ddlBoothStatus){
			if (document.frmMain.ctlTexturing_ddlBoothStatus.value != "-1"){
				BoothStatus=document.frmMain.ctlTexturing_ddlBoothStatus.value;
				QueryString=QueryString + "&BoothStatus=" + BoothStatus;
			}
		}
		if (document.frmMain.ctlTexturing_txtWidth.value!='' && 
		    (isNaN(document.frmMain.ctlTexturing_txtWidth.value) || parseInt(document.frmMain.ctlTexturing_txtWidth.value)<=0)){
		    alert('Please enter valid value in "Width".');
		    return false;
		}
		if (document.frmMain.ctlTexturing_txtHeight.value!='' && 
		    (isNaN(document.frmMain.ctlTexturing_txtHeight.value) || parseInt(document.frmMain.ctlTexturing_txtHeight.value)<=0)){
		    alert('Please enter valid value in "Height".');
		    return false;
		}
		if (document.frmMain.ctlTexturing_txtWidth.value != ""){		
			Width=document.frmMain.ctlTexturing_txtWidth.value;
			if(strUnits != 'Inches'){
				Width = convertToInches(Width)/12;
			}
			QueryString=QueryString + "&Width=" + Width;
		}
		if (document.frmMain.ctlTexturing_txtHeight.value != ""){
			Height=document.frmMain.ctlTexturing_txtHeight.value;
			if(strUnits != 'Inches'){
				Height = convertToInches(Height)/12;
			}
			QueryString=QueryString + "&Height=" + Height;
		}
		if (document.frmMain.ctlTexturing_txtArea.value != ""){
			Area=document.frmMain.ctlTexturing_txtArea.value;
			CompOperator= document.frmMain.ctlTexturing_ddlCompOperator.value;	
			QueryString=QueryString + "&Area=" + Area + "&CompOperator=" + CompOperator;
		}	
		if (PavilionId > 0){
			QueryString= QueryString + "&PavilionID=" + PavilionId;
		}			    
		if (HallId > 0){
			QueryString= QueryString + "&HallID=" + HallId;
		}
		if (SubExpoID > 0){
			QueryString= QueryString + "&SubExpo=" + SubExpoID;
		}		
	}	
	
	if(!(PavilionId > 0 || ProdCatId > 0 || SubCatId > 0 || HallId > 0 || SubExpoID > 0 || MoveInId > 0 || MoveOutId || Width > 0 || Height > 0 || Area  > 0 || BoothStatus > -1 || BoothNo != '')){
		alert("Please select search criteria");
	}else{
		strTask = "Highlight";
		initTraverse(XMLFileName2 + QueryString);
	}		
}
		
function GeneratePdf(){
	var strArrHighlightedBooths = arrHighlightedBooths.join(", ");
	var vEventId, vMapId;
	vEventId=(AEID!="")?AEID:EventId;
	vMapId=(IMID!="")?IMID:MapId;
	var QString="?IMID="+ IMID +"&EventId="+ vEventId +"&MapId="+ vMapId;		
	if(document.getElementById("chkNoFill")!= null){
		if(document.getElementById("chkNoFill").checked==true){
			QString = QString + "&NoFill=False";
		}else{
			QString = QString + "&NoFill=True";
		}
	}else{
		QString = QString + "&NoFill=True";
	}
	document.frmMain.hdnBoothIds.value = strArrHighlightedBooths;
	document.frmMain.target = "_blank"
	document.frmMain.action = "GeneratePDF.aspx" + QString ;
	document.frmMain.__VIEWSTATE.name = 'NOVIEWSTATE';
	document.frmMain.submit();
	document.frmMain.target="";
	document.frmMain.action="";
}
		
function HidePanel(){	    
	if(document.getElementById('chkAdvancedSearch').checked==true){   
		document.getElementById('ctlTexturing_trAdvanced').style.display = '';    		         
		repositionfp(true);  		         
	}else{
		document.getElementById('ctlTexturing_trAdvanced').style.display = "none"
		repositionfp(false);
	}	
}
		
function hightlightPoly(objArea){
	var varTop = parseInt(document.getElementById("BasefloorPlan").style.top); 
	var varLeft = parseInt(document.getElementById("BasefloorPlan").style.left); 
	var arrCoords = objArea.coords.split(",");
	var arrX = new Array(); 
	var arrY = new Array(); 
	for (var intCount=0;intCount<arrCoords.length;intCount++){
		if ((intCount%2)==0) arrX[arrX.length]=parseInt(arrCoords[intCount]);
		else arrY[arrY.length]=parseInt(arrCoords[intCount]);
	}
	arrX[arrX.length]=parseInt(arrCoords[0]);
	arrY[arrY.length]=parseInt(arrCoords[1]);
	
	//unhightlightPoly();
	var ddlColor="#FF6633";
	if (document.frmMain.ctlTexturing_ddlColor){
	    ddlColor=document.frmMain.ctlTexturing_ddlColor.value;
	}
	var jg = new jsGraphics("dvCanvas");
	jg.setColor(ddlColor); 
	jg.setStroke(3); 
	jg.drawPolyline(arrX, arrY);
	jg.paint();	
	objArea.style.cursor="";
	var fpCanvas = document.getElementById("dvCanvas"); 
	fpCanvas.style.top=varTop+"px";
	fpCanvas.style.left=varLeft+"px";
}

function unhightlightPoly(){
	var fpCanvas = document.getElementById("dvCanvas");
	fpCanvas.innerHTML="";
}

function getCoords(vObject){
	var offsetX=0;
	var offsetY=0;
	var parent;
	for (parent=vObject;parent;parent=parent.offsetParent){
		if (parent.offsetLeft){
			offsetX += parent.offsetLeft;
		}
		if (parent.offsetTop){
			offsetY += parent.offsetTop;
		}
	}
	return {x:offsetX,y:offsetY};
}    
    
function repositionfp(blnexpand){ 
	var startTime, endTime;
	startTime = new Date();
	var Basefloorplan = document.getElementById("BasefloorPlan");
	var ControlPanel = document.getElementById("ControlPanel");
	var FloorPlan = document.getElementById("FloorPlan");
	if (blnexpand==true){
		Basefloorplan.style.top=(parseInt(Basefloorplan.style.top)+parseInt(ControlPanel.clientHeight)-80)+"px";
		FloorPlan.style.top=parseInt(Basefloorplan.style.top)-BaseflooorplanTop;
	}else{
		Basefloorplan.style.top=BaseflooorplanTop;
		FloorPlan.style.top="0px";
	} 
	endTime =new Date();
	//alert(startTime+"\n"+endTime);
	var fpCanvas = document.getElementById("dvCanvas"); 
	fpCanvas.style.top=document.getElementById("BasefloorPlan").style.top;
	fpCanvas.style.left=document.getElementById("BasefloorPlan").style.left;
}

function InStr(strSearch, charSearchFor){
	var arrSearch;
	arrSearch=strSearch.split(",");
	for (i=0; i < arrSearch.length; i++){		
		if (charSearchFor == arrSearch[i]){
			return i;
		}
	}
	return -1;
}

function clickBoothSO(pr,boothid,eventid,langid,AEID,BoothLabel,Area){    
	var isrchval;
    if (varCallback == 1) return false;
    if (document.getElementById('txtID').value!=''){
		var hdnBoothIds = document.getElementById('hdnBoothIds').value;
		if (hdnBoothIds.indexOf(",")==-1){
			if (document.getElementById('img'+hdnBoothIds).tagName=="AREA") {
				alert("Only single booth selection is allowed for poly booth(s)");
		        return false;
			}
		}
		if (document.getElementById('img'+boothid).tagName=="AREA") {
			alert("Multiple booth selections are not allowed for poly booth(s)");
		    return false;
		}		    
		isrchval= InStr(document.getElementById('txtID').value,BoothLabel);
        if (isrchval != -1) return false;
	}
       
    if (pr != 'Yes'){
		if (ids=='') ids=document.getElementById('hdnBoothIds').value; 
		if (ids=='') {
			ids=boothid;
			strlabels=BoothLabel;
		}else {
			if (strBSelMode=="S"){ 
	            alert("Only Single booth selection is allowed!!");
    	        return false;   	 
			}else {
		        ids=ids+","+boothid;		        
		        strlabels=document.getElementById('txtID').value+","+BoothLabel;	
    	    }
		}
		var blnSelected = true;	
		varCurArea=Area;
		if( SelectDeselectBooth(BoothLabel,boothid,Area)==false) return false;
		if (document.getElementById('hdnBoothIds')!=null) document.getElementById('hdnBoothIds').value=ids;
		document.getElementById('hdnBoothLabels').value=strlabels;
		
		if (document.getElementById('txtID')!=null){
			document.getElementById('txtID').value=strlabels;
		}
			
		var blndesel=false;
		CountBoothArea(Area,blndesel)
	}  
    if (ids.match(",")==",") {
		varCallback = 1;
		//starts Here Kishalaya for making save and proceed button in the sales office disabled till request is processed
		document.getElementById('btnAssign').disabled= true;
		//ends Here Kishalaya for making save and proceed button in the sales office disabled till request is processed
        sendRequest(ids + '__' + boothid + '__' + BoothLabel+'__'+ vartotalArea,'');
	}
}
		
function ResetAllVariables(){
	if (document.getElementById('hdnBoothIds')!=null){
		var strboothids1=""
		strboothids1=document.getElementById('hdnBoothIds').value
		document.getElementById('hdnBoothIds').value="";
		document.getElementById('hdnBoothLabels').value="";
		DeLocateBooths(strBoothIds);
		DeLocateBooths(strboothids1);	
	}
	strlabels="";
	ids="";
	vartotalArea=0;
	if (document.getElementById('txtID')!=null){
		document.getElementById('txtID').value = "";
	}
	if ((document.getElementById('lblMaxallowedArea')!=null) && (document.getElementById('hdnMaxallowed')!=null)){
		document.getElementById('lblMaxallowedArea').innerHTML =document.getElementById('hdnMaxallowed').value;
	}
	document.getElementById('lblSelectedArea').innerHTML="0";
	document.getElementById('hdnSelectedArea').value='';
}
		
function ValidateClick(){
	if (document.getElementById('txtID').value !=""){
		if((parseInt(document.getElementById('hdnMaxallowed').value) - parseInt(document.getElementById('hdnReservedArea').value)-parseInt(document.getElementById('lblSelectedArea').innerHTML))>=0)
			return true;
		else
		   alert("Please select the booth area less than or equal to maximum area allowed.");
		return false;
	}else{
	   alert("Please select booth(s).")
	   return false;
	}
}
		
function CountBoothArea(vararea,blndesel){
	if (document.getElementById('hdnBoothIds').value !=""){
		if (! blndesel){
			if (document.getElementById('hdnSelectedArea').value!=''){
				vartotalArea = eval(vararea) + parseInt(document.getElementById('hdnSelectedArea').value);
			}else{   
				vartotalArea = eval(vararea) + eval(vartotalArea);
			}
		} else	vartotalArea = eval(vartotalArea)- eval(vararea) ;
		if(document.getElementById('lblSelectedArea')!=null){
			document.getElementById('lblSelectedArea').innerHTML=parseInt(vartotalArea);
		}
	} else {
		document.getElementById('lblSelectedArea').innerHTML="0";
	}
	document.getElementById('hdnSelectedArea').value=vartotalArea;
}
		
function SelectDeselectBooth1(BoothLabel,BoothID,area){ 
	var strAllBoothIDItems
	var strAllBoothLblItems 
	var strSearch
	strAllBoothIDItems = document.getElementById('hdnBoothIds').value;
	strAllBoothLblItems =  document.getElementById('hdnBoothLabels').value;

	strSearch=strAllBoothLblItems.search(BoothLabel);						
	if (strSearch == -1){
		if (parseInt(area)> (parseInt(document.getElementById('hdnMaxallowed').value) - parseInt(document.getElementById('hdnReservedArea').value)-document.getElementById('lblSelectedArea').innerHTML)){  
			alert("You have exceeded your maximum selection");
			return false;
		}						
		if (document.getElementById('hdnBoothIds')!=null){ 
			document.getElementById('hdnBoothIds').value= document.getElementById('hdnBoothIds').value + "," + BoothID;
		}
		document.getElementById('hdnBoothLabels').value = document.getElementById('hdnBoothLabels').value + "," + BoothLabel;
		//boothIdTag="BoothID" + BoothID;
		boothIdTag="img" + BoothID;
		img = "img" + BoothID;
		if(document.getElementById(boothIdTag) != null){
			if (document.getElementById(boothIdTag).tagName=="AREA"){
				hightlightPoly(document.getElementById(boothIdTag));
			}else{
				document.getElementById(boothIdTag).style.filter = "Alpha(Opacity=100)"
				document.getElementById(img).src= "../images/booth/Booth_Highlighted.gif";
				document.getElementById(img).style.borderWidth=2;
				document.getElementById(img).style.borderColor="#FF6633"; 
				document.getElementById(img).style.borderStyle="solid";	
			}								
		}
	}else{												
		var strReplaceBoothLabel
		var strReplaceBoothID							
		if (strSearch == 0){							
			strReplaceBoothLabel=strAllBoothLblItems.search(",");
			if (strReplaceBoothLabel == -1){
				strReplaceBoothLabel=strAllBoothLblItems.replace(BoothLabel ,"")
				strlabels=strReplaceBoothLabel
				strReplaceBoothID=strAllBoothIDItems.replace(BoothID ,"")	
				ids=strReplaceBoothID	
				document.getElementById('hdnBoothIds').value=ids;
				document.getElementById('hdnBoothLabels').value=strlabels;	
				document.getElementById('txtID').value=strlabels;							
			}else{
				strReplaceBoothLabel=strAllBoothLblItems.replace(BoothLabel +",","")
				strlabels=strReplaceBoothLabel
				strReplaceBoothID=strAllBoothIDItems.replace(BoothID +",","")
				ids=strReplaceBoothID
				document.getElementById('hdnBoothIds').value=ids;
				document.getElementById('hdnBoothLabels').value=strlabels;
				document.getElementById('txtID').value=strlabels;
			}			   
			var img = "img" + BoothID;
			if (img){
				document.getElementById(img).src = "../images/booth/Booth_Highlighted.gif";
				document.getElementById(img).style.borderWidth=0;
				document.getElementById(img).style.borderColor="";
				document.getElementById(img).style.borderStyle="";
				document.getElementById(img).style.cursor = "hand";
			}
		}else{
			strReplaceBoothLabel=strAllBoothLblItems.replace("," +BoothLabel,"")
			strlabels=strReplaceBoothLabel
			strReplaceBoothID=strAllBoothIDItems.replace("," + BoothID,"")
			ids=strReplaceBoothID	
			document.getElementById('hdnBoothIds').value=ids;
			document.getElementById('hdnBoothLabels').value=strlabels;	
			document.getElementById('txtID').value=strlabels;						
			img = "img" + BoothID;
			if (img){
				document.getElementById(img).src = "../images/booth/Booth_Highlighted.gif";
				document.getElementById(img).style.borderWidth=0;
				document.getElementById(img).style.borderColor="";
				document.getElementById(img).style.borderStyle="";
				document.getElementById(img).style.cursor = "hand";
			}		
		}		
		blndesel=true;
		CountBoothArea(varCurArea,blndesel);
	}
}
					
function SelectDeselectBooth(BoothLabel,BoothID,area){
	var strAllBoothIDItems
	var strAllBoothLblItems 
	var strSearch
	strAllBoothIDItems = document.getElementById('hdnBoothIds').value;
	strAllBoothLblItems =  document.getElementById('hdnBoothLabels').value;
	strSearch=strAllBoothLblItems.search(BoothLabel);						
	if (strSearch == -1){
		if (parseInt(area)> (parseInt(document.getElementById('hdnMaxallowed').value) - parseInt(document.getElementById('hdnReservedArea').value)-document.getElementById('lblSelectedArea').innerHTML)) {  
			if (ids.search(",")==-1){
				ids = ids.replace(BoothID ,"");
				strlabels = strlabels.replace(BoothLabel,"");
			}else{
				ids = ids.replace(","+BoothID,"");
				strlabels = strlabels.replace(","+BoothLabel,"");
			}
			alert("You have exceeded your maximum selection.");
			return false;
		}
		if (document.getElementById('hdnBoothIds')!=null){ 
			document.getElementById('hdnBoothIds').value= document.getElementById('hdnBoothIds').value + "," + BoothID;
		}
		document.getElementById('hdnBoothLabels').value = document.getElementById('hdnBoothLabels').value + "," + BoothLabel;
		//boothIdTag="BoothID" + BoothID;
		boothIdTag="img" + BoothID;
		img = "img" + BoothID;
		if(document.getElementById(boothIdTag) != null){
			if (document.getElementById(boothIdTag).tagName=="AREA"){
				hightlightPoly(document.getElementById(boothIdTag));
			}else{
				document.getElementById(boothIdTag).style.filter = "Alpha(Opacity=100)"
				document.getElementById(img).src= "../images/booth/Booth_Highlighted.gif";
				document.getElementById(img).style.borderWidth=2;
				document.getElementById(img).style.borderColor="#FF6633"; 
				document.getElementById(img).style.borderStyle="solid";	
			}
		}
	}else{                
		var strReplaceBoothLabel
		var strReplaceBoothID							
		if (strSearch == 0){							
			strReplaceBoothLabel=strAllBoothLblItems.search(",");
			if (strReplaceBoothLabel == -1){
				strlabels=strAllBoothLblItems
				ids=strAllBoothIDItems	
				document.getElementById('hdnBoothIds').value=ids;
				document.getElementById('hdnBoothLabels').value=strlabels;	
				document.getElementById('txtID').value=strlabels;							
			}else{
				strlabels=strAllBoothLblItems
				ids=strAllBoothIDItems
				document.getElementById('hdnBoothIds').value=ids;
				document.getElementById('hdnBoothLabels').value=strlabels;
				document.getElementById('txtID').value=strlabels;
			}                   
		}else{
			strlabels=strAllBoothLblItems
			ids=strAllBoothIDItems	
			document.getElementById('hdnBoothIds').value=ids;
			document.getElementById('hdnBoothLabels').value=strlabels;	
			document.getElementById('txtID').value=strlabels;						                    
		}
		blndesel=true
		CountBoothArea(area,blndesel)												
	}											
}			
				
function onlyAlphaNumerics(){	
	var KeyCode = window.event.keyCode;
	if((KeyCode>=48 && KeyCode<=57) || KeyCode==8 || KeyCode==9 || (KeyCode>=96 && KeyCode<=105) || KeyCode==46 || (KeyCode>=37 && KeyCode<=40) || (KeyCode>=65 && KeyCode<=90)){
		return true;
	}
	return false;			
}	
				
		
function toggleStatus(s){
	var btnSubmit = document.getElementById("btnSubmit");
	btnSubmit.disabled =true;
	if (s.checked==true){
		btnSubmit.disabled =false;    
		btnSubmit.focus();
	} 
}

function showFeatures(winName, url){
    if (ValidExhibitor==0){
        document.getElementById("a_Companydetails").style.cursor="default";
        document.getElementById("a_fp").style.cursor="default";
        document.getElementById("a_payinfo").style.cursor="default";
        return 0;
	}else if (winName=="Index=2") {
	    if (strBoothids!="" && isValidSelection==true) {
	        window.location =url+ "?"+ winName;
	    }else {
	        alert(Msg1060);
	        document.getElementById("a_payinfo").style.cursor="default";
	        return 0;
		}
    }else{
	    window.location =url+ "?"+ winName;
	}
}

function EnableDisablePanel(PanelId){
	if(document.getElementById("trCardType")==null) return false;
    if (PanelId == 0){
		Page_ValidationActive=true;
        document.getElementById("trCardType").style.display = '';
        //document.getElementById("trPaymentDetails").style.display = '';
        document.getElementById("trExpDateEdit").style.display = '';
        document.getElementById("trCSVCodeEdit").style.display = '';
        document.getElementById("trCardNumberEdit").style.display = '';
        document.getElementById("trCardHolderName").style.display = '';       
        return 0;
	}
	if (PanelId == 1){
		Page_ValidationActive=false;
		document.getElementById("trCardType").style.display = 'None';
        document.getElementById("trPaymentDetails").style.display = 'None';
        document.getElementById("trExpDateEdit").style.display = 'None';
        document.getElementById("trCSVCodeEdit").style.display = 'None';
        document.getElementById("trCardNumberEdit").style.display = 'None';
        document.getElementById("trCardHolderName").style.display = 'None';   
        return 0;
	}
}

////////////// START CALLBACK RELATED FUNCTION ////////////////
function getResponse(arg, context) {
	document.body.style.cursor="auto";		    
	var strArg = new String(arg);
	if (strArg != ""){
		var arrArg = new Array();
		arrArg = strArg.split("__");		           	         
		var varboothid = arrArg[0];
		var varBoothLabel = arrArg[1];   
		ids = ids + "," + varboothid;
		strlabels = strlabels + "," + varBoothLabel;             
		SelectDeselectBooth1(varBoothLabel, varboothid);
		alert("Invalid selection - Please select adjacent booths.");                       
	}
	varCallback = 0;
	//starts Here Kishalaya for disabling save&proceed button in the sales office till request processed
	document.getElementById('btnAssign').disabled= false;
	//ends Here Kishalaya for disabling save&proceed button in the sales office till request processed
} 

function WebForm_CallbackComplete_SyncFixed() {            
	for (var i = 0; i < __pendingCallbacks.length; i++) {            
		callbackObject = __pendingCallbacks[i];
		if (callbackObject && callbackObject.xmlRequest && (callbackObject.xmlRequest.readyState == 4)) {            
			if (!__pendingCallbacks.async) {
				__synchronousCallBackIndex = -1;
			}
			__pendingCallbacks[i] = null;                
			var callbackFrameID = "__CALLBACKFRAME" + i;
			var xmlRequestFrame = document.getElementById(callbackFrameID);
			if (xmlRequestFrame) {
				xmlRequestFrame.parentNode.removeChild(xmlRequestFrame);
			}                
			WebForm_ExecuteCallback(callbackObject); 
		}
	}
}

if (typeof (WebForm_CallbackComplete) == "function") {        
	WebForm_CallbackComplete = WebForm_CallbackComplete_SyncFixed;
}
////////////// END CALLBACK RELATED FUNCTION ////////////////// 

var strhdnBoothArray;
function load_BoothSpans(){			        
    var url=pageRequested+document.getElementById("hdnBoothArray").value;
	try{
	    var xmlreq;
		if (window.ActiveXObject) {		
			xmlreq = new ActiveXObject("Microsoft.XMLHTTP")
		}else{
		    xmlreq = new XMLHttpRequest();
		}
		if (!xmlreq) return false;
		xmlreq.onreadystatechange=function(){
		    if (xmlreq.readyState!=4) return false;
		    if (xmlreq.status==200){
                this.onreadystatechange=null;
                strhdnBoothArray=xmlreq.responseText;
                setTimeout(createSpans,0);
                return true;
	        }else {
	            alert("Problem in retrieving XML data");
	            return false;
	        }
		}
        xmlreq.open("GET",url,true);
        xmlreq.send(null)		 		
	}catch(ex){		
		alert("Error occurred while retrieving XML data: "+ex.description);
		return false;
	}		        
}

var xmlDoc;
function createSpans(){
    var _xml=strhdnBoothArray;    
	var _images="";
    if (window.ActiveXObject) {
	    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");				
		if (!xmlDoc) return false;
		xmlDoc.async=false;				
		xmlDoc.loadXML(_xml);
		if(xmlDoc.selectNodes("//Image_Array").length){
		    _images=xmlDoc.selectNodes("//Image_Array")[0].xml;		
		}	    
	}else{
	    var parser = new DOMParser();
        xmlDoc = parser.parseFromString(_xml,"text/xml");
        _images = (new XMLSerializer()).serializeToString(xmlDoc.getElementsByTagName("Image_Array")[0]);        
    }
    _images=_images.replace("<Image_Array>","");
    _images=_images.replace("</Image_Array>","");	
    if(_images !=""){
        var areaTags = document.getElementById("FloorPlan").innerHTML;
        document.getElementById("FloorPlan").innerHTML=areaTags+_images;
        LocateBooths(strBoothids); 
    }    
}

function fn(thisObject,ev){
    var BoothID;
    BoothID= thisObject.id.replace("img","");    
	if (x_loadXML(BoothID)) {
		if (!varBoothLabel) return false;
		if (thisObject.onmouseout==null) 
	    thisObject.onmouseout=resolve;
	    if (varLink!=""){
	        if (thisObject.onclick==null)
	        thisObject.onclick=function (){clickBooth(varPrint,varLink,BoothID,varEventID,varLangID,ProductType,varBoothArea,varBoothLabel)};
	    }		
		var popuptext="Booth:"+varBoothLabel+"</br>Size:"+varBoothSize;
		if (varStatus!=""){
		    popuptext+="</br>"+varStatus;
		}
		popup(ev,varPrint,popuptext);
	}//else alert("false...");
}

function x_loadXML(varBoothID){ 		
	try{
	    if (window.ActiveXObject) {
	        if (!xmlDoc){
	            var _xml=document.getElementById("hdnBoothArray").value;
			    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");				
			    if (!xmlDoc) return false;
			    xmlDoc.async=false;				
			    xmlDoc.loadXML(_xml);
			}	
			varBoothLabel = xmlDoc.selectSingleNode("//Booth_Array[@BoothID='"+varBoothID+"']/@BoothLabel").text;
	        varBoothStatus = xmlDoc.selectSingleNode("//Booth_Array[@BoothID='"+varBoothID+"']/@BoothStatusID").text;
	        varBoothSize = xmlDoc.selectSingleNode("//Booth_Array[@BoothID='"+varBoothID+"']/@BoothSize").text;
	        varBoothArea = xmlDoc.selectSingleNode("//Booth_Array[@BoothID='"+varBoothID+"']/@BoothArea").text;
	        varStatus = xmlDoc.selectSingleNode("//Booth_Array[@BoothID='"+varBoothID+"']/@Status").text;
	        varPrint = xmlDoc.selectSingleNode("//Booth_Array[@BoothID='"+varBoothID+"']/@RequestPrint").text;
	        varLink = xmlDoc.selectSingleNode("//Booth_Array[@BoothID='"+varBoothID+"']/@Link").text;
	        varEventID = xmlDoc.selectSingleNode("//Booth_Array[@BoothID='"+varBoothID+"']/@EventID").text;
	        varLangID = xmlDoc.selectSingleNode("//Booth_Array[@BoothID='"+varBoothID+"']/@LangID").text;	            	        
		}else{
		    if (!xmlDoc){
		        var _xml=document.getElementById("hdnBoothArray").value;
		        var parser = new DOMParser();
                xmlDoc = parser.parseFromString(xmlString,"text/xml"); 
            }
            varBoothLabel = xmlDoc.evaluate("//Booth_Array[@BoothID='"+varBoothID+"']/@BoothLabel", xmlDoc, null, XPathResult.STRING_TYPE, null).stringValue;
		    varBoothStatus = xmlDoc.evaluate("//Booth_Array[@BoothID='"+varBoothID+"']/@BoothStatusID", xmlDoc, null, XPathResult.STRING_TYPE, null).stringValue;
		    varBoothSize = xmlDoc.evaluate("//Booth_Array[@BoothID='"+varBoothID+"']/@BoothSize", xmlDoc, null, XPathResult.STRING_TYPE, null).stringValue;
		    varBoothArea = xmlDoc.evaluate("//Booth_Array[@BoothID='"+varBoothID+"']/@BoothArea", xmlDoc, null, XPathResult.STRING_TYPE, null).stringValue;
		    varStatus = xmlDoc.evaluate("//Booth_Array[@BoothID='"+varBoothID+"']/@Status", xmlDoc, null, XPathResult.STRING_TYPE, null).stringValue;
		    varPrint = xmlDoc.evaluate("//Booth_Array[@BoothID='"+varBoothID+"']/@RequestPrint", xmlDoc, null, XPathResult.STRING_TYPE, null).stringValue;
		    varLink = xmlDoc.evaluate("//Booth_Array[@BoothID='"+varBoothID+"']/@Link", xmlDoc, null, XPathResult.STRING_TYPE, null).stringValue;	        
		    varEventID = xmlDoc.evaluate("//Booth_Array[@BoothID='"+varBoothID+"']/@EventID", xmlDoc, null, XPathResult.STRING_TYPE, null).stringValue;
	        varLangID = xmlDoc.evaluate("//Booth_Array[@BoothID='"+varBoothID+"']/@LangID", xmlDoc, null, XPathResult.STRING_TYPE, null).stringValue;	        
		}		 
		return true;
	}catch(ex){
		alert("Error occurred while retrieving XML data: "+ex.description);
		return false;
	}		        
}
