
	
	// ajax to include external file
	
		
		/***********************************************
		* Ajax Includes script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
		* This notice MUST stay intact for legal use
		* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
		***********************************************/
		
		//To include a page, invoke ajaxinclude("***.htm") in the BODY of page
		//Included file MUST be from the same domain as the page displaying it.
		
		//var rootdomain="http://"+window.location.hostname
		
		function ajaxinclude(url) {
		var page_request = false
			if (window.XMLHttpRequest) // if Mozilla, Safari etc
				page_request = new XMLHttpRequest()
			else if (window.ActiveXObject){ // if IE
				try {
					page_request = new ActiveXObject("Msxml2.XMLHTTP")
					} 
				catch (e){
					try{
						page_request = new ActiveXObject("Microsoft.XMLHTTP")
						}
						catch (e){}
					}
			}
			else
				return false
			page_request.open('GET', url, false) //get page synchronously 
			page_request.send(null)
			if (window.location.href.indexOf("http")==-1 || page_request.status==200)
				return page_request.responseText;
			}		
		
	
// Determine browser and version.
	function Browser() {
		var ua, s, i;
		
		this.isIE    = false;
		this.isNS    = false;
		this.version = null;
		
		ua = navigator.userAgent;
		
		s = "MSIE";
		if ((i = ua.indexOf(s)) >= 0) {
			this.isIE = true;
			this.version = parseFloat(ua.substr(i + s.length));
			return;
		}
		
		s = "Netscape6/";
		if ((i = ua.indexOf(s)) >= 0) {
			this.isNS = true;
			this.version = parseFloat(ua.substr(i + s.length));
			return;
		}
		
		// Treat any other "Gecko" browser as NS 6.1.
		s = "Gecko";
		if ((i = ua.indexOf(s)) >= 0) {
			this.isNS = true;
			this.version = 6.1;
			return;
		}
	}
  	
  
// custom code - lightbox window
/*

  	scrollX - to determine how far horizontally the browser is scrolled  
	scrollY - to determine how far verticallly the browser is scrolled
    windowHeight - the height of the veiwport	
	windowWidth - the width of the veiwport	
  
  /***** function to create the lightbox  
  bxContent : url of the external document or text message 
  bxTitle: title of the box
  w, h of the box
  type: 0 - normal message text
  		1 - external document - call ajaxinclude to pull the external page
  redirectUrl: url to redirect to after user click Close button.
  action: action to take after close the light box.
  toConfirm: confirm1  - Yes, No button; confirm2 - Ok, Cancel Buttons
		
  scrollX : to determine how far horizontally the browser is scrolled  
  scrollY : to determine how far verticallly the browser is scrolled
  windowHeight : the height of the veiwport	
  windowWidth : the width of the veiwport	

  
  *******/


  function showBox(bxContent, bxTitle, w, h, type, redirectUrl, action, toConfirm, btnArr )
{ 
	if(typeof bxContent =="undefined") bxContent="";  
	if(typeof bxTitle =="undefined")  bxTitle=document.title.split("|")[0];
	if(typeof w =="undefined") w=500;
	if(typeof h =="undefined") h=Math.ceil(bxContent.length/70)+150;
	if(typeof type=="undefined")type=0;;	
	if(typeof redirectUrl =="undefined") redirectUrl="";
	if(typeof action=="undefined") action="";	
	if(typeof toConfirm=="undefined") toConfirm="";
	if(typeof btnArr=="undefined") btnArr=['Close window'];	
	
	if (action!="")
		action = unescape(action);
  
	var de = document.documentElement;
	var db = document.body;
	var scrollX = (self.pageXOffset || (de && de.scrollLeft) || db.scrollLeft);
	var scrollY = (self.pageYOffset || (de && de.scrollTop) || db.scrollTop);
	var windowHeight = (self.innerHeight || (de && de.clientHeight) || db.clientHeight);
	var windowWidth	= (self.innerWidth || (de && de.clientWidth) || db.clientWidth);
	var wint = scrollY + (windowHeight /2) - (h/2) ;
	var winl = scrollX + (windowWidth/2) - (w/2);
	var browser = new Browser();	
   var layer = document.getElementById('layer');
    var div = document.getElementById('box');	
	
	
	this.removeBox = function (){
      db.removeChild(document.getElementById('layer'));
      db.removeChild(document.getElementById('box'));
	}  	
	
	this.closeBox = function () {
		  removeBox();
  		  if(redirectUrl!=""){		
		    location.replace(redirectUrl);
		  } else {
 	  	  	if(action!="")		  	
			   	eval(action);			  
      }	
	}
	
   if (!layer){
 		layer = document.createElement('div');
    	layer.id = 'layer';
   }	
   layer.style.left = '0px';
	//layer.style.height= windowHeight + de.offsetHeight  + 'px'; // add document.documentElement.offsetHeight so it will cover whole page in IE
	layer.style.height= de.scrollHeight  + 'px'; 
    db.appendChild(layer); 
   
    if(!div){
		  div = document.createElement('div');	
		  div.id = 'box';
    }	
    div.style.height = h + (browser.isNS ? 36: 0) + 'px';
    div.style.width = w + 'px';
    div.style.top = wint + 'px';
	  div.style.left = winl + 'px';
	  div.innerHTML = '<b class="hdCorner"><b class="Corner1"><b></b></b><b class="Corner2"><b></b></b><b class="Corner3"></b></b>';	
		div.innerHTML += '<span class="x1"><span class="x1a"></span></span><span class="x2"><span class="x2a"></span></span>';

    db.appendChild(div); 
	
	// heading
    var elhd = document.createElement('div');     
	elhd.className = 'hd';
	elhd.innerHTML = '<div style="float: left;">'+bxTitle + '</div><div style="float: right; padding-right:5px;"><a href="javascript:;" onclick="removeBox()"><img src="' +imageWWWPath+ '/close-2.png" id="imgClose" align="absmiddle"></a></div><div class="clear"></div>';
	div.appendChild(elhd);	
	
    var elc = document.createElement('div');
	elc.className = 'content'
	elc.id = 'pcont'
	
// corrects image path issue in lightboxes - part 1 of 2	
	var ajaxContent = '';
	if(type==1) {
		ajaxContent = ajaxinclude(bxContent);
		ajaxContent = ajaxContent.replace(/(\.\.\/images)/ig, imageWWWPath);
	} else if(type==2) { 
	   ajaxContent = '<div id="lbContainer"><iframe name="lbFrame" id="lbFrame" src="'+bxContent+'" width="100%" height=410" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="auto"></iframe></div>'
	}
	
	elc.style.height =  (h - 28 - 38) + "px";  // content's height =  h - header - footer

//	elc.innerHTML = ((type==0) ? '<p>'+bxContent+'</p>' :  '<div class="small" style="text-align: right;"><a href="" onclick="printSelection(document.getElementById(\'pcont\'));return false">print</a></div>' + ajaxinclude(bxContent) ); //+ '<br><br>' ;	
// corrects image path issue in lightboxes - part 2 of 2
//	elc.innerHTML = ((type==0) ? '<p>'+bxContent+'</p>' :   ajaxinclude(bxContent) ); //+ '<br><br>' ;	
	elc.innerHTML = ((type==0) ? '<p>'+bxContent+'</p>' :   ajaxContent ); //+ '<br><br>' ;	
	
	// footer
	var elft = document.createElement('div');
	elft.className = 'ft';
//	if(toConfirm.toUpperCase().indexOf("CONFIRM") == -1){
	if(toConfirm.length==0 || toConfirm==""){
			// close button	
		    var a = document.createElement('a');
			a.className = 'button';
	    a.innerHTML = btnArr[0];
	    a.href = 'javascript:closeBox();';
		elft.appendChild(a);		
	} else {
	
		if (toConfirm=="confirm"){
			toConfirm= ["Yes", "No"];
		}
		// OK button	
   		var okbtn = document.createElement('a');
		okbtn.className = 'button';
		okbtn.id="YesBtn"		
	    okbtn.innerHTML = toConfirm[0];
 	    okbtn.href = 'javascript:closeBox();';
		elft.appendChild(okbtn);
    
		// No button	
	    var nobtn = document.createElement('a');
		nobtn.className = 'button';
		nobtn.id="NoBtn"
	    nobtn.innerHTML = toConfirm[1];
	    nobtn.href = 'javascript:removeBox()';
		elft.appendChild(nobtn);	
	}	
  

	div.appendChild(elc);
	div.appendChild(elft);		
	div.innerHTML += '<b class="ftCorner"><b class="Corner5"></b><b class="Corner4"></b><b class="Corner3"></b><b class="Corner2"><b></b></b><b class="Corner1"><b></b></b></b>';		

}


// function to print only a div content 
function printSelection(node){

  var content=node.innerHTML
  var pwin=window.open('','print_content','width=100,height=100');
  pwin.resizeTo(1,1);
	
  pwin.document.open();
  pwin.document.write('<html><body onload="window.print()">'+content+'</body></html>');
  pwin.document.close();
 
  setTimeout(function(){pwin.close();},1000);

}  

// function to center the light box as the user scrolls the window
function adjustBox(){
		var obj = document.getElementById('box');
		if (!obj) return;
  
	var de = document.documentElement;
	var db = document.body;
	var scrollX = (self.pageXOffset || (de && de.scrollLeft) || db.scrollLeft);
	var scrollY = (self.pageYOffset || (de && de.scrollTop) || db.scrollTop);
	var windowHeight = (self.innerHeight || (de && de.clientHeight) || db.clientHeight);
	var windowWidth	= (self.innerWidth || (de && de.clientWidth) || db.clientWidth);
	
		var w= Number(obj.style.width.substr(0,obj.style.width.length-2) );
		var h= Number(obj.style.height.substr(0,obj.style.height.length-2) );
	
	var t=scrollY + (windowHeight /2) - (h/2);
		if (t<0) t=0;

	var l=scrollX + (windowWidth/2) - (w/2);
		if (l<0) l=0;
	
		obj.style.top = t+"px";
		obj.style.left = l+"px";
	
      } 



  function confirmBox(bxContent, bxAction )
      {
    var answer = false;
	if(typeof(bxTitle)=="undefined") 	bxTitle ="Are You Sure?";
	if(typeof(w)=="undefined") 			w=300;
	if(typeof(h)=="undefined") 			h=110;
	if(typeof(type)=="undefined") 		type=0;	
	
		if(typeof(bxAction)=="undefined") {
			return;
		} else {
			bxAction = unescape(bxAction);
	}
	
	var wint = ( ( windowHeight()-h)/2 + scrollY() );
	var winl = scrollX() + (windowWidth()/2 ) - (w/2);
	
	//var winl = ( windowWidth()-w/2 + scrollX() );
	if (h > (windowHeight()/2))  wint = wint - (h - (windowHeight()/2))-100;
	if (wint<0)   wint = 10;	
	
    var layer = document.createElement('div');
    	layer.id = 'layer';
	layer.style.height= windowHeight() + document.documentElement.offsetHeight  + 'px'; // add document.documentElement.offsetHeight so it will cover whole page in IE
    document.body.appendChild(layer); 
   
    var div = document.createElement('div');
		  div.id = 'box';
    div.style.height = h;
    div.style.width = w;
    div.style.top = wint + 'px';
	  div.style.left = winl + 'px';
//    div.style.border = '1px solid silver';
    document.body.appendChild(div); 

	
	// heading
    var elhd = document.createElement('div');     
	elhd.className = 'hd';
	elhd.innerHTML = bxTitle;
	div.appendChild(elhd);	
	
	// content  
    var elc = document.createElement('div');
	elc.className = 'content'
	elc.id = 'pcont'
	elc.style.height =  (h - elhd.style.height - 20);
	elc.innerHTML = ((type==0) ? '<p>'+bxContent+'</p>' :  '<div class="small" style="text-align: right;"><a href="" onclick="printSelection(document.getElementById(\'pcont\'));return false">print</a></div>' + ajaxinclude(bxContent) ); //+ '<br><br>' ;	
	
	var elft = document.createElement('div');
	elft.className = 'ft';
	
	// OK button	
    var okbtn = document.createElement('a');
	okbtn.className = 'button';
	okbtn.id="YesBtn"
	okbtn.style.margin="10px"	
	okbtn.style.color="#333";			
    okbtn.innerHTML = 'Yes';
    okbtn.href = 'javascript:void(0)';
    okbtn.onclick = function()
	{	
		document.body.removeChild(document.getElementById('layer'));
	    document.body.removeChild(document.getElementById('box'));
		eval('minicart.' + bxAction);
		return true;
	}	
				
	elft.appendChild(okbtn);		
    
		// No button	
	    var nobtn = document.createElement('a');
		nobtn.className = 'button';
		nobtn.id="NoBtn"
	nobtn.style.margin="10px"		
	nobtn.style.color="#333";		
    nobtn.innerHTML = 'No';
    nobtn.href = 'javascript:void(0)';
    nobtn.onclick = function() 
	{	
		document.body.removeChild(document.getElementById('layer'));
	    document.body.removeChild(document.getElementById('box'));
		return false;
	}	
  

	elft.appendChild(nobtn);				
	div.appendChild(elc);
	div.appendChild(elft);		

}

function confirmBox(bxContent, bxTitle, w, h, type, redirectUrl, forwardUrl)
{ 
	if(typeof bxContent =="undefined") bxContent="";  
	if(typeof bxTitle =="undefined")  bxTitle=document.title;
	if(typeof w =="undefined") w=600;
	if(typeof h =="undefined") h=480;
	if(typeof type=="undefined")type=0;;	
	if(typeof redirectUrl =="undefined") redirectUrl="";
  if(typeof forwardUrl =="undefined") forwardUrl="";		
	
  
	var de = document.documentElement;
	var db = document.body;
	var scrollX = (self.pageXOffset || (de && de.scrollLeft) || db.scrollLeft);
	var scrollY = (self.pageYOffset || (de && de.scrollTop) || db.scrollTop);
	var windowHeight = (self.innerHeight || (de && de.clientHeight) || db.clientHeight);
	var windowWidth	= (self.innerWidth || (de && de.clientWidth) || db.clientWidth);
	var wint = scrollY + (windowHeight /2) - (h/2) ;
	var winl = scrollX + (windowWidth/2) - (w/2);
	var browser = new Browser();	
   var layer = document.getElementById('layer');
    var div = document.getElementById('box');	
	
	
	this.removeBox = function (){
      db.removeChild(document.getElementById('layer'));
      db.removeChild(document.getElementById('box'));
	}  	
	
	this.closeBox = function (type) {
		  removeBox();
      if(type == 2)
      {	
  		  if(redirectUrl!=""){		
  		    location.href = redirectUrl;
  		  } 
      }
      else if(type == 1)
      {
        if(forwardUrl!=""){		
  		    location.href = forwardUrl;
  		  } 
      }	
	}
	
   if (!layer){
 		layer = document.createElement('div');
    	layer.id = 'layer';
   }	
   layer.style.left = '0px';
	 layer.style.height= windowHeight + de.offsetHeight  + 'px'; // add document.documentElement.offsetHeight so it will cover whole page in IE
    db.appendChild(layer); 
   
    if(!div){
		  div = document.createElement('div');	
		  div.id = 'box';
    }	
    div.style.height = h + (browser.isNS ? 36: 0) + 'px';
    div.style.width = w + 'px';
    div.style.top = wint + 'px';
	  div.style.left = winl + 'px';
	  div.innerHTML = '<b class="hdCorner"><b class="Corner1"><b></b></b><b class="Corner2"><b></b></b><b class="Corner3"></b></b>';	
		div.innerHTML += '<span class="x1"><span class="x1a"></span></span><span class="x2"><span class="x2a"></span></span>';

    db.appendChild(div); 
	
	// heading
    var elhd = document.createElement('div');     
	elhd.className = 'hd';
	elhd.innerHTML = '<div style="float: left;">'+bxTitle + '</div><div style="float: right; padding-right:5px;"><a href="javascript:;" onclick="removeBox()"><img src="' +imageWWWPath+ '/close.png" id="imgClose" align="absmiddle"></a></div><div class="clear"></div>';
	div.appendChild(elhd);	
	
    var elc = document.createElement('div');
	elc.className = 'content'
	elc.id = 'pcont'
	
	elc.style.height =  (h - 28 - 38) + "px";  // content's height =  h - header - footer

//	elc.innerHTML = ((type==0) ? '<p>'+bxContent+'</p>' :  '<div class="small" style="text-align: right;"><a href="" onclick="printSelection(document.getElementById(\'pcont\'));return false">print</a></div>' + ajaxinclude(bxContent) ); //+ '<br><br>' ;	
	elc.innerHTML = ((type==0) ? '<p>'+bxContent+'</p>' :   ajaxinclude(bxContent) ); //+ '<br><br>' ;	
	
	// footer
	var elft = document.createElement('div');
	elft.className = 'ft';
	
		
		// OK button	
   		var okbtn = document.createElement('a');
		okbtn.className = 'button';
		okbtn.id="YesBtn"		
	    okbtn.innerHTML = 'Accept';
 	    okbtn.href = 'javascript:closeBox(1);';
		elft.appendChild(okbtn);
    
		// No button	
	    var nobtn = document.createElement('a');
		nobtn.className = 'button';
		nobtn.id="NoBtn"
	    nobtn.innerHTML = 'Decline';
	    nobtn.href = 'javascript:closeBox(2)';
		elft.appendChild(nobtn);	
  	
  

	div.appendChild(elc);
	div.appendChild(elft);		
	div.innerHTML += '<b class="ftCorner"><b class="Corner5"></b><b class="Corner4"></b><b class="Corner3"></b><b class="Corner2"><b></b></b><b class="Corner1"><b></b></b></b>';		

}

function showTermsAndConditions(redirect)
{
  var terms = '<div>';
  terms += '<h1>Men&#39;s Basketball Student Season Ticket Information</h1>';
  terms += '<p>Students reaching this page should have been selected to receive a 2010-11 Men&#39;s Basketball Student Season Ticket through the season lottery process.</p>';
  terms += '<p>Season ticket seats will be assigned in a preferred location. <b>Tickets are $77.</b></p>';
  terms += '<p>The Student Season Ticket will include the same seat for all games played in Cassell Coliseum this season with the exception of USC Upstate, Mt. St. Mary&#39;s and Florida State. These games take place over university breaks and will not be included in the package. Students purchasing a season ticket that wish to attend these games should enter the individual game lottery for a ticket.</p>';
  terms += '<p>This season, student season tickets will be issued by means of electronic delivery. Upon completion of the allocation process, seat locations will be locked in, and tickets for each game will be emailed to student season ticket holders approximately 3 days prior to each game.  Students then need only print out the attachment for the game they are attending.</p>';
  terms += '<p><b>The ordering period for the will run from 12:01 a.m. Wednesday, October 13th until Monday, October 18th at 4:59 p.m..</b></p>';
  terms += '<p><hr></p>';
  terms += '<h2>FREQUENTLY ASKED QUESTIONS<br />2010-11 Student Basketball Season Ticket Option</h2>';
  terms += '<p><b>Who is eligible to buy student season tickets?</b><br />';
  terms += 'Any current full-time Virginia Tech student who will also be registered for the Spring Semester 2011 and students currently enrolled full time in the Study Abroad, European Studies Center, and the Cooperative Education programs who will also be registered for the Spring Semester 2011, may purchase one season ticket. Part time students are eligible if they pay the optional athletic fee in the fall semester and will be either enrolled full time in the spring semester, or have paid the optional athletic fee for the spring semester.  Spring semester enrollment will be checked with the Registrar&#39;s Office. Graduating seniors should contact the Hokie Club at (540) 231-6618 for information regarding enrollment in the Hokie Club for future season ticket orders.</p>';
  terms += '<p><b>How do I order a student season ticket?</b><br />';
  terms += 'To order a student basketball season ticket, you must complete the online form.  If you purchased football student season tickets, simply log in with your student ID # and your university password.  For new ticket accounts, click on the link for "New Student Ticket Account - Not Yet Registered for 2010-11".  You will be asked for your student number and your birth month and year to link to your online account. You must verify the address information provided to complete registration.  Once registration is complete you will have to log in using the email address you specified during registration and the newly created password to place your order.</p>';
  terms += '<p><b>How much does a men&#39;s basketball student season ticket cost?</b><br />';
  terms += 'The cost of the student ticket is $77. A student season ticket will guarantee the same reserved seat for all home games. (USC Upstate, Mt. St. Mary&#39;s and Florida State are not included in the season ticket). Guest tickets are not available for basketball due to the limited size of the student allotment.</p>';
  terms += '<p><b>Am I guaranteed a ticket if I place an order?</b><br />';
  terms += 'Yes. Since you were selected through the lottery, you will get tickets if you complete the online ordering process.</p>';
  terms += '<p><b>How is seating priority determined?</b><br />';
  terms += 'Seating will be assigned randomly in a preferred seating area.</p>';
  terms += '<p><b>What if I want to sit with my friends?</b><br />';
  terms += '<ol><li><p>Students who wish to sit together must be part of a Seating Group before submitting their order.</p></li>';
  terms += '<li><p>One member of the group should use the "Create Group" link at the bottom of the ordering page. This "group leader" will be asked to assign the group a name and a password to be used by all the students that wish to be part of the group. The "group leader" must then enter the email addresses of all the students who are invited to join the newly created group. <b>Group leaders must remember to select the newly created group from the pull-down "Group Seating Preference" menu when ordering to be seated with their group.</b></p></li>';
  terms += '<li><p>Each person that the "group leader" invites to join his/her group will be sent an email from the ticket office with the group name and password that they should use to join the Seating Group.</p></li>';
  terms += '<li><p>The students invited to join the Seating Group should use the "Join Group" link to associate their order to the group. <b>Each group member should then complete their application making sure to use the pull down window under "Group Seating Preferences" to select the correct Seating Group.</b></p></li>';
  terms += '<li><p>If you wish to be part of a Seating Group you must join the group before you submit your application. Once the application has been submitted you will not be able to join or change your group assignment.</p></li>';
  terms += '<li style="list-style-type: none;"><b>Seating is limited to 30 students per group.</b></li></ol>';
  terms += '<b>When do I pay for my ticket?</b><br />';
  terms += 'Students will be immediately charged by credit card $77 for the cost of the ticket and $15 for electronic handling and delivery.  There will be no refunds.<br /><br />';
  terms += '<b>How do I receive my student season ticket?</b><br />';
  terms += 'Student season tickets will delivered as an electronic Print at Home ticket. No later than two days prior to a home game student season ticket holders will receive an email from the ticket office containing a .pdf attachment of their ticket for that week&#39;s game. The season ticket holder should print out that ticket and bring it to the coliseum on game day for admission to their seat. Students must have their Print at Home ticket delivered to their official Virginia Tech (@vt.edu) email address. The ticket office will not be able to facilitate delivery tracking of emails forwarded to an outside email address. Replacements will not be issued. There will be a $15.00 fee added to each order to cover the cost of electronic processing and electronic delivery.';
  terms += 'To get more information or if you have a specific question you can call the Virginia Tech Athletic Ticket Office at 800-VA TECH 4 or 540-231-6731';
  terms += '</div>';
  redirect = (redirect == 'ACTIVATE') ? "javascript:goOn('"+redirect+"')" : 'javascript:submitLoginForm()';
  confirmBox(terms, 'Student Ticket Policies and Procedures', 600, 600, 0, 'javascript:closeBox()', redirect);
}

function showJoinGroup(type, args)
{
  var group = '<div>';
  group += '<p>Are you sure you do not want to join a group</p>';
  group += '</div>';
  createURL = "javascript:goToCreateGroup()";
  joinURL = "javascript:goToJoinGroup()";
  if(type == "PRICE")
  {
    if(document.mainForm.groupSeatCode.value != '')
    {
      mapClicked('P', args);
      return;
    }
    else
    {    
      noURL = "javascript:mapClicked('P', '"+args+"')";
    }
  }
  else if(type == 'ADD')
  {
    if(document.mainForm.groupSeatCode.value != '')
    {
      addtocart();
      return;
    }
    else
    {
      noURL = "javascript:addtocart()";
    }
  }
  else if(type == 'BEST')
  {
    if(document.mainForm.groupSeatCode.value != '')
    {
      bestAvailableClick();
      return;
    }
    else
    {
      noURL = "javascript:bestAvailableClick()";
    }
  }
  joinGroup(group, 'Join a Group', 600, 200, 0, noURL, createURL, joinURL);
}

function joinGroup(bxContent, bxTitle, w, h, type, redirectUrl, createUrl, joinUrl)
{ 
	if(typeof bxContent =="undefined") bxContent="";  
	if(typeof bxTitle =="undefined")  bxTitle=document.title;
	if(typeof w =="undefined") w=600;
	if(typeof h =="undefined") h=480;
	if(typeof type=="undefined")type=0;;	
	if(typeof redirectUrl =="undefined") redirectUrl="";
  if(typeof createUrl =="undefined") createUrl="";
  if(typeof joinUrl =="undefined") joinUrl="";		
	
  
	var de = document.documentElement;
	var db = document.body;
	var scrollX = (self.pageXOffset || (de && de.scrollLeft) || db.scrollLeft);
	var scrollY = (self.pageYOffset || (de && de.scrollTop) || db.scrollTop);
	var windowHeight = (self.innerHeight || (de && de.clientHeight) || db.clientHeight);
	var windowWidth	= (self.innerWidth || (de && de.clientWidth) || db.clientWidth);
	var wint = scrollY + (windowHeight /2) - (h/2) ;
	var winl = scrollX + (windowWidth/2) - (w/2);
	var browser = new Browser();	
   var layer = document.getElementById('layer');
    var div = document.getElementById('box');	
	
	
	this.removeBox = function (){
      db.removeChild(document.getElementById('layer'));
      db.removeChild(document.getElementById('box'));
	}  	
	
	this.closeBox = function (type) {
		  removeBox();
      if(type == 2)
      {	
  		  if(redirectUrl!=""){		
  		    location.href = redirectUrl;
  		  } 
      }
      else if(type == 1)
      {
        if(createUrl!=""){		
  		    location.href = createUrl;
  		  } 
      } 
      else if(type == 3)
      {
        if(joinUrl!=""){		
  		    location.href = joinUrl;
  		  } 
      }	
	}
	
   if (!layer){
 		layer = document.createElement('div');
    	layer.id = 'layer';
   }	
   layer.style.left = '0px';
	 layer.style.height= windowHeight + de.offsetHeight  + 'px'; // add document.documentElement.offsetHeight so it will cover whole page in IE
    db.appendChild(layer); 
   
    if(!div){
		  div = document.createElement('div');	
		  div.id = 'box';
    }	
    div.style.height = h + (browser.isNS ? 36: 0) + 'px';
    div.style.width = w + 'px';
    div.style.top = wint + 'px';
	  div.style.left = winl + 'px';
	  div.innerHTML = '<b class="hdCorner"><b class="Corner1"><b></b></b><b class="Corner2"><b></b></b><b class="Corner3"></b></b>';	
		div.innerHTML += '<span class="x1"><span class="x1a"></span></span><span class="x2"><span class="x2a"></span></span>';

    db.appendChild(div); 
	
	// heading
    var elhd = document.createElement('div');     
	elhd.className = 'hd';
	elhd.innerHTML = '<div style="float: left;">'+bxTitle + '</div><div style="float: right; padding-right:5px;"><a href="javascript:;" onclick="removeBox()"><img src="' +imageWWWPath+ '/close.png" id="imgClose" align="absmiddle"></a></div><div class="clear"></div>';
	div.appendChild(elhd);	
	
    var elc = document.createElement('div');
	elc.className = 'content'
	elc.id = 'pcont'
	
	elc.style.height =  (h - 28 - 38) + "px";  // content's height =  h - header - footer

//	elc.innerHTML = ((type==0) ? '<p>'+bxContent+'</p>' :  '<div class="small" style="text-align: right;"><a href="" onclick="printSelection(document.getElementById(\'pcont\'));return false">print</a></div>' + ajaxinclude(bxContent) ); //+ '<br><br>' ;	
	elc.innerHTML = ((type==0) ? '<p>'+bxContent+'</p>' :   ajaxinclude(bxContent) ); //+ '<br><br>' ;	
	
	// footer
	var elft = document.createElement('div');
	elft.className = 'ft';
	
	var lineBreak1 = document.createElement('br');
  var lineBreak2 = document.createElement('br');	
		// Join button	
   		var joinbtn = document.createElement('a');
		joinbtn.id="JoinBtn"		
	    joinbtn.innerHTML = 'Yes, I want to join an existing seating group<br />';
 	    joinbtn.href = 'javascript:closeBox(3);';
		elc.appendChild(joinbtn); 
		
		elc.appendChild(lineBreak1);
    
    // Create button	
   		var createbtn = document.createElement('a');
		createbtn.id="CreateBtn"		
	    createbtn.innerHTML = 'Yes, I want to create a new seating group<br />';
 	    createbtn.href = 'javascript:closeBox(1);';
		elc.appendChild(createbtn);  
				
		elc.appendChild(lineBreak2);
    
		// No button	
	    var nobtn = document.createElement('a');
		nobtn.id="NoBtn"
	    nobtn.innerHTML = 'Continue. I&#8217;m sure I do not want to join a group and I understand that I can&#8217;t join a group later';
	    nobtn.href = 'javascript:closeBox(2)';
		elc.appendChild(nobtn);	
  	
  

	div.appendChild(elc);
	div.appendChild(elft);		
	div.innerHTML += '<b class="ftCorner"><b class="Corner5"></b><b class="Corner4"></b><b class="Corner3"></b><b class="Corner2"><b></b></b><b class="Corner1"><b></b></b></b>';		

}

