var IE = document.all?true:false;
var checkBoxItems = { "options" : [],
                      "country" : [],
                      "state"   : []};
                     
var addHocAttendees = { "attendeeIDs" : []};

var removedAttendees = { "removedIDs" : []};





function checkGreenBoxes()
{
	if(document.getElementById("ctl00_MainContent_wzrdUSerAgent_ctlMyProfile_P_ExporterInfo1_rptExportCategory_ctl00_rdListExportSubCategory_0").checked == false && document.getElementById("ctl00_MainContent_wzrdUSerAgent_ctlMyProfile_P_ExporterInfo1_rptExportCategory_ctl00_rdListExportSubCategory_1").checked == false)
	{
		
		document.getElementById("ctl00_MainContent_wzrdUSerAgent_ctlMyProfile_P_ExporterInfo1_rptExportCategory_ctl00_rdListExportSubCategory_0").focus();
	}

}

function doWork()
{
alert('here');
}

function directTraffick(id,max)
{

var ids = $get('ctl00_LeftNav_jsonText').value


$get('ctl00_LeftNav_totalSessions').value = max;
var sessionids = new Array();
sessionids = ids.split(",");


var json = "sessions = { 'ids' : [";
for(var i = 0; i < sessionids.length-1; i++)
{
	
}

document.getElementById("ctl00_LeftNav_idForSession").value = id;
__doPostBack('ctl00_LeftNav_btnUpdate', '');


}

function ShowSessionSearchEventTypes()
{
    document.getElementById("SessionSearchSponsorArea").style.display = "none";
    document.getElementById("ctl00_LeftNav_searchResults").style.display = "none";
    document.getElementById("SessionSearchDates").style.display = "none";
    document.getElementById("SessionSearchTracks").style.display = "none";
    document.getElementById("SessionSearchPowerSearch").style.display = "none";

    document.getElementById("searchValue").value = "true";
    document.getElementById("oneBoxChecked").value = "false";
    clearCheckBoxes();
    document.getElementById("SessionSearchEventTypes").style.display = "block";
    
}

function ShowSessionSearchDates()
{
    
    document.getElementById("SessionSearchSponsorArea").style.display = "none";
    document.getElementById("ctl00_LeftNav_searchResults").style.display = "none";
    document.getElementById("SessionSearchEventTypes").style.display = "none";
    document.getElementById("SessionSearchTracks").style.display = "none";
    document.getElementById("SessionSearchPowerSearch").style.display = "none";
	 
    document.getElementById("searchValue").value = "true";
    document.getElementById("oneBoxChecked").value = "false";
    clearCheckBoxes();
    document.getElementById("SessionSearchDates").style.display = "block";
    

    

   
}

function ShowSessionSearchTracks()
{
    document.getElementById("SessionSearchSponsorArea").style.display = "none";
    document.getElementById("ctl00_LeftNav_searchResults").style.display = "none";
    document.getElementById("SessionSearchEventTypes").style.display = "none";
    document.getElementById("SessionSearchDates").style.display = "none";
    document.getElementById("SessionSearchPowerSearch").style.display = "none";

    document.getElementById("searchValue").value = "true";
    document.getElementById("oneBoxChecked").value = "false";
    clearCheckBoxes();
    document.getElementById("SessionSearchTracks").style.display = "block";
    
}

function ShowSessionSearchPowerSearch()
{
    document.getElementById("SessionSearchSponsorArea").style.display = "none";
    document.getElementById("ctl00_LeftNav_searchResults").style.display = "none";
    document.getElementById("SessionSearchEventTypes").style.display = "none";
    document.getElementById("SessionSearchDates").style.display = "none";
    document.getElementById("SessionSearchTracks").style.display = "none";
    document.getElementById('errorMsg').style.display = "none";
    document.getElementById("searchValue").value = "true";
    document.getElementById("oneBoxChecked").value = "false";
    clearCheckBoxes();
    
    document.getElementById("SessionSearchPowerSearch").style.display = "block";
    
}

function clearCheckBoxes()
{
	var cbs = document.getElementsByTagName("input");
	for (var i = 0; i < cbs.length-1; i++)
	{
		if(cbs[i].checked == true)
		{					    
			cbs[i].checked = false;
		}
	}

}

function ClearForm()
{
	var cbs = document.getElementsByTagName("input");
	var count = 0;
	var attendees = new Array();
	var attendeeList = document.getElementById("ctl00_MainContent_attendeesToCheck").value;
	attendees = attendeeList.split(",");

	for (var i = 0; i < cbs.length-1; i++)
	{
		var theID = cbs[i].id
		
		for(var j = 0; j < attendees.length-1; j++)
		{
			var sessRegex = attendees[j];	
			
			var shorten = theID.match(sessRegex);
			
			if(shorten != null)
			{
			        if(cbs[i].checked == true)
				    {					    
				    	cbs[i].checked = false;
				    }
			}
		}
	}
	addHocAttendees.attendeeIDs = [];
	removedAttendees.removedIDs = [];
	document.getElementById("ctl00_MainContent_excludedAttendees").value = "";
	document.getElementById("ctl00_MainContent_adHocBox").value = "";
}


function emailAllAttendees(group)
{
hanleywood.com.iservice1.GetData(group,CallBackSingle);
}

function storeExhibitorValues(coid,pos,frompage,query)
{

var loc = "" + window.location;
var reg1 = "nz_elmymatches_att"
var reg2 = "nz_elattendeesearch"
var sess = "";
loc = loc.toLowerCase();	
var shorten = loc.match(reg1);
var trim = loc.match(reg2);

if(shorten != null)
{
 sess = "0";
}
if(trim != null)
{
 sess = "1";
}



var url = "AttendeeDetails.aspx?ContactID=" + coid + "&IndexInList=" + pos + "&FromPage=" + frompage + query;
hanleywood.com.istore.StoreData(document.getElementById("ctl00_MainContent_adHocBox").value,document.getElementById("ctl00_MainContent_command").value,document.getElementById("ctl00_MainContent_attendeesToCheck").value,document.getElementById("ctl00_MainContent_excludedAttendees").value,sess,showResult);
window.location = url;
}

function storeJsonValues()
{
	
	hanleywood.com.istore.StoreData("jim",showResult);
	
}

function showResult( WebServiceResult )
{
//alert("val= " + WebServiceResult.toString());

}

function CallBackSingle( WebServiceResult )
{
//alert("val= " + WebServiceResult.toString());
doMessageCenter(WebServiceResult.toString());
}

function resizeImages(path,savePath,width,height)
{
	
hanleywood.com.iresizeimage.ResizeTheImage(path,savePath,width,height,ImageChangedSuccess,ImageChangedFailed);
}

function ImageChangedSuccess( WebServiceResult )
{
    alert('good ' + WebServiceResult);
}
function ImageChangedFailed( WebServiceResult )
{
    alert(WebServiceResult);
}

function selectAllMatchAttendees(type)
{

var val = false;

if(document.getElementById("selectAll").checked == false)
{
	val = true;
	document.getElementById("selectAll").checked = true;
	document.getElementById("ctl00_MainContent_attendeeMatchResult_selectAllTF").value = "all";
}
else
{
	val = false;
	document.getElementById("selectAll").checked = false;
	document.getElementById("ctl00_MainContent_attendeeMatchResult_selectAllTF").value = "";
}
for (var i = 0; i < attendees.length-1; i++)
{
	attendees[i].EmailFlag = val;
}

var elLength = document.aspnetForm.elements.length;
for (i=0; i<elLength; i++)
{
	var type = document.aspnetForm.elements[i].type;
	if (type=="checkbox")
	{
		var currentBox = document.aspnetForm.elements[i].id;
		if(val == true)
		{
			document.getElementById(currentBox).checked = true;
		}
		else{
			document.getElementById(currentBox).checked = false;
		}			
	}
}
serializeAttendeeMatchList();

}

function hideMatchElement()
{    
    
    var x = document.getElementById("ctl00_MainContent_dialog");
    var y = document.getElementById("ctl00_MainContent_attendeeMatchResult_dialog");
	
    if(x != null)
    {
        x.style.display='none';
    }
    if(y != null)
    {
        y.style.display='none';
    }
    
}

function saveAttendeeMatchList()
{    
    var change = 'saved';
    var name = document.getElementById("ctl00_MainContent_attendeeMatchResult_groupname").value;
    var title = document.getElementById("titleTF").value;
    var desc  = document.getElementById("descriptionTF").value;
    hanleywood.com.imodaldialog.SaveAttendeeSearch(change,name,"",title,desc,attendeeSaved);
}

function selectAllAttendees(type)
{
//alert("" + attendees.length);
//alert(attendees[0].ContactID);

var val = false;

if(document.getElementById("selectAll").checked == false)
{
	val = true;
	document.getElementById("selectAll").checked = true;
	document.getElementById("ctl00_MainContent_attendeeResult_selectAllTF").value = "all";
}
else
{
	val = false;
	document.getElementById("selectAll").checked = false;
	document.getElementById("ctl00_MainContent_attendeeResult_selectAllTF").value = "";
}
for (var i = 0; i < attendees.length-1; i++)
{
	attendees[i].EmailFlag = val;
}

var elLength = document.aspnetForm.elements.length;
for (i=0; i<elLength; i++)
{
	var type = document.aspnetForm.elements[i].type;
	if (type=="checkbox")
	{
		var currentBox = document.aspnetForm.elements[i].id;
		if(val == true)
		{
			document.getElementById(currentBox).checked = true;
		}
		else{
			document.getElementById(currentBox).checked = false;
		}			
	}
}
serializeAttendeeList();
/*
var cbs = document.getElementsByTagName("input");
var count = 0;
var attendees = new Array();
var attendeeList = document.getElementById("ctl00_MainContent_attendeesToCheck").value;
var firstMatch = true;
if(type == "all")
{
	document.getElementById("ctl00_MainContent_command").value = "all";		
}
else{ 
	
	document.getElementById("ctl00_MainContent_command").value = "saved";
	attendeeList  = document.getElementById("ctl00_MainContent_adHocBox").value;
	
    }
attendees = attendeeList.split(",");

	for (var i = 0; i < cbs.length-1; i++) //loop through all of the check boxes on the page.  Go through and see if the box on the page corresponds with one of the ids that needs to be checked
	{
		var theID = cbs[i].id //this is the check box that the loop is currently on.
		
		for(var j = 0; j < attendees.length-1; j++)  //loop through all of the ids in the attendeesToCheck text field
		{
			var sessRegex = attendees[j];	//this is the id the loop is currently on.
			
			var shorten = theID.match(sessRegex);
			
			if(shorten != null)
			{
				if(firstMatch == true)
				{
					
					if(cbs[i].checked == false) //if the box has not been checked then we will test to see if it is ok to check it
					{
					    var okToAdd = true;
					    	
			            var ignoreThese = new Array(); //it is not ok to check it if it is supposed to be omitted.  If it is to be omitted then its id will match one of the ids in the removedIds text field
			            var boxesToIgnore = document.getElementById("ctl00_MainContent_excludedAttendees").value;
			            ignoreThese = boxesToIgnore.split(",");
			            
			            if(ignoreThese.length-1 == 0 )
			            {
			                okToAdd = true;			                 
			            }
			            else
			            {
                            
                            for(k=0; k<ignoreThese.length-1;k++)
                            {
                                var sessRegex1 = ignoreThese[k];
                                var check = theID.match(sessRegex1);
                                
                                if(check != null && check != "")
                                {
                                    
                                    okToAdd = false;
                                    break;
                                }
                            }
                        }
			            
			            
					    if(okToAdd)
					    {
					        document.getElementById("ctl00_MainContent_selectAllAttendees").value = cbs[i].name + ",";
					        cbs[i].checked = true;
					        firstMatch = false;
					    }
					}
					else{
					        cbs[i].checked = false; firstMatch = false;
					        
					        document.getElementById("ctl00_MainContent_selectAllAttendees").value = "";
					        document.getElementById("ctl00_MainContent_excludedAttendees").value = "";
					        document.getElementById("ctl00_MainContent_adHocBox").value = "";
					    }
				}
				else{
				        if(cbs[i].checked == false)
					    {
					        
					        var okToAdd = true;					    	
			                var ignoreThese = new Array(); //it is not ok to check it if it is supposed to be omitted.  If it is to be omitted then its id will match one of the ids in the removedIds text field
			                var boxesToIgnore = document.getElementById("ctl00_MainContent_excludedAttendees").value;
			                ignoreThese = boxesToIgnore.split(",");
    			            
			                if(ignoreThese.length-1 == 0 )
			                {
			                    okToAdd = true;			                 
			                }
			                else
			                {
                                for(k=0; k<ignoreThese.length-1;k++)
                                {
					                var sessRegex1 = ignoreThese[k];
                                    var check = theID.match(sessRegex1);
                                    if(check != null)
                                    {
                                        okToAdd = false;
                                        break;
                                    }
					            }
					        }
					        
					        if(okToAdd)
					        {
					            document.getElementById("ctl00_MainContent_selectAllAttendees").value += cbs[i].name + ",";
					            cbs[i].checked = true;
					        }
					    //cbs[i].disabled = true;
					    }
					    else{
					            document.getElementById("ctl00_MainContent_selectAllAttendees").value = "";
					            document.getElementById("ctl00_MainContent_excludedAttendees").value = "";
					            document.getElementById("ctl00_MainContent_adHocBox").value = "";
					            cbs[i].checked = false;
					            //cbs[i].disabled = false;
					            document.getElementById("ctl00_MainContent_command").value = "";
					            
					        }
				    }
				break;
			}
		}
		
	}
*/
}

function hideElement()
{    
    
    var x = document.getElementById("ctl00_MainContent_dialog");
    var y = document.getElementById("ctl00_MainContent_attendeeResult_dialog");
	var z = document.getElementById("ctl00_MainContent_attendeeMatchResult_dialog");
	
    if(x != null)
    {
        x.style.display='none';
    }
    if(y != null)
    {
        y.style.display='none';
    }
	if(z != null)
    {
        z.style.display='none';
    }
    
}

function saveAttendeeList()
{    
    var change = 'saved';
    var name = document.getElementById("ctl00_MainContent_attendeeResult_groupname").value;
    var title = document.getElementById("titleTF").value;
    var desc  = document.getElementById("descriptionTF").value;
    hanleywood.com.imodaldialog.SaveAttendeeSearch(change,name,"",title,desc,attendeeSaved);
}

function saveAttendeeMatchList()
{    
    var change = 'saved';
    var name = document.getElementById("ctl00_MainContent_attendeeMatchResult_groupname").value;
    var title = document.getElementById("titleTF").value;
    var desc  = document.getElementById("descriptionTF").value;
    hanleywood.com.imodaldialog.SaveAttendeeSearch(change,name,"",title,desc,attendeeSaved);
}



function attendeeSaved( WebServiceResult )
{
    hideElement();
}


function selectAllAttendeesbqm(type)
{

var cbs = document.getElementsByTagName("input");
var count = 0;
var attendees = new Array();
var attendeeList = document.getElementById("ctl00_MainContent_attendeesToCheck").value;

var firstMatch = true;
if(type == "all")
{
	document.getElementById("ctl00_MainContent_command").value = "all";	
}
else{ 
	
	document.getElementById("ctl00_MainContent_command").value = "saved";
	attendeeList  = document.getElementById("ctl00_MainContent_adHocBox").value;
	
    }
attendees = attendeeList.split(",");

	for (var i = 0; i < cbs.length-1; i++) //loop through all of the check boxes on the page.  Go through and see if the box on the page corresponds with one of the ids that needs to be checked
	{
		var theID = cbs[i].id //this is the check box that the loop is currently on.
		
		for(var j = 0; j < attendees.length-1; j++)  //loop through all of the ids in the attendeesToCheck text field
		{
			var sessRegex = attendees[j];	//this is the id the loop is currently on.
			
			var shorten = theID.match(sessRegex);
			
			if(shorten != null)
			{
				if(firstMatch == true)
				{
					
					if(cbs[i].checked == false) //if the box has not been checked then we will test to see if it is ok to check it
					{
					    var okToAdd = true;
					    	
			            var ignoreThese = new Array(); //it is not ok to check it if it is supposed to be omitted.  If it is to be omitted then its id will match one of the ids in the removedIds text field
			            var boxesToIgnore = document.getElementById("ctl00_MainContent_excludedAttendees").value;
			            ignoreThese = boxesToIgnore.split(",");
			            
			            if(ignoreThese.length-1 == 0 )
			            {
			                okToAdd = true;			                 
			            }
			            else
			            {
                            
                            for(k=0; k<ignoreThese.length-1;k++)
                            {
                                var sessRegex1 = ignoreThese[k];
                                var check = theID.match(sessRegex1);
                                
                                if(check != null && check != "")
                                {
                                    
                                    okToAdd = false;
                                    break;
                                }
                            }
                        }
			            
			            
					    if(okToAdd)
					    {
					        document.getElementById("ctl00_MainContent_selectAllAttendees").value = cbs[i].name + ",";
					        cbs[i].checked = true;
					        firstMatch = false;
					    }
					}
					else{
					        cbs[i].checked = false; firstMatch = false;
					        
					        document.getElementById("ctl00_MainContent_selectAllAttendees").value = "";
					        document.getElementById("ctl00_MainContent_excludedAttendees").value = "";
					        document.getElementById("ctl00_MainContent_adHocBox").value = "";
					    }
				}
				else{
				        if(cbs[i].checked == false)
					    {
					        
					        var okToAdd = true;					    	
			                var ignoreThese = new Array(); //it is not ok to check it if it is supposed to be omitted.  If it is to be omitted then its id will match one of the ids in the removedIds text field
			                var boxesToIgnore = document.getElementById("ctl00_MainContent_excludedAttendees").value;
			                ignoreThese = boxesToIgnore.split(",");
    			            
			                if(ignoreThese.length-1 == 0 )
			                {
			                    okToAdd = true;			                 
			                }
			                else
			                {
                                for(k=0; k<ignoreThese.length-1;k++)
                                {
					                var sessRegex1 = ignoreThese[k];
                                    var check = theID.match(sessRegex1);
                                    if(check != null)
                                    {
                                        okToAdd = false;
                                        break;
                                    }
					            }
					        }
					        
					        if(okToAdd)
					        {
					            document.getElementById("ctl00_MainContent_selectAllAttendees").value += cbs[i].name + ",";
					            cbs[i].checked = true;
					        }
					    //cbs[i].disabled = true;
					    }
					    else{
					            document.getElementById("ctl00_MainContent_selectAllAttendees").value = "";
					            document.getElementById("ctl00_MainContent_excludedAttendees").value = "";
					            document.getElementById("ctl00_MainContent_adHocBox").value = "";
					            cbs[i].checked = false;
					            //cbs[i].disabled = false;
					            document.getElementById("ctl00_MainContent_command").value = "";
					            
					        }
				    }
				break;
			}
		}

		
		
	}
    
    //if(document.getElementById("ctl00_MainContent_adHocBox").value != "" || document.getElementById("ctl00_MainContent_selectAllAttendees").value != "")
    //{
        //document.getElementById("emailChecked").disabled = false;
    //}
    //else
    //{
        //document.getElementById("emailChecked").disabled = true;
    //}
}

function openQuotientWindow(ecode, groupid, url, boothid, coid, frompage, pagename, contact, event)
{

var wholeURL;
if(groupid != "")
{
wholeURL = url + "?Ecode=" + ecode + "&system=emails&GroupID="+groupid + "&BoothID=" + boothid + "&CoID="+coid + "&Pagename=" + pagename + "&EventID=" + event + "&ContactID=" + contact
}
else{  wholeURL = url + "?Ecode=" + ecode + "&system=emails" + "&BoothID=" + boothid + "&CoID="+coid + "&Pagename=" + pagename + "&EventID=" + event + "&ContactID=" + contact;  }

document.body.innerHTML += '<form id="quotientEmail" action="' + wholeURL + '" method="post" target="doMessageCenter()"></form>';
document.getElementById("quotientEmail").submit();

    if(frompage != "")
    {
    window.location = "/connect/public/"+frompage
    }
    else { window.location = "/connect/public/closePage.html"; }

}
function closeWindow(){setTimeout(function(){window.close();}, 10000);}
function showFloorPlan(url)
{
window.open(url);
}
function goBackPage()
{
history.back();
document.getElementById("ctl00_MainContent_lbone").style.display="none";
document.getElementById("ctl00_MainContent_lbtwo").style.display="none";

}
function showMyListing(boothurl)
{
    
    xmlHttp=GetXmlHttpObject();
	
    if (xmlHttp==null)
    {
      alert ("Your browser does not support AJAX!");
      return;
    } 
    
    var url="getSessionDataForListing.aspx";
    
    xmlHttp.onreadystatechange=stateHasChanged;
    xmlHttp.open("GET",url,true);
    
    xmlHttp.send(null);

}

function stateHasChanged()
{
    
    if (xmlHttp.readyState==4)
    {
        var text = xmlHttp.responseText;
	
	var sessRegex = "^[0-9]*";
	
	var text1 = text.match(sessRegex);
	
        window.location = "/connect/public/booth.aspx?boothid=" + text1;
        
    }

}



function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function ClearTextbox()
{

document.getElementById("ctl00_MainContent_keySearch").value ="";
}

function showHideSubCats(category,controlID)
{
	
	
	var x = "cb" + controlID;
	var sub = "subcb"+controlID;
	var con = "divc"+controlID;	
	var checkbox = document.aspnetForm.elements[x];
	var elLength = document.aspnetForm.elements.length;	
	var subl = "subl"+controlID;
	var doc = document.getElementsByTagName('div');
	
	
	
	if(document.aspnetForm.elements[x].checked == true)
	{
		
		for (var i = 0; i < doc.length; i++)
		{
  
   			

			
			if(doc[i].id == con)
			{
				
				doc[i].style.display = "inline";
				 
				document.aspnetForm.elements[x].checked = false; 
			}
		}

	}
	else{ 
		
		for (var i = 0; i < doc.length; i++)
		{
  
   			
			
			
			if(doc[i].id == con)
			{
				
				doc[i].style.display = "none";
				 
				document.aspnetForm.elements[x].checked = true; 
			}
		}
	    }




	

	
}

function keyWordSearch()
{
    
    document.getElementById("ctl00_MainContent_catValues").value = "";	
    var keysearchVal = document.aspnetForm.elements["ctl00_MainContent_keySearch"].value;
	
    if(keysearchVal.length > 0 & keysearchVal != "Keyword Search")
    {
    	document.getElementById("ctl00_MainContent_catValues").value += keysearchVal + "$Keyword|";
    }
}
function AttendeeKeyWordSearch()
{
    
    document.getElementById("ctl00_MainContent_catValues").value = "";	
    var keysearchVal = document.aspnetForm.elements["ctl00_MainContent_keySearch"].value;
	
    if(keysearchVal.length > 0 & keysearchVal != "Keyword Search")
    {
    	document.getElementById("ctl00_MainContent_catValues").value += "Keyword|" + keysearchVal + "$";
    }
}


function saveToAgent()
{

    var elLength = document.aspnetForm.elements.length;

    var tier = "";
	var temp = ""	
	
    document.getElementById("ctl00_MainContent_catValues").value = "";	
   
    
    for (i=0; i<elLength; i++)
    {
        var type = document.aspnetForm.elements[i].type;
	
        if (type=="checkbox" && document.aspnetForm.elements[i].checked)
	    {
            if(tier == "")
	        {		
		        tier = document.aspnetForm.elements[i].category;	
            }
	    
	        temp = document.aspnetForm.elements[i].category;
	    
	        if(tier != temp)
	        {    			
		        document.getElementById("ctl00_MainContent_catValues").value += tier + "|";
		        tier = document.aspnetForm.elements[i].category;    		
	        }
	    
	        var id = document.aspnetForm.elements[i].id;
    	    
	        var group = "" + document.aspnetForm.elements[i].name;
	        document.getElementById("ctl00_MainContent_catValues").value+=id;       
			
	        if(group == "main")
	        {
		        document.getElementById("ctl00_MainContent_catValues").value+="$";
	        }
	        if(group == "sub" || group == "country" || group == "state")
	        {
		        document.getElementById("ctl00_MainContent_catValues").value+=",";
	        }    
			
	    
        }
	
        else if (type=="text") {
         
		//document.getElementById("ctl00$MainContent$catValues").value += document.aspnetForm.elements["ctl00$MainContent$keySearch"].value + "$Keyword|";
        }
        else {
        }
    }
		
    document.getElementById("ctl00_MainContent_catValues").value += tier + "|";
}

function addToItems(e)
{


var option = e.value;

//for(i=0; i < addHocAttendees.attendeeIDs.length; i++)
  //      { 
    //        if(addHocAttendees.attendeeIDs[i].attendeeid == checkboxID)
      //      {
        //        addHocAttendees.attendeeIDs.splice(i,1);
          //  }
        //} 


//var checkBoxID = window.event.srcElement.id;
var checkBoxID = e.id;
var addItem = true;    
    if(checkBoxID < 1000)
    {
        for (i=0; i < checkBoxItems.country.length; i++) 
        {
            var cid = checkBoxItems.country[i].countryid;
            var compare = checkBoxID;
            if(cid == compare)
            {
                checkBoxItems.country.splice(i,1);
                addItem = false;
            }
            
        }
        if(addItem == true)
        {
            var val;
            if(checkBoxItems.country.length-1 < 0)
            {
                val = 0;
            }
            else
            {
                checkBoxItems.country.push("{\"countryid\" : \"\"}");
                val = checkBoxItems.country.length-1;
                                
            }
            checkBoxItems.country[val] = {"countryid" : checkBoxID};
                        
        }
    }
    else
    {
        for (i=0; i < checkBoxItems.options.length; i++) 
        {
            var oid = checkBoxItems.options[i].optionid;
            var compare = checkBoxID;
                        
            if(oid == compare)
            {                
                checkBoxItems.options.splice(i,1);
                addItem = false;                
            }
            
        }
        
        if(addItem == true)
        {
            
            var val;
            if(checkBoxItems.options.length-1 < 0)
            {
                val = 0;
            }
            else
            {
                checkBoxItems.options.push("{\"optionid\" : \"\"}");
                val = checkBoxItems.options.length-1;
                
                                
            }
            checkBoxItems.options[val] = {"optionid" : checkBoxID};
            
                        
        }
    }
}

function addStateItem(value, e)
{
    var option = e.value;
    var checkBoxID = e.id;
    var parentC = e.alt;
    var addItem = true;    
        
        for (i=0; i < checkBoxItems.country.length; i++) 
        {
            var cid = checkBoxItems.country[i];
            var compare = "countryid : " + value;
            if(cid == compare)
            {
                checkBoxItems.country.splice(i,1);  
                addItem = false;              
            }
            
        }
            
    
        for (i=0; i < checkBoxItems.state.length; i++) 
        {
            var oid = checkBoxItems.state[i].stateid;
            
            
            
            var compare = checkBoxID;
                        
            if(oid == compare)
            {                
                checkBoxItems.state.splice(i,1);
                addItem = false; 
                        
            }
            
        }
        if(addItem == true)
        { 
            var val;
            if(checkBoxItems.state.length-1 < 0)
            {
                val = 0;
            }
            else
            {
                checkBoxItems.state.push("{\"stateid\" : \"\",\"parentCountry\" : \"\"}");
                val = checkBoxItems.state.length-1;
                                
            }
            checkBoxItems.state[val] = {"stateid" : checkBoxID, "parentCountry" : parentC};
                 
                 
        }
       

}

function setAttendeeSearchValues()
{
        var testChecked = allBoxesChecked();
        if(testChecked > 0)
        {
            if(testChecked == 1)
            {
                document.getElementById('ctl00_MainContent_errorDiv').innerHTML='<p>All boxes in a single category can not be checked</p>';
                document.getElementById('ctl00_MainContent_errorDiv').focus()
                return false;
            }
            if(testChecked == 2)
            {
                document.getElementById('ctl00_MainContent_errorDiv').innerHTML='<p>No check boxes selected, please select an option.</p>';
                document.getElementById('ctl00_MainContent_errorDiv').focus()
                return false;
            }
        }
        else
        {
            document.getElementById("ctl00_MainContent_catValues").value = "";
            var countries = [];
            var states = "";
            
            if(checkBoxItems.options.length > 0)
            {
                document.getElementById("ctl00_MainContent_catValues").value += "option search|";
            }
            
            for (i=0; i < checkBoxItems.options.length; i++) 
            {
                document.getElementById("ctl00_MainContent_catValues").value += checkBoxItems.options[i].optionid +","            
                
            }
            
            if(checkBoxItems.country.length > 0)
            {
                document.getElementById("ctl00_MainContent_catValues").value += "$Country|";
            }
            for (i=0; i < checkBoxItems.country.length; i++) 
            {
                  document.getElementById("ctl00_MainContent_catValues").value += checkBoxItems.country[i].countryid +","
                  countries.push(checkBoxItems.country[i].countryid);            
            }
            
            for (i=0; i < checkBoxItems.state.length; i++) 
            {
                
                if(countries.length > 0)
                {
                    var added = true;
                    for(j=0; j < countries.length; j++)
                    {
                        var cItem = countries[j];
                        
                        
                        if(checkBoxItems.state[i].parentCountry == cItem)
                        {
                            
                            
                            added = false;
                            
                        }
                    }
                    if(added)
                    {
                        states += checkBoxItems.state[i].stateid + ","
                       
                    }
                }
                else
                {
                    states += checkBoxItems.state[i].stateid + ","
                
                }
                
            }
            
            if(states.length > 1)
            {
                document.getElementById("ctl00_MainContent_catValues").value += "$States|" + states;        
            }
            return true;

        }



}//end of function


function allBoxesChecked()
{
        var cbs = document.getElementsByTagName("input");
        var prev = ""
        var count = 0;
        var runningTotal = 0;
        var firstMatch = true;
        
        var countryCount = 0;
        var countryTotal = 0;
        var anychecked = false
        
        
        
        for (var i = 0; i < cbs.length-1; i++)   
	    {
		    var type = document.aspnetForm.elements[i].type;
		    if (type=="checkbox" || type=="submit")
		    {   
		    
		        var curr = cbs[i].alt;
		        if(firstMatch)
		        {
		            prev = curr;
		            firstMatch = false;
		        }
		        if(curr == prev)
		        {
		            count++;
		        }
		        if(cbs[i].value == "Country")
		        {
		            countryTotal++;
		            if(cbs[i].checked)
		            {
		                countryCount++;
		                anychecked = true;
		            }
		        }
		        
		        if(cbs[i].value == "States")
		        {		            
		            if(cbs[i].checked)
		            {		                
		                anychecked = true;
		            }
		        }
		        
		        if(cbs[i].checked && cbs[i].value != "Country" && cbs[i].value != "States")
		        {
		            anychecked = true;
		            if(curr == prev)
		            {
		                runningTotal++;
		            }
		        }
    		    
		        if(curr != prev && cbs[i].value != "Country" && cbs[i].value != "States")
		        {
		            if(count == runningTotal)
		            {
		                return 1;
		            }
		            else
		            {
		                runningTotal = 0;
		                if(cbs[i].checked)
		                {
		                    runningTotal++;
		                }
		                count = 1;
		                prev = curr;
		            }
		        }
		        
		    }
		    
		} 
		
		if(countryTotal == 0)
        {
            countryTotal = 20;
        }
		if(countryCount == countryTotal)
		{
		   return 1;
		}
		
		if(anychecked == false)
		{
		    
		    return 2;
		}
        return 0;
}

function setCheckBoxes()
{
	
	var elLength = document.aspnetForm.elements.length;
	for (i=0; i<elLength; i++)
    {
		var type = document.aspnetForm.elements[i].type;
		if (type=="checkbox")
		{
			var currentBox = document.aspnetForm.elements[i].id;
			if(checkThisBox(currentBox))
			{
				document.getElementById(currentBox).checked = true;
			}
			else{
				document.getElementById(currentBox).checked = false;
			}			
		}
	}		
}

function checkThisBox(id)
{	
	
	for(var j = 0; j < attendees.length; j++)
	{
		if(attendees[j].ContactID == id)
		{
			if(attendees[j].EmailFlag == true)
			{
				return true;
			}
			else{
				return false;
			}
		}
	}
}

function serializeAttendeeList()
{	
	var attendeeList = "";
	
	attendeeList = "[";
	for(var j = 0; j < attendees.length-1; j++)
	{ 
		attendeeList += "{\"ContactID\":" + attendees[j].ContactID + ",\"EmailFlag\":" + attendees[j].EmailFlag + "},";		
	} 
	
	attendeeList += "{\"ContactID\":" + attendees[attendees.length-1].ContactID + ",\"EmailFlag\":" + attendees[attendees.length-1].EmailFlag + "}]";
	
	document.getElementById("ctl00_MainContent_attendeeResult_jsonTF").value = attendeeList;
}

function serializeAttendeeMatchList()
{	
	var attendeeList = "";
	
	attendeeList = "[";
	for(var j = 0; j < attendees.length-1; j++)
	{ 
		attendeeList += "{\"ContactID\":" + attendees[j].ContactID + ",\"EmailFlag\":" + attendees[j].EmailFlag + "},";		
	} 
	
	attendeeList += "{\"ContactID\":" + attendees[attendees.length-1].ContactID + ",\"EmailFlag\":" + attendees[attendees.length-1].EmailFlag + "}]";
	
	document.getElementById("ctl00_MainContent_attendeeMatchResult_jsonTF").value = attendeeList;
}

function setMailFlag(e)
{
	var checkBoxState = e.checked;
	
		for(var j = 0; j < attendees.length; j++)
		{
				if(attendees[j].ContactID == e.id)
				{
					attendees[j].EmailFlag = checkBoxState;
				}			
		}  	
	serializeAttendeeList()
	switchEmailButton();
}

function setMailMatchFlag(e)
{
	var checkBoxState = e.checked;
	
		for(var j = 0; j < attendees.length; j++)
		{
				if(attendees[j].ContactID == e.id)
				{
					attendees[j].EmailFlag = checkBoxState;
				}			
		}  	
	serializeAttendeeMatchList()
	
}

function switchEmailButton()
{	
	if(document.getElementById("ctl00_MainContent_attendeeResult_searchComplete").value == "")
	{
	
		for(var j = 0; j < attendees.length; j++)
		{
				if(attendees[j].EmailFlag == true)
				{					
					enableEmailButton();
					break;
				}	
				else
				{
					disableEmailButton();
				}
		} 
	
	}
}

function reCheckBoxes(optionsids,countriesids,statesids)
{		
	var options = new Array();
	var countries = new Array();
	var states = new Array();
	
    options = optionsids.split(",");
	countries = countriesids.split(",");
	states = statesids.split(",");
	
	var elLength = document.aspnetForm.elements.length;
	for (i=0; i<elLength; i++)
    {
		var type = document.aspnetForm.elements[i].type;
		if (type=="checkbox")
		{			
			var currentBox = document.aspnetForm.elements[i].id;		
			var category = document.getElementById(currentBox).name
			
			if(category = "option")
			{
				
				for(var j=0; j<options.length; j++)
				{					
					
					if (currentBox == options[j])
					{
						document.getElementById(currentBox).checked = true;
					}
				}
			}
			if(category = "main")
			{
				for(var k=0; k<countries.length; k++)
				{
					if (currentBox == countries[k])
					{
						document.getElementById(currentBox).checked = true;
					}
				}
			}
			if(category = "state")
			{
				for(var m=0; m<states.length; m++)
				{
					if (currentBox == states[m])
					{
						document.getElementById(currentBox).checked = true;
					}
				}
			}
		}
	}
}

function checkForDups(item, value)
{
    var addItem = true;
    
    if(value == "option search")
    {
    
        for (h=0; h < checkBoxItems.options.length; h++) 
        {
         var oid = checkBoxItems.options[h].optionid;
         var compare = item;
                                                       
         if(oid == compare)
         {                
                            
          addItem = false;                
         }
                                            
        }
    }
    if(value == "Country")
    {
        for (l=0; l < checkBoxItems.country.length; l++) 
        {
            var cid = checkBoxItems.country[l].countryid;
            var compare = checkBoxID;
            if(cid == compare)
            {
                
                addItem = false;
            }
            
        }
    
    }
    return addItem

}



function enableSelectAll()
{
	if(document.getElementById("ctl00_MainContent_P_SeachResults1_selectAllB") != null)
	{
		document.getElementById("ctl00_MainContent_P_SeachResults1_selectAllB").disabled = false;
	}
}

function disableSelectAll()
{
var element = document.getElementById("ctl00_MainContent_P_SeachResults1_selectAllB");
	if(element != null)
	{
	document.getElementById("ctl00_MainContent_P_SeachResults1_selectAllB").disabled = true;
	}
}

function enableSaveButton()
{
var element = document.getElementById("saveAttendeeSearchButton");
	if(element != null)
	{
	document.getElementById("saveAttendeeSearchButton").disabled = false;
	}
}
function disableSaveButton()
{

var element = document.getElementById("saveAttendeeSearchButton");
	if(element != null)
	{
	document.getElementById("saveAttendeeSearchButton").disabled = true;
	}
}

function enableEmailButton()
{
var element = document.getElementById("emailChecked");
	if(element != null)
	{
	document.getElementById("emailChecked").disabled = false;
	}
}
function disableEmailButton()
{

var element = document.getElementById("emailChecked");
	if(element != null)
	{
	document.getElementById("emailChecked").disabled = true;
	}
}

function openSearch(val)
{

document.getElementById("ctl00_MainContent_hdnCharIndex").value = "";
document.getElementById("ctl00_MainContent_searchValue").value = val;
//document.getElementById("sponsorArea").style.display = "none";

document.forms[0].submit();
}

function openAttendeeSearch()
{
	
	if($get("results") != null)
	{		
		$get("results").style.display = "none";
	}
	
}

function uncheckMain(val)
{
for (i=0; i < checkBoxItems.country.length; i++) 
        {
            var cid = checkBoxItems.country[i].countryid;
            
            if(cid == val)
            {
                checkBoxItems.country.splice(i,1);
                
            }
            
        }
document.getElementById(val).checked = false;

}

function uncheckAll()
{
var elLength = document.aspnetForm.elements.length;
    var tier = "";	
	

    for (i=0; i<elLength; i++)
    {
	tier = document.aspnetForm.elements[i].value;
	if(tier =="SubAlpha")
	{
		
	}
    }
}


function checkAll(category,id,e)
{

    var item = "";	
    var sub = ""+id;
    var elLength = document.aspnetForm.elements.length;	
    var start = -1; // this will be used to find where the first state instance is in the json array
    var killStates = false; //this will decide if there are states to remove from the json array or not
    var stateCount = 0;  //this idicates how many states to be removed
    var checkBoxState = e.checked;
    

    for (i=0; i<elLength; i++)
    {
	    if(category == "product")
	    {    		
		    item = document.aspnetForm.elements[i].alt
    		
		    if(item == sub)
		    {
			    if(document.aspnetForm.elements[i].checked)
			    {	
				    document.aspnetForm.elements[i].checked = false;
			    }
			    else{ document.aspnetForm.elements[i].checked = true; }    			
		    }    		
	    }

	    if(category == "country")
	    {
    		
		    item = document.aspnetForm.elements[i].alt;
		    cat = document.aspnetForm.elements[i].value;
    		
		    if(item == sub && cat != "product")
		    {
    			
			    if(checkBoxState == false)
			    {	
				    document.aspnetForm.elements[i].checked = false;
				    killStates = true;			    
			    }
			    else{ 
			            if(document.aspnetForm.elements[i].checked == false)
			            {
			                document.aspnetForm.elements[i].checked = true; 
			                
			                
			                var val;
                            if(checkBoxItems.state.length-1 < 0)
                            {
                                val = 0;
                            }
                            else
                            {
                                checkBoxItems.state.push("{\"stateid\" : \"\",\"parentCountry\" : \"\"}");
                                val = checkBoxItems.state.length-1;
                                
                            }
                            
                            checkBoxItems.state[val] = {"stateid" : document.aspnetForm.elements[i].id, "parentCountry" : sub};
			                killStates = false;
			                
			            }
			            
			        }
    			
		    }
		
	    }
    }
    
    
    
    if(killStates == true)
    {
        
        for (i=0; i < checkBoxItems.state.length; i++) 
        {
            
            if(checkBoxItems.state[i].parentCountry == sub)
            {
                checkBoxItems.state.splice(i,1);
                i = i-1;
            }
        }
    }
}
function addRemoveAdHoc(checkboxID,e)
{
    var checkBoxState = e.checked;
    document.getElementById("ctl00_MainContent_adHocBox").value = "";
    document.getElementById("ctl00_MainContent_excludedAttendees").value = "";
    
   
    
    if(checkBoxState == true)
    {
        for(i=0; i<removedAttendees.removedIDs.length; i++)
        { 
            if(removedAttendees.removedIDs[i].removedid == checkboxID)
            {
                removedAttendees.removedIDs.splice(i,1);
            }
        } 
    
        var val;
        if(addHocAttendees.attendeeIDs.length-1 < 0)
        {
             
             val = 0;
             addHocAttendees.attendeeIDs.push("{\"attendeeid\" : \"\"}");
             
        }
        else
        {
             addHocAttendees.attendeeIDs.push("{\"attendeeid\" : \"\"}");
             val = addHocAttendees.attendeeIDs.length-1;
                                
        }
                            
        addHocAttendees.attendeeIDs[val] = {"attendeeid" : checkboxID};
        
    }
    else
    {
        for(i=0; i<addHocAttendees.attendeeIDs.length; i++)
        { 
            if(addHocAttendees.attendeeIDs[i].attendeeid == checkboxID)
            {
                addHocAttendees.attendeeIDs.splice(i,1);
            }
        }        
        var val;
        if(removedAttendees.removedIDs.length-1 < 0)
        {
             
             val = 0;
             removedAttendees.removedIDs.push("{\"removedid\" : \"\"}");
             
        }
        else
        {
             removedAttendees.removedIDs.push("{\"removedid\" : \"\"}");
             val = removedAttendees.removedIDs.length-1;
                                
        }
                            
        removedAttendees.removedIDs[val] = {"removedid" : checkboxID};
    
    }
    
    for(i=0; i<addHocAttendees.attendeeIDs.length; i++)
    {        
        document.getElementById("ctl00_MainContent_adHocBox").value += addHocAttendees.attendeeIDs[i].attendeeid + ",";
        
    }
    
    for(i=0; i<removedAttendees.removedIDs.length; i++)
    {  
        document.getElementById("ctl00_MainContent_excludedAttendees").value += removedAttendees.removedIDs[i].removedid + ",";
    }
    if(document.getElementById("ctl00_MainContent_adHocBox").value != '')
	{
		if(document.getElementById("saveAttendeeSearchButton") != null)
		{
		    document.getElementById("saveAttendeeSearchButton").disabled = true;
		}
		enableEmailButton()
	}
	else
	{
		var hasValues = document.getElementById("ctl00_MainContent_catValues").value;
		var adHocHasValues = document.getElementById("ctl00_MainContent_adHocBox").value;
		var anyChecked = false;
		var cbs = document.getElementsByTagName("input");
		
		for (var i = 0; i < cbs.length-1; i++) //loop through all of the check boxes on the page to see if any of them are checked.  
	    {
		    if(cbs[i].checked)
		    {
		        anyChecked = true;
		    }
		}
		
		if(hasValues != "")
		{
			document.getElementById("saveAttendeeSearchButton").disabled = false;
		} 
		if(adHocHasValues == "" && hasValues == "" && anyChecked == false)
		{
			disableEmailButton();
		}
	}	
    //var command = document.getElementById("ctl00_MainContent_command").value
    
    //if(removedAttendees.removedIDs.length > 0 && command == "all")
    //{
        //document.getElementById("ctl00_MainContent_command").value = "most"    
    //}
    
    //alert(removedAttendees.removedIDs.length + "," + command);
    
    //if(removedAttendees.removedIDs.length == 0 && command == "most")
    //{
        //document.getElementById("ctl00_MainContent_command").value = "all"    
    //}

}

function jsonIDManager(checkboxID,e)
{
    var checkBoxState = e;
    document.getElementById("ctl00_MainContent_adHocBox").value = "";
    document.getElementById("ctl00_MainContent_excludedAttendees").value = "";
    
    
    
    if(checkBoxState == 'adhoc')
    {
        for(i=0; i<removedAttendees.removedIDs.length; i++)
        { 
            if(removedAttendees.removedIDs[i].removedid == checkboxID)
            {
                removedAttendees.removedIDs.splice(i,1);
            }
        } 
    
        var val;
        if(addHocAttendees.attendeeIDs.length-1 < 0)
        {
             
             val = 0;
             addHocAttendees.attendeeIDs.push("{\"attendeeid\" : \"\"}");
             
        }
        else
        {
             addHocAttendees.attendeeIDs.push("{\"attendeeid\" : \"\"}");
             val = addHocAttendees.attendeeIDs.length-1;
                                
        }
                            
        addHocAttendees.attendeeIDs[val] = {"attendeeid" : checkboxID};
         
        
    }
    else
    {
        for(i=0; i<addHocAttendees.attendeeIDs.length; i++)
        { 
            if(addHocAttendees.attendeeIDs[i].attendeeid == checkboxID)
            {
                addHocAttendees.attendeeIDs.splice(i,1);
            }
        }        
        var val;
        if(removedAttendees.removedIDs.length-1 < 0)
        {
             
             val = 0;
             removedAttendees.removedIDs.push("{\"removedid\" : \"\"}");
             
        }
        else
        {
             removedAttendees.removedIDs.push("{\"removedid\" : \"\"}");
             val = removedAttendees.removedIDs.length-1;
                                
        }
                            
        removedAttendees.removedIDs[val] = {"removedid" : checkboxID};
    
    }
    
    for(i=0; i<addHocAttendees.attendeeIDs.length; i++)
    {        
        document.getElementById("ctl00_MainContent_adHocBox").value += addHocAttendees.attendeeIDs[i].attendeeid + ",";
        
    }
    
    for(i=0; i<removedAttendees.removedIDs.length; i++)
    {  
        document.getElementById("ctl00_MainContent_excludedAttendees").value += removedAttendees.removedIDs[i].removedid + ",";
    }
    if(document.getElementById("ctl00_MainContent_adHocBox").value != '')
	{
	   
		if(document.getElementById("saveAttendeeSearchButton") != null)
		{
		    document.getElementById("saveAttendeeSearchButton").disabled = true;
		}
		enableEmailButton()
	}
	else
	{
		var hasValues = document.getElementById("ctl00_MainContent_catValues").value;
		var adHocHasValues = document.getElementById("ctl00_MainContent_adHocBox").value;
		var anyChecked = false;
		var cbs = document.getElementsByTagName("input");
		
		for (var i = 0; i < cbs.length-1; i++) //loop through all of the check boxes on the page to see if any of them are checked.  
	    {
		    if(cbs[i].checked)
		    {
		        anyChecked = true;
		    }
		}
		
		if(hasValues != "")
		{
			document.getElementById("saveAttendeeSearchButton").disabled = false;
		} 
		if(adHocHasValues == "" && hasValues == "" && anyChecked == false)
		{
			disableEmailButton();
		}
	}	    

}

function jsonCheckBoxIDManager()
{
    var val;
    var allids = "" + document.getElementById("ctl00_MainContent_catValues").value;
    //var regexpr = new RegExp("option search|");
    var cats = new Array();
    cats = allids.split("$");
    for(var j = 0; j < cats.length; j++)
    {
        var sessRegex = "option search|";
        var item = "" + cats[j]
	    var text1 = item.substring(0,13);        
        if(text1 == "option search")
        {
        
            var newidlist=cats[j].replace("option search|","");
            var options = new Array();
            
	        options = newidlist.split(",");
        	
            for(var i = 0; i < options.length-1; i++)
            {
                if(checkBoxItems.options.length-1 < 0)
                {
                    val = 0;
                    checkBoxItems.options[val] = {"optionid" : options[i]}; 
                }
                else
                {
                    checkBoxItems.options.push("{\"optionid\" : \"\"}");
                    val = checkBoxItems.options.length-1; 
                    checkBoxItems.options[val] = {"optionid" : options[i]};
                }
                
            }
        }
    }
}

function addRemoveAdHoc1(checkboxID)
{
	var codes = document.getElementById("ctl00_MainContent_adHocBox").value
	if(codes.length > 0)
	{
		var start = -1
		start = codes.indexOf(checkboxID);
		if(start > -1)
		{
		        var end   = codes.indexOf(',', start);
			end = end + 1;
			var front = codes.substring(0,start);
			var back  = codes.substring(end,codes.length);
			var newCodes = "" + front+back;
			document.getElementById("ctl00_MainContent_adHocBox").value = newCodes;
			//document.getElementById("ctl00_MainContent_excludedAttendees").value = 
		}
		else{ document.getElementById("ctl00_MainContent_adHocBox").value+=checkboxID + ","; }
		
		
	}
	else	{ 
			document.getElementById("ctl00_MainContent_adHocBox").value+=checkboxID + ","; 
			
		}
	if(document.getElementById("ctl00_MainContent_adHocBox").value != '')
	{
		document.getElementById("saveAttendeeSearchButton").disabled = true;
		enableEmailButton()
	}
	else{
		var hasValues = document.getElementById("ctl00_MainContent_catValues").value;
		var adHocHasValues = document.getElementById("ctl00_MainContent_adHocBox").value;
		if(hasValues != "")
		{
			document.getElementById("saveAttendeeSearchButton").disabled = false;
		} 
		if(adHocHasValues == "" && hasValues == "")
		{
			disableEmailButton();
		}
	    }	
}


function Setfocus(){
    window.scrollTo(0,0);
    //document.documentbody.scrollTo(0,0);
    }

function clearSearchCriteria(){
   document.getElementById("ctl00_MainContent_hdnCharIndex").value="";
   document.getElementById("ctl00_MainContent_hdnpageIndex").value="";
   document.getElementById("ctl00_MainContent_hdnsortby").value="";
   window.scrollTo(0,0);
 }

function emailCheckedAttendees(){
	document.getElementById("ctl00_MainContent_emailTF").value="email";


}

function setKeyboardKey(e) {
    var key = (window.Event) ? e.which : e.keyCode;
	
	var stringKey = "" + key;
    if (stringKey == "13") {
		document.getElementById("ctl00_LeftNav_keyboardKey").value = key;
        return false;
    }

}

function executeOnload(){
    /* if (document.getElementById('ctl00$ctlP_welcomeNav$ddlBooth')){
        document.getElementById('ctl00$ctlP_welcomeNav$ddlBooth').className='expandableDropdown';
    } */
    if (document.getElementById('ctl00_pnloverDiv')){
        document.getElementById('ctl00_pnloverDiv').display='none';
    }
    TableRowColorHoverInit();
    reset_eAPanel();
    }
 
function keepup(ev,tdelement,blncalpopup) {
	var cursor = cursorPosition(ev);
    var top 
    if (blncalpopup)
    top = document.getElementById("ctl00_pnloverDiv");
    else top=document.getElementById("overDiv");
    top.style.position = 'absolute';
    if (!blncalpopup){
    top.style.top = cursor.y +20+ 'px';
    top.style.left = cursor.x + 'px'; //+35+ 'px';  
    }
    else{
    top.style.top = cursor.y+2+'px'; //+ 20 + 'px';
    top.style.left = cursor.x-20+ 'px'; //+35+ 'px';  
    }
    //initialize()  
}

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 popup (ev,str,tdelement,varhref){
if (str=='')str="Details not available"; else str="<b><u>Details</u> : </b> "+str;
//    if (document.all) document.getElementById("dvdetail").innerText=str; 
//    else document.getElementById("dvdetail").textContent=str;
    document.getElementById("dvdetail").innerHTML=str; 
	document.getElementById("ahref").href=varhref
	keepup(ev,tdelement,true); 
	document.getElementById("ctl00_pnloverDiv").style.display = '';	
}

function Calpopup (ev,str,tdelement,varhref){
   document.getElementById("overDiv").innerHTML=str; 
   //document.getElementById("ahref").style.display='none'
   keepup(ev,tdelement,false); 
   document.getElementById("overDiv").style.display = '';	
   document.getElementById("overDiv").style.height='auto';
   
}


function resolve(){
	if(document.getElementById("ctl00_pnloverDiv"))document.getElementById("ctl00_pnloverDiv").style.display = 'none';
	if(document.getElementById("overDiv"))document.getElementById("overDiv").style.display = 'none';
}

var intOpacity;
var t;
function initialize(){
	intOpacity=1;
	animate();
}
function animate(){
		document.getElementById("ctl00_pnloverDiv").style.filter="Alpha(Opacity="+intOpacity+")";
		intOpacity=intOpacity+1;
		if (intOpacity<=88) {
			t=setTimeout(animate,1);
		}else {
			clearTimeout(t);
		}
	}
	

function showFeatures(winName, url){

	window.open(url, winName);
	return false;
}

var activeMTab, activeSTab;
var blnPostback=false; blnExecuted=false;
var timeout;

function setActiveTab(){
    if (document.getElementById("dvSubNav")){
    var dvSubNav = document.getElementById("dvSubNav");
    for (var elCount=0;elCount<dvSubNav.getElementsByTagName("A").length;elCount++){
        if (dvSubNav.getElementsByTagName("A")[elCount].className=="dvSubNavspanaActive") {
            activeSTab = elCount;
            break;
        }
    }
    }
    var dvMainnav = document.getElementById("dvMainnav");
    for (var elCount=0;elCount<dvMainnav.getElementsByTagName("A").length;elCount++){
        if (dvMainnav.getElementsByTagName("A")[elCount].className=="dvMainnavspanaActive") {
            activeMTab = dvMainnav.getElementsByTagName("A")[elCount];
            break;
        }
    }
}

function returnActive(vlogin){
    if (activeMTab){
        blnExecuted=true;
        createSubmenus(activeMTab,vlogin); 
        activeMTab.className="dvMainnavspanaActive";
        highlightSubmenus();
        if (document.getElementById("dvSubNav")){
        document.getElementById("dvSubNav").getElementsByTagName("A")[activeSTab].className="dvSubNavspanaActive";
        }
        blnExecuted=false;            
    }
}

function handleTimeout(vlogin){
    if (blnPostback==false) {
        setActiveTab();
        blnPostback = true;                
    }
    if (blnExecuted==false) {
        clearTimeout(timeout);
        timeout=setTimeout(function (){returnActive(vlogin)},2000);
    }
}

function highlightSubmenus(ATag,varLogin){  
    handleTimeout(varLogin);
    if (document.getElementById("dvSubNav")){
    var dvSubNav = document.getElementById("dvSubNav");
    for (var elCount=0;elCount<dvSubNav.getElementsByTagName("A").length;elCount++){
        dvSubNav.getElementsByTagName("A")[elCount].className="";
    }
    }
    if (ATag) ATag.className="dvSubNavspanahover";
}

function createSubmenus(ATag,varLogin){
    handleTimeout(varLogin);
    if (window.ActiveXObject){
        transformXML_IE(ATag.nameProp,varLogin);
    }else if (document.implementation && document.implementation.createDocument){
        transformXML_NonIE(ATag.href,varLogin);
    }
    
    var dvMainnav = document.getElementById("dvMainnav");
    for (var elCount=0;elCount<dvMainnav.getElementsByTagName("A").length;elCount++){
        dvMainnav.getElementsByTagName("A")[elCount].className="";
    }
    ATag.className="dvMainnavspanahover";    
}

var xmldoc,xsldoc;
function transformXML_IE(pname,plogin){
    if(!xmldoc || !xsldoc){
        xmldoc = new ActiveXObject("Microsoft.XMLDOM"); 
        xmldoc.async = false;                     
        xsldoc = new ActiveXObject("Microsoft.XMLDOM"); 
        xsldoc.async = false;
        xmldoc.load("../include/XSLT/NetzoneMenu.xml"); 
        xsldoc.load("../include/XSLT/NetzoneMenu.xsl");
    }
    xsldoc.getElementsByTagName("xsl:param")[0].nodeTypedValue = plogin;    
    xsldoc.getElementsByTagName("xsl:param")[1].nodeTypedValue = pname;
    xsldoc.getElementsByTagName("xsl:param")[2].nodeTypedValue = "1";
    if (document.getElementById("dvSubNav")){
    document.getElementById("dvSubNav").innerHTML = xmldoc.transformNode(xsldoc);    
}
}

var xsltProcessor,xmlSource;
function transformXML_NonIE(pname,plogin){
    if(!xsltProcessor || !xmlSource){
        var xslStylesheet,xmlSource;
        var xsltProcessor = new XSLTProcessor();
        var xmlRequest;
        
        xmlRequest = new XMLHttpRequest();
        xmlRequest.open("GET", "../include/XSLT/NetzoneMenu.xsl", false);
        xmlRequest.send(null);        
        xslStylesheet = xmlRequest.responseXML;
        xsltProcessor.importStylesheet(xslStylesheet);
        
        xmlRequest = new XMLHttpRequest();
        xmlRequest.open("GET", "../include/XSLT/NetzoneMenu.xml", false);
        xmlRequest.send(null);
        xmlSource = xmlRequest.responseXML;
    }
    pname = pname.substring(pname.lastIndexOf("/")+1,pname.length);
    xsltProcessor.setParameter(null,"LoginMode",plogin);    
    xsltProcessor.setParameter(null,"CurrentPage",pname);    
    xsltProcessor.setParameter(null,"JScript","1");    
    if (document.getElementById("dvSubNav")){
    document.getElementById("dvSubNav").innerHTML="";
    document.getElementById("dvSubNav").appendChild(xsltProcessor.transformToFragment(xmlSource, document));            
}
}

function expandState(ctlstate){
    var extender=$find(ctlstate);
    extender._doOpen();
}
function collapseState(ctlstate){
    var extender=$find(ctlstate);
    extender._doClose();
}
function OpenModal(varCOID,varBoothID){
var extender=$find('ctl00_MainContent_MPE1');
  extender.show();
  document.getElementById("ctl00_MainContent_txtComment").focus();
  document.getElementById("ctl00_MainContent_hdnTask").value="SendMail"+"__"+varCOID+"__"+varBoothID;
  return false;
}
function OpenModalDialog(URL,varCOID,varBoothID){
  sFeatures="height=520px,width=750px,resizable=0,status=0,toolbar=0,menubar=0,statusbar=0"
  var mywindow=window.open(URL, "SendMail",  sFeatures)
  mywindow.focus();
  return false;
}

function emailExhibitor(coid, boothid)
{
document.getElementById("ctl00_MainContent_hdnTask").value = "email";
document.getElementById("ctl00_MainContent_exhibitorIDs").value = "" + coid + "," + boothid;

__doPostBack("ctl00_MainContent_lnkSortby","");
}

function OpenModalAttSrch(varContactID){
//sarvesh
var extender=$find('ctl00_MainContent_MPE1');
  extender.show();
  document.getElementById("ctl00_MainContent_txtComment").focus();
  document.getElementById("ctl00_MainContent_hdnTask").value="SendMail"+"__"+varContactID;
  return false;
}
function hideModal(ev){
    if (!ev) ev = event.keyCode;  
    if (ev.keyCode==27) {            
        window.close();
    }  
}
var paneindex
function ExpandAccordian(id){
    if (id!=undefined && (id>0 && id<=2)) paneindex=id;
    var t;
    t = setTimeout(ExpandAccordian,500);
    if ($find("ctl00_LeftNav_MyAccordion_AccordionExtender")){
        clearTimeout(t);
        var behavior =$find("ctl00_LeftNav_MyAccordion_AccordionExtender");
        behavior.set_SelectedIndex(paneindex);
    }
}

function showAnimation(ev,tdelement,companyName,Boothlabel,Profile,varurl){
    //if (!document.getElementById("dvdetail")) return;
    //if (Profile=='') Profile='N/A'; else Profile=Profile+'...';
    //document.getElementById("dvdetail").innerHTML="<div style='width:100%;background-color:#990000;color:white'><span>"+companyName+" - Booth: "+Boothlabel+"</span></div><div style='padding-left:3px;'><span>"+Profile+"</span></div>"
//  document.getElementById("dvdetail").innerHTML="<b><u>"+companyName+" (Booth: "+Boothlabel+")</u></b><br/><b>Profile :</b>"+Profile+"..."
    //document.getElementById("ahref").href =varurl;
    //keepup(ev,tdelement,true); 
    //document.getElementById("ctl00_pnloverDiv").style.display = '';	
    return false;
   
}

function showAnimationAttSrch(ev,tdelement,ContactTitle,ContactID,ContactCO,Profile,URL){
//Sarvesh
    //if (Profile=='') Profile='N/A'; else Profile=Profile+'...';
    //document.getElementById("dvdetail").innerHTML="<div style='width:100%;background-color:#990000;color:white'><span>" + ContactTitle + " (" + ContactCO + ")</span></div><div style='padding-left:3px;'><span>"+Profile+"</span></div>"
    //document.getElementById("dvdetail").innerHTML="<table><tr><th style='width:300px'>" +  ContactTitle + " (" + ContactCO + ")</th></tr><tr><td>"+Profile+"</td></tr></table>"
    //document.getElementById("ahref").href =URL;
    //keepup(ev,tdelement,true); 
    //document.getElementById("ctl00_pnloverDiv").style.display = '';	
    return false;
   }
   
   
  function Cover(bottom,top,ignoreSize) {
  //bottom=bottom.id
  ignoreSize=true;
    var location = Sys.UI.DomElement.getLocation(bottom);
    var top = document.getElementById("info");
    top.style.position = 'absolute';
    top.style.top = location.y + 25 + 'px';
    top.style.left = location.x +35+ 'px';
    if (!ignoreSize) {
        top.style.height = bottom.offsetHeight + 'px';
        top.style.width = bottom.offsetWidth + 'px';
    }
}
            
function SendMail() {
   if(document.getElementById("ctl00_MainContent_txtComment").value!=""){
        __doPostBack("ctl00_MainContent_lnkSortby","");
        document.getElementById("ctl00_MainContent_txtComment").value="";
        }else
        {
            var extender=$find('ctl00_MainContent_MPE1');
            extender.show();
            return false;
        }
        
}
function SearchByCriteria(varparam){
    document.getElementById("ctl00_MainContent_hdnminRank").value="";
    document.getElementById("ctl00_MainContent_hdnMaxRank").value="";
    document.getElementById("ctl00_MainContent_hdnTask").value="";
    if (varparam!='')return confirm(varparam);
   }
function CancelSendMail(){
    document.getElementById("ctl00_MainContent_hdnTask").value="";
     document.getElementById("ctl00_MainContent_txtComment").value="";
    return false;
}


function showExhpopup(ev,companyName,Boothlabel,URL,Profile){  
    document.getElementById("divprofile").innerHTML="<font color=black><b>Profile:"+Profile+"...</b></font>"
    document.getElementById("popoupdiv").innerHTML="<b>"+companyName+" (Booth: "+Boothlabel+")</b>"
    document.getElementById("overDiv").style.display=""
    document.getElementById("ctl00_MainContent_P_SeachResults1_lnkpopup").href =URL;
}

function GoToPage(pageIndex,ctlHidden,PageValue,ctlpostback){	    	
    if(PageValue=='PP'){
    document.getElementById(ctlHidden).value =(parseInt(pageIndex)-1);
    }else if(PageValue=='PN'){
    document.getElementById(ctlHidden).value =(parseInt(pageIndex)+1);
    }else if(PageValue=='PG'){
    document.getElementById(ctlHidden).value =(parseInt(pageIndex));
    } 
    
    
    Setfocus();
     __doPostBack(ctlpostback,"");
    //assignEventsWait();  
}
	
function SortData(Sortvalue,ctlpostback,ctlHidden){		

    document.getElementById(ctlHidden).value=Sortvalue;
    __doPostBack(ctlpostback,"");
    //assignEventsWait();  
}

function SetCheckBoxSelect(intBoothID,eleCheckbox){
    var Ischecked=0;
    if (eleCheckbox.checked) 
    Ischecked = 0;
    else
    Ischecked = 1;
    document.getElementById("ctl00_MainContent_hdnTask").value="UpdateExpoPln__"+Ischecked;
    document.getElementById("ctl00_MainContent_hdnBoothids").value=intBoothID;
    __doPostBack("ctl00_MainContent_lnkSortby","");
}

function SetCheckBoxSelectAttSrch(intContactID,eleCheckbox){
//sarvesh   
    var Ischecked=0;
    if (eleCheckbox.checked) 
    Ischecked = 0;
    else
    Ischecked = 1;
    document.getElementById("ctl00_MainContent_hdnTask").value="UpdateMyFavorite__"+Ischecked;
    document.getElementById("ctl00_MainContent_hdnContactID").value=intContactID;
    //document.getElementById("ctl00_MainContent_hdnEventID").value=intEventID;
    //document.getElementById("ctl00_MainContent_hdnControlID").value=eleCheckbox.id;
    
       __doPostBack("ctl00_MainContent_lnkSortby",eleCheckbox.id);
}

function OpenAppointMentForm(url){
    var mywin = window.open(url, 'AppointmentRequest' ,'width=750,height=500,left=200,top=100,scrollbars=yes,resizable=yes');
    mywin.focus();
    return false;
}
function OpenSaveForm(url)
{
var options = "";
if(document.getElementById("ctl00_MainContent_adHocBox").value != "")
{
	options = document.getElementById("ctl00_MainContent_adHocBox").value;

}
else{ options = document.getElementById("ctl00_MainContent_catValues").value; }


if(options == "")
{
options = "option search|1";
disableSelectAll();
}

url = url + options



var change = 'saved';
var val = document.getElementById("ctl00_MainContent_adHocBox").value;
if(val != "")
{
change="adhoc";
}


var name = "&GroupName="+document.getElementById("ctl00_MainContent_groupname").value;

	url += "&switch=" + change + name;
	doMessageCenter(url);
	    
}

function SearchSubmit_Exhibitor(lnkExhIndex,lnkSortBy,blnUpdate,pagingQuery)
    {    
         
         document.getElementById("ctl00_MainContent_catValues").value="";
	 document.getElementById("ctl00_MainContent_hdnCharIndex").value=lnkExhIndex;
         document.getElementById("ctl00_MainContent_hdnpageIndex").value="1";
         document.getElementById("ctl00_MainContent_hdnsortby").value="CompanyFPName";         
         document.getElementById("ctl00_MainContent_AlwaysSortAscending").value="yes";
         
	 uncheckAll()

        __doPostBack("ctl00_MainContent_lnkSortby","");
        //assignEventsWait();  
        
	    return false;
	    
    }

 function SearchSubmit(lnkExhIndex,lnkSortBy,blnUpdate,pagingQuery)
    {    document.getElementById("ctl00_MainContent_hdnCharIndex").value=lnkExhIndex;
         document.getElementById("ctl00_MainContent_hdnpageIndex").value="1";
         __doPostBack("ctl00_MainContent_lnkSortby","");
	    return false;
	    
    }
    
function getRelevance(varMinrank,varMaxRank){

    document.getElementById("ctl00_MainContent_hdnminRank").value=varMinrank;
    document.getElementById("ctl00_MainContent_hdnMaxRank").value=varMaxRank;
    document.getElementById("ctl00_MainContent_rangemin").value=varMinrank;
    document.getElementById("ctl00_MainContent_rangemax").value=varMaxRank;
    document.getElementById("ctl00_MainContent_hdnTask").value='Relevance';
    document.getElementById("ctl00_MainContent_hdnpageIndex").value="1";
    __doPostBack("ctl00_MainContent_lnkSortby","ByRelevance");
    
}
    
 
    //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Abhay Java Scripts [Start]>>>>>>>>>>>>>>>>>>>>>>>>>>
    
       
function showimg(selindx){
    if (selindx=="0"){
        document.getElementById("imgbasic").style.display='none';
        document.getElementById("imgadv").style.display='';
        }
    else
    {
        document.getElementById("imgadv").style.display='none';
        document.getElementById("imgbasic").style.display='';
    }
 }
 
 
 function callbackSessionSearch(varId,varName){

     document.getElementById("ctl00_MainContent_hdnSelectedId").value=varId
     document.getElementById("ctl00_MainContent_hdnSelectedType").value=varName
     Setfocus();
    __doPostBack("ctl00_MainContent_lnkSortby","");
    
}

function getSessionByRelevance(varMinrank,varMaxRank){
    document.getElementById("ctl00_MainContent_hdnminRank").value=varMinrank;
    document.getElementById("ctl00_MainContent_hdnMaxRank").value=varMaxRank;
    document.getElementById("ctl00_MainContent_hdnTask").value='Relevance'
    __doPostBack("ctl00_MainContent_lnkSortby","");
    
}

    

function showAnimationForSession(ev,tdelement,SessionTitle1,SessionDesc,varurl){
    if (SessionDesc=='') SessionDesc='N/A'; else SessionDesc=SessionDesc+'...';
    document.getElementById("dvdetail").innerHTML="<div style='width:100%;background-color:#990000;color:white'><span>"+SessionTitle1+"</span></div><div style='padding-left:3px;'><span>"+SessionDesc+"</span></div>"
    //document.getElementById("dvdetail").innerHTML="<table><tr><th style='width:300px'>" + SessionTitle1 +"<br/></th></tr><tr><td>" + SessionDesc + "</td></tr></table>"
    document.getElementById("ahref").href =varurl;
    keepup(ev,tdelement,true); 
    document.getElementById("ctl00_pnloverDiv").style.display = '';	
    return false;
   
}

function showPopupFavoriteAttendee(ev,tdelement,ContactCompany,Profile,varurl){
if (Profile=='') Profile='N/A'; else Profile=Profile+'...';
    document.getElementById("dvdetail").innerHTML="<div style='width:100%;background-color:#990000;color:white'><span>"+ContactCompany+"</span></div><div style='padding-left:3px;'><span>"+Profile+"</span></div>"
    //document.getElementById("dvdetail").innerHTML="<table><tr><th style='width:300px'>" + ContactCompany + "<br></th></tr><tr><td>" + Profile + "...</td></tr></table>"
    document.getElementById("ahref").href =varurl;
    keepup(ev,tdelement,true); 
    document.getElementById("ctl00_pnloverDiv").style.display = '';	
    return false;
   
}

function AddtoMyItinerary(varSessID,sesCheckBox){
    var Ischecked=0;
    if (sesCheckBox.checked)
        Ischecked=0;
    else
        Ischecked=1;
        document.getElementById("ctl00_MainContent_hdnTask").value="UpdateItinerary__"+Ischecked
        document.getElementById("ctl00_MainContent_hdnSessionId").value=varSessID;
        __doPostBack("ctl00_MainContent_lnkSortby",sesCheckBox.id); 
           
}


function ModifyMyItinerary(varSessID,sesCheckBox,updmsg){
    var Ischecked=0;
    if (sesCheckBox.checked)
        Ischecked=0;
    else
        Ischecked=1;
    var chk=confirm(updmsg);
    if(chk){        
            document.getElementById("ctl00_MainContent_hdnTask").value="UpdateItinerary__"+Ischecked
            document.getElementById("ctl00_MainContent_hdnSessionId").value=varSessID;
            //Setfocus();
            __doPostBack("ctl00_MainContent_lnkSortby",""); 
           }        
    else    
        {  
         sesCheckBox.checked=true
         return false;
        }
}


function UpdateExpoPlan(intBoothID,eleCheckbox,updmsg){
    var Ischecked=0;
    if (eleCheckbox.checked) 
        Ischecked = 0;
    else
        Ischecked = 1;
    var chk=confirm(updmsg);
    if(chk){ 
            document.getElementById("ctl00_MainContent_hdnTask").value="UpdateExpoPln__"+Ischecked;
            document.getElementById("ctl00_MainContent_hdnBoothids").value=intBoothID;
            //Setfocus();
            __doPostBack("ctl00_MainContent_lnkSortby","");
           } 
     else    
        {  
         eleCheckbox.checked=true;
         return false;
        }
}


function SaveAgent(chkmsg){
    var chk=confirm(chkmsg);
    if(chk){
            document.getElementById("ctl00_MainContent_hdnminRank").value="";
            document.getElementById("ctl00_MainContent_hdnMaxRank").value="";
            document.getElementById("ctl00_MainContent_hdnTask").value="";
           }
    else{
        return false;
        }

}

   
    function EnableDisableControl(ControlId,Disable)
{
    var ctrl = document.getElementById(ControlId)
    if (ctrl !=  null)    
    ctrl.disabled = Disable    
}

function Changecontent(index,lmode,role)
{
document.getElementById("ctl00_MainContent_hdnsearchparam").value=index
__doPostBack("ctl00_MainContent_lnkcallback","");
}

//e_myprofile.aspx


function ValidateMaxCategory(source ,arguments)
	{
	    var trErrorMsg = document.getElementById('catmsg');
	    var control = document.getElementById('ctl00$MainContent$wzrdUSerAgent$ctlMyProfile$TextBoxBoothContactURL');
	    var aReturn=document.getElementsByTagName("Input");
		var Max = document.getElementById('ctl00_MainContent_wzrdUSerAgent_ctlMyProfile_hdnMaxCat').value;
		var countCheckBoxes=0;
		countCheckBoxes=GetCheckboxSelectedCount();		
		if (countCheckBoxes > Max)
		{
    		if (trErrorMsg !=null) trErrorMsg.style.display='';
			arguments.IsValid = false;
			control.focus();
		}
	}
function ValidateMinCategory(source ,arguments)
	{ 
	    //this method will test to see if there are any product categories checked and if there are not it will set the focus on the web url box above it (since that is the closest thing to set focus on) and then display an error message
	    var trErrorMsg = document.getElementById('catmsg');
	    var control = document.getElementById('ctl00$MainContent$wzrdUSerAgent$ctlMyProfile$TextBoxBoothContactURL');
		var aReturn=document.getElementsByTagName("Input");
		var Min=1;
		var countCheckBoxes=0;
		countCheckBoxes=GetCheckboxSelectedCount();		
		if (countCheckBoxes < Min)
		{
	        if (trErrorMsg !=null) trErrorMsg.style.display='';
			arguments.IsValid = false;
			control.focus();
			
		}
	}
function ValidateMandatoryListItems(source,args){       
		var argValue = true;
		for(var i=0; i<=ListItemIDs.length-1; i++){
			if(IsListItemSelected(ListItemIDs[i])==false){
				var temp = document.getElementById(ErrorMessageLabelIDs[i]);
				if(temp!=null){
					temp.style.display='';
					argValue = false;
				}
			}
		}
		args.IsValid= argValue;
	}
	
	
function IsListItemSelected(objID){
		var IsChecked = false;
		var obj = document.getElementById(objID);
		if(obj==null){return true;}
		var elements = obj.getElementsByTagName("INPUT");
		for(var i=0; i<=elements.length-1; i++){
			if(elements[i].type!=null){
				//alert(obj.all[i].type);
				if((elements[i].type=='checkbox' || elements[i].type=='radio') && elements[i].checked==true){
					//alert(obj.all[i].checked);
					return true;
				}
			}
		}
		return false;
	}
	
function HideErrorMessages() {  
    if (ErrorMessageLabelIDs!=null) {         
        for(var i=0;i<=ErrorMessageLabelIDs.length-1;i++) {
            var temp = document.getElementById(ErrorMessageLabelIDs[i]); 
            if (temp != null) {
                temp.style.display='none'; 
            }
        }
    }
}


function GetCheckboxSelectedCount()
	{
	    var strId = new String;
		var aReturn=document.getElementsByTagName("Input");
		var i=0;
		var countCheckBoxes = 0;
		for(i = 0;i <= aReturn.length - 1;i++)
		{
		    strId = aReturn[i].id		    
			if (aReturn[i].type == "checkbox" && strId.indexOf("P_ExporterInfo1")<0) 
			{
				if(aReturn[i].checked == true)
				{
					//if(aReturn[i].id.toUpperCase() =="CHECKPRIMARYADDRESS")
					if(aReturn[i].id =="ctl00_MainContent_wzrdUSerAgent_ctlMyProfile_checkPrimaryAddress")
					{
					
					}
					else
					{
						countCheckBoxes++;
					}
					
				}
	    	}
		}
		return countCheckBoxes;
	}
	

	
	function isLetter(c)
	{   
		var letters = /^[a-zA-Z]$/
    	if(c.length > 1) 
			return false
		else
		{
			var matchArray = c.match ( letters ) ;
			if (matchArray == null )
				return false ;
			else
				return true ;
		}
			}
	
	function ValidateHTML(strValue)
	{
					
		var index;
		var arrHtmlArray=new Array(75);
		var blnErr=false;
		var str=strValue;
					
		arrHtmlArray[0]="<br>";
		arrHtmlArray[1]="<p>";
		arrHtmlArray[2]="<head>";
		arrHtmlArray[3]="<body>";
		arrHtmlArray[4]="<IMG>";
		arrHtmlArray[5]="<table>";
		arrHtmlArray[6]="<tr>";
		arrHtmlArray[7]="<td>";
		arrHtmlArray[8]="<font>";
		arrHtmlArray[8]="<ADDRESS>";
		arrHtmlArray[9]="<APPLET>";
		arrHtmlArray[10]="<AREA>";
		arrHtmlArray[11]="<A>";
		arrHtmlArray[12]="<BASE>";
		arrHtmlArray[13]="<BASEFONT>";
		arrHtmlArray[14]="<BIG>";
		arrHtmlArray[15]="<BLOCKQUOTE>";
		arrHtmlArray[16]="<BODY>";
		arrHtmlArray[17]="<BR>";
		arrHtmlArray[18]="<B>";
		arrHtmlArray[19]="<CAPTION>";
		arrHtmlArray[20]="<CENTER>";
		arrHtmlArray[21]="<ADDRESS>";
		arrHtmlArray[22]="<CITE>";
		arrHtmlArray[23]="<CODE>";
		arrHtmlArray[24]="<DD>";
		arrHtmlArray[25]="<DFN>";
		arrHtmlArray[26]="<DIR>";
		arrHtmlArray[27]="<DIV>";
		arrHtmlArray[28]="<DL>";
		arrHtmlArray[29]="<DT>";
		arrHtmlArray[30]="<EM>";
		arrHtmlArray[31]="<FONT>";
		arrHtmlArray[33]="<H1>";
		arrHtmlArray[34]="<H2>";
		arrHtmlArray[35]="<H3>";
		arrHtmlArray[36]="<H4>";
		arrHtmlArray[37]="<H5>";
		arrHtmlArray[38]="<H6>";
		arrHtmlArray[39]="<HEAD>";
		arrHtmlArray[40]="<HR>";
		arrHtmlArray[41]="<HTML>";
		arrHtmlArray[42]="<IMG>";
		arrHtmlArray[43]="<INPUT>";
		arrHtmlArray[44]="<ISINDEX>";
		arrHtmlArray[45]="<I>";
		arrHtmlArray[46]="<KBD>";
		arrHtmlArray[47]="<LINK>";
		arrHtmlArray[48]="<LI>";
		arrHtmlArray[49]="<MAP>";
		arrHtmlArray[50]="<MENU>";
		arrHtmlArray[51]="<META>";
		arrHtmlArray[52]="<OL>";
		arrHtmlArray[53]="<OPTION>";
		arrHtmlArray[54]="<PARAM>";
		arrHtmlArray[55]="<PRE>";
		arrHtmlArray[56]="<P>";
		arrHtmlArray[57]="<SAMP>";					
		arrHtmlArray[58]="<SCRIPT>";
		arrHtmlArray[59]="<SELECT>";
		arrHtmlArray[60]="<SMALL>";
		arrHtmlArray[61]="<STRIKE>";
		arrHtmlArray[62]="<STRONG>";
		arrHtmlArray[63]="<STYLE>";
		arrHtmlArray[64]="<SUB>";
		arrHtmlArray[65]="<SUP>";
		arrHtmlArray[66]="<TD>";
		arrHtmlArray[67]="<TEXTAREA>";
		arrHtmlArray[68]="<TH>";
		arrHtmlArray[69]="<TITLE>";
		arrHtmlArray[70]="<TR>";
		arrHtmlArray[71]="<TT>";
		arrHtmlArray[72]="<UL>";
		arrHtmlArray[73]="<U>";
		arrHtmlArray[74]="<VAR>";
			
		for (i=0;i<74;++i)
		{
			index=str.indexOf(arrHtmlArray[i])
			if (index>=0 )
			{
				blnErr=true;
				break;
			}
		}
					
		index=str.indexOf("<")
		if (index>=0 )
		{
			if ((str.charAt(index+1) != " ") && (isLetter(str.charAt(index+1))))
			{
				blnErr=true;
			}
		}
		
		return blnErr;
	}
	

	function ValidateLimitedHTML(strValue)
	{
					
		var index;
		var arrHtmlArray=new Array(1);
		var blnErr=false;
		var str=strValue;
					
		arrHtmlArray[0]="<A>";
		arrHtmlArray[1]="<IMG>";
			
		for (i=0;i<1;++i)
		{
			index=str.indexOf(arrHtmlArray[i])
			if (index>=0 )
			{
				blnErr=true;
				break;
			}
		}
					
	
		str=str.toUpperCase();
		if(str.indexOf("<IMG")>=0 || str.indexOf("<A")>=0)
		{			
			blnErr=true;
		}
		return blnErr;
	}


	
	function ValidateHTMLBoothPrintProfile(source ,arguments)
	{
		var obj=document.getElementById("ctl00_MainContent_wzrdUSerAgent_ctlMyProfile_TextAreaBoothPrintProfile");	
		var str=obj.value;
		var blnResult;
		blnResult=ValidateHTML(str);
		if(blnResult==true)
		{
			arguments.IsValid = false;
		}
			
	}
	
	function ValidateHTMLCompanyDescription(source ,arguments)
	{
		var obj=document.getElementById("ctl00_MainContent_wzrdUSerAgent_ctlMyProfile_TextAreaBoothProfile");
		var str=obj.value;
		var blnResult;
		blnResult=ValidateLimitedHTML(str);
		if(blnResult==true)
		{
			arguments.IsValid = false;
		}			
	}

function GetVAls()
    {
   
  
        if (document.getElementById('ctl00_MainContent_wzrdUSerAgent_ctlMyProfile_ctlAddressCountryState_ddlCountry')!=null)
            
            document.getElementById("ctl00_MainContent_wzrdUSerAgent_ctlMyProfile_hdnCountryCode").value =  document.getElementById('ctl00_MainContent_wzrdUSerAgent_ctlMyProfile_ctlAddressCountryState_ddlCountry').value
        else
            
            document.getElementById("ctl00_MainContent_wzrdUSerAgent_ctlMyProfile_hdnCountryCode").value =  document.getElementsByName('ctl00_MainContent_wzrdUSerAgent_ctlMyProfile_ctlAddressCountryState_ddlCountry')[0].value
     
    }

    
//p_contact

function OpenCV(strCV){
	window.open('../Custom/CV/' + strCV);
}

function OpenPhoto(strCV){
	window.open(strCV);
}

function openInsamewindow(winName, url) 
	{
		window.location=url;
		return false;
	}		
	
	
	
function UpdateMyFavorite(sesCheckBox)
{

    var Ischecked=0;
    if (sesCheckBox.checked)
    {
        Ischecked=0;
	
    }
    else{
        Ischecked=1;   
		  
	     var chk=confirm('Are you sure you want to delete this group?');
	     if(chk){
             document.getElementById("ctl00_MainContent_ctlFavoriteAttendee_hdnTask").value="delete"
            
	        }
		 else{
		        sesCheckBox.checked=true;
			document.getElementById("ctl00_MainContent_ctlFavoriteAttendee_hdnTask").value="doNot"
		        return false;
		      }
	}   
}   		
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Abhay JS ENDS -----Sarvesh JS>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


	function WebForm_FireDefaultButton_Overrided(event, target) {
                if (event.keyCode == 13 && !(event.srcElement && (event.srcElement.tagName.toLowerCase() == "textarea"))) {
                    var defaultButton;
                    if (__nonMSDOMBrowser) {
                        defaultButton = document.getElementById(target);
                    }
                    else {
                        defaultButton = document.all[target];
                    }
                    if (defaultButton && typeof(defaultButton.click) != "undefined") {
                        defaultButton.click();
                        event.cancelBubble = true;
                        if (event.stopPropagation) event.stopPropagation();
                        return false;
                    }
                }
                return true;
    }		
			

	/*************** Common Script for Attendee & Exhibitor ********************/
	
	function setDefaultFocus()
	{
	     var arrInputs = document.getElementsByTagName('INPUT');
	     
	     for ( var i = 0; i < arrInputs.length; i++ ) 
	     {
	         if (arrInputs[i].getAttribute("Type")!="hidden")
	         {
	            arrInputs[i].focus();
	            break;
	         }
	     }
	
	}
	

			function isblank(s)
			{
				for(var i=0; i<s.length; i++) {
					var c = s.charAt(i);
					if ((c != '') && (c != '\n') && (c != '\t')) return false;
					}
					return true;
			}

			function checkemail(s)
			{
				var str = s;
				if(str!="")
				{
					//Commentd By Tusli on 02022005
					//var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
					//Added By Tusli on 02022005
					var filter=/^(\w+(['-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)$/
					
					if (filter.test(str))
						testresults=true
					else
					{
					
						testresults=false
					}
					return (testresults)
				}
			}


/*************** Script for Attendee ********************/
			function verify(f,Message211,Message212,btnNo)
			{
				var msg = "";
				var empty_fields = "";
				var errors = "";	
				var strTemp = ""
											
				for(var i=0; i<f.length; i++) {
					var e = f.elements[i];	
					if (e.name == undefined)
					{
						continue;
					}
					if(btnNo == 1)
					{
						if ((e.name.indexOf('Ecode') == -1 ))
						{
							continue;
						}
					}				
					if(btnNo == 2)
					{
						if ((e.name.indexOf('mailLogin') == -1 ))
						{
							continue;
						}
					}						
					if(btnNo == 3)
					{
						if ((e.name.indexOf('mailLogin') != -1 ) || (e.name.indexOf('Ecode') != -1 ))
						{
							continue;
						}
					}						
					//if ((e.name.indexOf('txtMName') != -1 )  ||  (e.name.indexOf('txtCompany') != -1 ) ||  (e.name.indexOf('txtAdd2') != -1 ) || (e.name.indexOf('txtAdd1') != -1 )  || (e.name.indexOf('ddlCountry') != -1 ) || (e.name.indexOf('Phone') != -1 ) || (e.name.indexOf('Fax') != -1 ))
					//{
					//	continue;
					//}
					
					if ((e.name.indexOf('txtMName') != -1 )  ||  (e.name.indexOf('txtCompany') != -1 ) || (e.name.indexOf('Phone') != -1 ) || (e.name.indexOf('Fax') != -1 ))
					{
						continue;
					}
					
					if (((e.type=="text") || (e.type=="textarea") || (e.type=="password")) && !e.optional) 
					{
						
						if ((e.value==null) || (e.value=="") || isblank(e.value)) 
						{
							strTemp = e.name.replace('ctl00$MainContent$ucAtt$','');
							strTemp = strTemp.replace('mailLogin','mail');
							strTemp = strTemp.replace('txt','');
							empty_fields += "\n" + strTemp;
							continue;
						}
						if (e.name.indexOf('Email') != -1 ){
						//empty_fields += "\n" + "Incorrect Email";
							if (!checkemail(e.value)){
							empty_fields += "\n" + "Incorrect Email";
							}
							continue;
						}
						
						if(e.numeric || (e.min != null) || (e.max != null)) {
							var v = parseFloat(e.value);
							if (isNaN(v) || ((e.min != null) && (v < e.min)) || ((e.max != null) && (v > e.max))) {
								errors += " - The field " + e.name + " must be a number " ;
								if(e.min != null)
									errors += " that is greater than " + e.min ;
								if(e.max != null && e.min != null)
									errors += " and less than " + e.max;
								else if (e.max != null)
									error += " that is less than " + e.max;
								errors += ". \n";
							}
						}
					}
				}
				
				if (!empty_fields && !errors) return true;
				
				//msg += "__________________________________________________";
				//msg += "\n \n";
				//msg += Message212 + " \n"
				//msg += "__________________________________________________";
				//msg += "\n \n";
				
				if (empty_fields) 
				{
				    if (empty_fields != "\n" + "Incorrect Email")
				    {
					msg += Message211 + " \n";
					msg += empty_fields + "\n";
				    }
				else{
				    msg += empty_fields + "\n";
				    }
					if (errors) 
					msg += "\n";
				}
				msg += errors;
				alert(msg);
				return false;
			}			
			
			function Validate(f,Message211,Message212,btnNo)
			{
				var msg = "";
				var Error_Msg = "";
				//For ECode Login 
					
				if (btnNo == 1)
				{
				if ((f.ctl00$MainContent$ucAtt$txtEcode.value==null) || (f.ctl00$MainContent$ucAtt$txtEcode.value=="") || isblank(f.ctl00$MainContent$ucAtt$txtEcode.value))
					{
					Error_Msg += "\n" + "Ecode ";
					}
				}
				//For Email and ECode Login 
				if (btnNo == 2)
				{
					if ((f.ctl00$MainContent$ucAtt$txtLogin2ContactEmail.value==null) || (f.ctl00$MainContent$ucAtt$txtLogin2ContactEmail.value=="") || isblank(f.ctl00$MainContent$ucAtt$txtLogin2ContactEmail.value))
					    Error_Msg += "\n" + "Email";
					else if (!checkemail(f.ctl00$MainContent$ucAtt$txtLogin2ContactEmail.value))
					    Error_Msg += "\n" + "Incorrect Email";
					
					if ((f.ctl00$MainContent$ucAtt$txtLogin2ContactECode.value==null) || (f.ctl00$MainContent$ucAtt$txtLogin2ContactECode.value=="") || isblank(f.ctl00$MainContent$ucAtt$txtLogin2ContactECode.value))
					{
					Error_Msg += "\n" + "Ecode ";
					}
				}
				
				//For Email Login 
				if (btnNo == 3)
				{
					
					if ((f.ctl00$MainContent$ucAtt$txtLogin3ContactEmail.value==null)  || (f.ctl00$MainContent$ucAtt$txtLogin3ContactEmail.value=="") || isblank(f.ctl00$MainContent$ucAtt$txtLogin3ContactEmail.value))
						Error_Msg += "\n" + "Email";
					else if (!checkemail(f.ctl00$MainContent$ucAtt$txtLogin3ContactEmail.value))
					    Error_Msg += "\n" + "Incorrect Email";
					
				 	
				}
				
				//For COID and ECode Login 
				if (btnNo == 4)
				{
					if ((f.ctl00$MainContent$ucAtt$txtLogin4ContactId.value==null) || (f.ctl00$MainContent$ucAtt$txtLogin4ContactId.value=="") || isblank(f.ctl00$MainContent$ucAtt$txtLogin4ContactId.value))
					{
					Error_Msg += "\n" + "Password ";
					}
					
//					if ((f.ctl00$MainContent$ucAtt$txtLogin4ContactECode.value==null) || (f.ctl00$MainContent$ucAtt$txtLogin4ContactECode.value=="") || isblank(f.ctl00$MainContent$ucAtt$txtLogin4ContactECode.value))
//					{
//					Error_Msg += "\n" + "Password ";
//					}
				}
				if (Error_Msg != "")
				{
					//msg += "__________________________________________________";
					//msg += "\n \n";
					//msg += Message212 + " \n"
					//msg += "__________________________________________________";
					//msg += "\n \n";
					if (Error_Msg != "\n" + "Incorrect Email"){
					msg += Message211 + " \n";
					msg += Error_Msg + "\n";
				    }
				else{
				    msg += Error_Msg + "\n";
				    }
					msg += "\n";
					alert(msg);
					return false;	
				}		
				return true;
				
			}		
			//**************ADDED BY GAURAV TO RECTIFY MEMBERID KEYPRESS PROB*************** START
            function onlyNumericsKeyDown(evt){
                            var _ret = true;
				            //alert(window.event.keyCode);
				            //var key = (window.event) ? evt.which : evt.keyCode;
				            var key = (!evt) ? event.keyCode : evt.keyCode;
            				
				            if (key < 46 || key > 57 || key==47)
				            {	
					            _ret= false;
				            }
				            if (key > 7 && key < 10)
				            {
					            _ret= true;
				            }
				            if (key > 95 && key < 106)
				            {
					            _ret= true;
				            }
				            if (key == 190 || key == 110 || key == 189 || key == 109)
				            {
					            _ret= true;
				            }
				            return _ret;
            }
            //**************ADDED BY GAURAV TO RECTIFY MEMBERID KEYPRESS PROB*************** END
		function onlyNumerics(evt) 
			{	
				var _ret = true;
				//alert(window.event.keyCode);
				//var key = (window.event) ? evt.which : evt.keyCode;
				var key = (!evt) ? event.keyCode : evt.keyCode;
				
				if (key < 46 || key > 57 || key==47)
				{	
					_ret= false;
				}
				if (key > 7 && key < 10)
				{
					_ret= true;
				}
				if (key > 95 && key < 106)
				{
					_ret= true;
				}
				if (key == 190 || key == 110 || key == 189 || key == 109)
				{
					_ret= true;
				}
				return _ret;
			
			}	
		
/*************** Script for Exhibitor ********************/	

	

			function verifyExh(f,Message212,Message211,btnNo)
			{
				var msg = "";
				var empty_fields = "";
				var errors = "";
				
				
				
				for(var i=0; i<f.length; i++) {
					var e = f.elements[i];
					
					
					
					if(btnNo == 1)
					{
						if ((e.name.indexOf('UserID') == -1 ) && (e.name.indexOf('Password') == -1 ))
						{
							continue;
						}
					}				
					if(btnNo == 2)
					{
						if ((e.name.indexOf('BoothNumber') == -1 ))
						{
							continue;
						}
					}	
										
					if (((e.type=="text") || (e.type=="textarea") || (e.type=="password")) && !e.optional) {
						if ((e.value==null) || (e.value=="") || isblank(e.value)) {
						    //empty_fields += "\n		" + e.name.replace("txt","").replace("BoothNumber","EmailAddress").replace("ucExh$","");
							empty_fields += "\n" + e.name.replace("ctl00$MainContent$ucExh$txtBoothNumber",document.getElementById("ctl00_MainContent_ucExh_hdnSendEmail").value).replace("ctl00$MainContent$ucExh$txt","").replace("PasswordBooth","Password");
							continue;
						}
						if (e.name.indexOf('BoothNumber') != -1 && document.getElementById("ctl00_MainContent_ucExh_hdnSendEmail").value != "Booth Number" ){
						
							if (!checkemail(e.value)){
							empty_fields += "\n" + "Incorrect Email";
							}
							continue;
						}						
						
						if(e.numeric || (e.min != null) || (e.max != null)) 
						{
						        if((e.min != "") || (e.max != ""))
						        {
							        var v = parseFloat(e.value);
							        if (isNaN(v) || ((e.min != null) && (v < e.min)) || ((e.max != null) && (v > e.max))) {
								        errors += " - The field " + e.name + " must be a number " ;
								        if(e.min != null)
									        errors += " that is greater than " + e.min ;
								        if(e.max != null && e.min != null)
									        errors += " and less than " + e.max;
								        else if (e.max != null)
									        error += " that is less than " + e.max;
								        errors += ". \n";
							    }
							}
						}
					}
				}
				
				if (!empty_fields && !errors) return true;
				
				//msg += "__________________________________________________";
				//msg += "\n \n";
				//msg += Message212 + " \n"
				//msg += "__________________________________________________";
				//msg += "\n \n";
				
			    if (empty_fields) 
			    {
				    if (empty_fields != "\n" + "Incorrect Email")
				    {
					    msg += Message211 + " \n";
					    msg += empty_fields + "\n";
				    }
				    else{
				        msg += empty_fields + "\n";
				    }
					if (errors) 
					msg += "\n";
				}
				msg += errors;
				alert(msg);
				return false;
			}			
			
function EmailThisPage(a){
   
   // var content_vlue = document.getElementById("dvEmailContent").innerHTML; 
   // alert(content_vlue);
    //return false;
   // var cont="<html><head><link href='../include/interface.css' rel='stylesheet' type='text/css' />";
    //cont=cont  +" </head><body><form><center>"
   //cont=cont  + content_vlue 
   //cont=cont  + "</center></form></body></html>"
   var strBody = "Check out this page: " + window.location
    
    a.href="mailto:?subject=ConstructShow 2009 networking&body=" + strBody
    return false;
}

function GetURL(e)
{
   window.location = document.getElementById("ctl00_ctlP_welcomeNav_hdnHome").value;
   
}

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>    SARVESH>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

function validateSelection(objtable,blndopostback){
    for (var intCount=0; intCount<objtable.getElementsByTagName("INPUT").length;intCount++){
	    var ctlElement = objtable.getElementsByTagName("INPUT")[intCount];
		if(ctlElement.type=="checkbox"){
		    if (ctlElement.checked) {
		        if(blndopostback==true)__doPostBack(objtable.id,"");
		        return true;
            }
        }
    }
	return false;
}

function RefreshParentWindow(Msg){
var strloc=window.opener.location.href
var strUrl=(strloc.substring(strloc.lastIndexOf("/")+1,strloc.length)).toUpperCase();
if (strUrl.indexOf('BOOTH.ASPX')>-1 || strUrl.indexOf('SPEAKERDETAILS.ASPX')>-1) {
window.opener.document.forms[0].submit();
}
  var WinConfirm=window.confirm(Msg);
  if (WinConfirm==true) window.close();
}


function isValidCreditCardExpiryDate(source,arguments)
{
    var expdate = document.getElementById("ctl00_MainContent_Ctl_CreditCardinfo_txtExpDateEdit").value;
    var mm;
    var yy;
    var currentmm;
    var currentyear;
    var currentdate=new Date();
    var entereddate=new Date();
    var currentdatemodified=new Date();
  
    if (expdate.length==4)
    {        
        mm=expdate.substring(0,2);
        yy=expdate.substring(2);
        currentmm = currentdate.getMonth();
        currentyear = currentdate.getFullYear();
        entereddate.setFullYear(yy,mm-1,1);
        currentdatemodified.setFullYear(String(currentyear).substring(2), currentmm, 1);
        if (entereddate<currentdatemodified){
            if (arguments) arguments.IsValid = false;
            else return false;
        }
        else{
            arguments.IsValid = true;
        }
    }
    
}


function isValidCreditCard(source,arguments){
    var type
    var typeIndex = document.getElementById("ctl00_MainContent_Ctl_CreditCardinfo_ddlCardType").selectedIndex;
    var ccnum = document.getElementById("ctl00_MainContent_Ctl_CreditCardinfo_txtCardNumberEdit").value;
    if (typeIndex=="0"){
        arguments.IsValid = false;
        return false; 
    }
    if (typeIndex=="1"){
        type="MC"
    }
    else if(typeIndex=="2"){
        type="Visa"
    }
    else if(typeIndex=="4"){
        type="Disc"
    }
    else if(typeIndex=="3"){
        type="AmEx"
    }
    else if(typeIndex=="5"){
        type="Diners"
    }
   if (type == "Visa") {
      var re = /^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/;
   } 
   else if (type == "MC") {
            var re = /^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$/;
   } 
   else if (type == "Disc") {
            var re = /^6011-?\d{4}-?\d{4}-?\d{4}$/;
   } 
   else if (type == "AmEx") {
        var re = /^3[4,7]\d{13}$/;
   } 
   else if (type == "Diners") {
           var re = /^3[0,6,8]\d{12}$/;
   }
   if (!re.test(ccnum)){
      arguments.IsValid = false;
      return;
   }
   
   ccnum = ccnum.split("-").join("");
   var checksum = 0;
   for (var i=(2-(ccnum.length % 2)); i<=ccnum.length; i+=2) {
      checksum += parseInt(ccnum.charAt(i-1));
   }
   for (var i=(ccnum.length % 2) + 1; i<ccnum.length; i+=2) {
      var digit = parseInt(ccnum.charAt(i-1)) * 2;
      if (digit < 10) { 
            checksum += digit; 
      } 
      else { 
            checksum += (digit-9); 
      }
   }
   if ((checksum % 10) == 0)  
        arguments.IsValid = true; 
   else  
        arguments.IsValid = false;
}

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("ctl00_MainContent_btnSubmit");
  btnSubmit.disabled =true;
  if (s.checked==true)
  {
    btnSubmit.disabled =false;    
    btnSubmit.focus();
  } 
  }

function onlyNumerics(varInput,ev){
    if (ev.keyCode==13) {
        cmdCheckout = document.getElementById("ctl00_MainContent_cltShoppingCart1_rptShoppingCart_ctl02_cmdCheckout");        
        cmdCheckout.click();
    }
    if (parseInt(String.fromCharCode(ev.keyCode))==0) return true;
    if (parseInt(String.fromCharCode(ev.keyCode))){
        return true;
    }else{
        return false;
    }
}

function calc_Amount(ObjTextbox){
    var varOld=ObjTextbox.value;
    var _regEx = new RegExp(/\D+/g);
    var varNew=varOld.replace(_regEx,"").replace(/^0+/,"");
    if (varNew=="") ObjTextbox.value="1";
    else if (parseInt(varNew)>0) ObjTextbox.value=varNew;
    else ObjTextbox.value="1";
    __doPostBack('ctl00$MainContent$lnkCallBack','Calculate_Amount');    
}


function PrintReceipt(){
    var disp_setting="toolbar=no,location=no,directories=no,menubar=no,"; 
    disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25"; 
    var content_vlue = document.getElementById("dvReceipt").innerHTML; 
  
    var docprint=window.open("","",disp_setting); 
    docprint.document.open(); 
    docprint.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">')
    docprint.document.write('<html><head><link href="../App_Themes/a2zTheme/a2zTheme.css" rel="stylesheet" type="text/css" /><title>Print  Receipt</title>'); 
    docprint.document.write('</head><body onLoad="self.print()"><center>');          
    docprint.document.write('<table style="width:100%"><tr>')
    docprint.document.write('<td align="left" style="width:50%"><a onclick="self.close();">Close this window</a></td>')
    docprint.document.write('<td align="right" style="width:50%"><a onclick="self.print();">Print this page</a></td>')    
    docprint.document.write('</tr><tr><td colspan="2" style="width:100%">')
    docprint.document.write(content_vlue);  
    docprint.document.write('</td></tr></table>')        
    docprint.document.write('</center></body></html>'); 
    docprint.document.close(); 
    docprint.focus(); 
    return false;
}

// Function for the master page loading indicater to come at the center.
function FloatLoadingIndicator(){
    if (document.getElementById("LoadingIndicator")){
        document.getElementById("LoadingIndicator").style.top=document.documentElement.scrollTop+window.screen.availHeight/2;
        document.getElementById("LoadingIndicator").style.left=document.documentElement.scrollLeft+window.screen.availWidth/2;
    }
}

////////////////////////////added by Dharmendra for Phone Fax

function IsNumeric(strString,onlydigits) 	
   {
   var strValidChars = "0123456789x";
   var strChar;
   var blnResult = true;
   
   if (onlydigits == true)
   {
    strValidChars = "0123456789";
   }
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
   
   
      
function Trim(TRIM_VALUE){
    if(TRIM_VALUE.length < 1){
    return"";
    }
    TRIM_VALUE = RTrim(TRIM_VALUE);
    TRIM_VALUE = LTrim(TRIM_VALUE);
    if(TRIM_VALUE==""){
    return "";
    }
    else{
    return TRIM_VALUE;
    }
} //End Function

function RTrim(VALUE){
    var w_space = String.fromCharCode(32);
    var v_length = VALUE.length;
    var strTemp = "";
    if(v_length < 0){
    return"";
  }
  var iTemp = v_length -1;

    while(iTemp > -1){
    if(VALUE.charAt(iTemp) == w_space){
    }
    else{
    strTemp = VALUE.substring(0,iTemp +1);
    break;
    }
    iTemp = iTemp-1;

    } //End While
    return strTemp;

} //End Function

function LTrim(VALUE){
    var w_space = String.fromCharCode(32);
    if(v_length < 1){
    return"";
    }
    var v_length = VALUE.length;
    var strTemp = "";

    var iTemp = 0;

    while(iTemp < v_length){
    if(VALUE.charAt(iTemp) == w_space){
    }
    else{
    strTemp = VALUE.substring(iTemp,v_length);
    break;
    }
    iTemp = iTemp + 1;
    } //End While
    return strTemp;
}	

function setKeywordFocus(ControlId){
    var t;          
    t = setTimeout(function (){setKeywordFocus(ControlId)},500);
    if ( $get(ControlId).style.display==""){
        try{
            $get(ControlId).focus();
            clearTimeout(t);
        }catch(ex){
        }
    }
}

function createAppt(TimeString,TimeAdd,ctlControlId){
    var vAMPM = TimeString.split(" ")[1];
    var vTimeString = TimeString.split(" ")[0];
    var hour=parseInt(vTimeString.split(":")[0]);
    var minute=parseInt(vTimeString.split(":")[1]);
    if (vAMPM=="PM") hour+=12;
    var today=new Date();
    /////// SETTING START APPOINTMENT TIME ///////
    var vTime=new Date(today.getFullYear(),today.getMonth(),today.getDay(),hour,minute);
    try{
        if (vTime.getMinutes()>9) document.getElementById(ctlControlId+"_txtStartMin").value=vTime.getMinutes();
        else document.getElementById(ctlControlId+"_txtStartMin").value="0"+vTime.getMinutes();
        if (vTime.getHours()>=12) {
            if (vTime.getHours()>12) document.getElementById(ctlControlId+"_ddlStartHr").value=vTime.getHours()-12;
            else document.getElementById(ctlControlId+"_ddlStartHr").value=vTime.getHours();
            document.getElementById(ctlControlId+"_ddlStartAMPM").value="PM";
        }else {
            if (vTime.getHours()>0) document.getElementById(ctlControlId+"_ddlStartHr").value=vTime.getHours();
            else document.getElementById(ctlControlId+"_ddlStartHr").value=vTime.getHours()+12;
            document.getElementById(ctlControlId+"_ddlStartAMPM").value="AM";
        }        
    }catch(ex){}
    /////// SETTING END APPOINTMENT TIME /////////
    vTime.setMinutes(vTime.getMinutes()+TimeAdd);
    try{
        if (vTime.getMinutes()>9) document.getElementById(ctlControlId+"_txtEndMin").value=vTime.getMinutes();
        else document.getElementById(ctlControlId+"_txtEndMin").value="0"+vTime.getMinutes();
        if (vTime.getHours()>=12) {   
            if (vTime.getHours()>12) document.getElementById(ctlControlId+"_ddlEndHr").value=vTime.getHours()-12;
            else document.getElementById(ctlControlId+"_ddlEndHr").value=vTime.getHours();
            document.getElementById(ctlControlId+"_ddlEndAMPM").value="PM";
        }else {
            if (vTime.getHours()>0) document.getElementById(ctlControlId+"_ddlEndHr").value=vTime.getHours();
            else document.getElementById(ctlControlId+"_ddlEndHr").value=vTime.getHours()+12;
            document.getElementById(ctlControlId+"_ddlEndAMPM").value="AM";
        }
        document.getElementById(ctlControlId+"_txtEndMin").focus();
    }catch(ex){}
}

function reset_eAPanel(){
    if (document.getElementById("ctl00_MainContent_ctlAgentMatches_pnlattendee")){
        var intdvGreatHeight=0, intdvCompListHeight=0, intdvGoodHeight=0, intdvAvgHeight=0;
        if (document.getElementById("ctl00_MainContent_ctlAgentMatches_dvGreatMatches")){
            intdvGreatHeight=parseInt(document.getElementById("ctl00_MainContent_ctlAgentMatches_dvGreatMatches").offsetHeight);
        }
        if (document.getElementById("ctl00_MainContent_ctlAgentMatches_topten_exhibitors")){
            intdvCompListHeight=parseInt(document.getElementById("ctl00_MainContent_ctlAgentMatches_topten_exhibitors").offsetHeight);
        }
        if (document.getElementById("ctl00_MainContent_ctlAgentMatches_dvLastMatches")){
            intdvGoodHeight=parseInt(document.getElementById("ctl00_MainContent_ctlAgentMatches_dvLastMatches").offsetHeight);
        }
        if (document.getElementById("ctl00_MainContent_ctlAgentMatches_dvAvgMatches")){
            intdvAvgHeight=parseInt(document.getElementById("ctl00_MainContent_ctlAgentMatches_dvAvgMatches").offsetHeight);
        }
        Array.min = function(array){
            return Math.min.apply(Math,array);
        };
        Array.max = function(array){
            return Math.max.apply(Math,array);
        };
        var arrHeight=new Array();
        arrHeight[0]=intdvGreatHeight;
        arrHeight[1]=intdvCompListHeight;
        arrHeight[2]=intdvGoodHeight;
        arrHeight[3]=intdvAvgHeight;
        var maxHeight = Array.max(arrHeight);
        if (document.getElementById("ctl00_MainContent_ctlAgentMatches_dvGreatMatches")){
            document.getElementById("ctl00_MainContent_ctlAgentMatches_dvGreatMatches").style.height=maxHeight+"px";
        }
        if (document.getElementById("ctl00_MainContent_ctlAgentMatches_topten_exhibitors")){
            document.getElementById("ctl00_MainContent_ctlAgentMatches_topten_exhibitors").style.height=maxHeight+"px";
        }
        if (document.getElementById("ctl00_MainContent_ctlAgentMatches_dvLastMatches")){
            document.getElementById("ctl00_MainContent_ctlAgentMatches_dvLastMatches").style.height=maxHeight+"px";
        }
        if (document.getElementById("ctl00_MainContent_ctlAgentMatches_dvAvgMatches")){
            document.getElementById("ctl00_MainContent_ctlAgentMatches_dvAvgMatches").style.height=maxHeight+"px";
        }
        if (document.getElementById("ctl00_MainContent_ctlAgentMatches_trMymatches")){
            document.getElementById("ctl00_MainContent_ctlAgentMatches_trMymatches").style.height=maxHeight+"px";
        }
    }else if (document.getElementById("ctl00_MainContent_ctlAgentMatches_pnlExhibitor")){    
        var intdvGreatHeight=0, intdvCompListHeight=0, intdvGoodHeight=0;
        if (document.getElementById("ctl00_MainContent_ctlAgentMatches_pnlGreatMatches")){
            intdvGreatHeight=parseInt(document.getElementById("ctl00_MainContent_ctlAgentMatches_pnlGreatMatches").offsetHeight);
        }
        if (document.getElementById("ctl00_MainContent_ctlAgentMatches_pnlCompanylist")){
            intdvCompListHeight=parseInt(document.getElementById("ctl00_MainContent_ctlAgentMatches_pnlCompanylist").offsetHeight);
        }
        if (document.getElementById("ctl00_MainContent_ctlAgentMatches_pnlMatchgraph2")){
            intdvGoodHeight=parseInt(document.getElementById("ctl00_MainContent_ctlAgentMatches_pnlMatchgraph2").offsetHeight);
        }
        Array.min = function(array){
            return Math.min.apply(Math,array);
        };
        Array.max = function(array){
            return Math.max.apply(Math,array);
        };
        var arrHeight=new Array();
        arrHeight[0]=intdvGreatHeight;
        arrHeight[1]=intdvCompListHeight;
        arrHeight[2]=intdvGoodHeight;
        var maxHeight = Array.max(arrHeight);
        if (document.getElementById("ctl00_MainContent_ctlAgentMatches_pnlGreatMatches")){
            document.getElementById("ctl00_MainContent_ctlAgentMatches_pnlGreatMatches").style.height=maxHeight+"px";
        }
        if (document.getElementById("ctl00_MainContent_ctlAgentMatches_pnlCompanylist")){
            document.getElementById("ctl00_MainContent_ctlAgentMatches_pnlCompanylist").style.height=maxHeight+"px";
        }
        if (document.getElementById("ctl00_MainContent_ctlAgentMatches_pnlMatchgraph2")){
            document.getElementById("ctl00_MainContent_ctlAgentMatches_pnlMatchgraph2").style.height=maxHeight+"px";
        }
        if (document.getElementById("dvMymatches")){
            document.getElementById("dvMymatches").style.height=maxHeight+"px";
        }
    }
}

