function $dome(id){
	
  return  document.getElementById(id);	
}
function dome_hidden(id){
  $dome(id).style.display = 'none';	
}

function dome_show(id){
   $dome(id).style.display = 'block';	
}
function top_search(thisObj){   // the Select above the Navigator
 thisObj.parentNode.className = 's_box_on';
 var thisinput = thisObj.getElementsByTagName("input");
 var thisul = thisObj.getElementsByTagName("ul");
 var thisli = thisul[0].getElementsByTagName("li");
 if(thisObj.id != "CoLeeSelect"){
  thisObj.id = "CoLeeSelect";
  thisObj.focus();
  thisul[0].style.display = "block";
  for(var i=0;i<thisli.length;i++){
   thisli[i].onmouseover = function(){
    for(var j=0;j<thisli.length;j++){
     if(thisli[j].className=='last_li')thisli[j].className = "last_li";
	   else if(thisli[j].className == 'last_li_on')thisli[j].className = 'last_li';
	     else thisli[j].className = "";
	 //jQuery(this).removeClass("li_on");
     }
	if(this.className=="last_li")this.className = "last_li_on";
	   else if(this.className == 'last_li_on')this.className = 'last_li';
	      else  this.className = "li_on";
	//jQuery(this).addClass("li_on");
    }
   thisli[i].onclick = function(){
	  
	  //  alert(jQuery(this).get(0).tagName)
	 webname = new Array('adwick','armthorpe','askern','crookhill','dclt','dearne','edlington','hatfield','rossington','rossington_cvs','default','st_james','thorne');
	 url_name = new Array(
						   'http://www.adwickleisurecentre.co.uk',
						   'http://www.armthorpeleisurecentre.co.uk',
						   'http://www.askernleisurecentre.co.uk',
						   'http://www.crookhillgolfcourse.co.uk',
						   'http://www.dclt.co.uk',
						   'http://www.dearne-valley.co.uk',
						   'http://www.edlingtonleisurecentre.co.uk',
						   'http://www.hatfieldwaterpark.co.uk',
						   'http://www.rossingtonleisurecentre.co.uk',
						   'http://www.rossingtoncsv.co.uk',
						   'http://www.the-dome.co.uk',
						   'http://www.stjamesleisurecentre.co.uk',
						   'http://www.thorneleisurecentre.co.uk'
						  );
	 
	 getname = this.getElementsByTagName("span")[0].getAttribute("web");
	 
     for(i=0;i<webname.length;i++){
		  if(webname[i] == getname){
			  window.location.href = url_name[i];
		  }
	 }
	 
    if(this.innerText)thisinput[0].value = this.innerText;
	if(this.textContent)thisinput[0].value = this.textContent;
	if( thisinput[0].value.charAt(thisinput[0].value.length-1) == " ") thisinput[0].value =  thisinput[0].value.substr(0,  thisinput[0].value.length-1);//ie7下会末尾多一个空格，此处把空格去除
	/*if( thisinput[0].value!='Please select...') {
		thisinput[0].className = 'nav_select_s';
		if(this.id=='pro1'){temp1='';temp1=this.getAttribute("urlkey");}
		if(this.id=='pro2'){temp2=this.getAttribute("pro"); temp3=this.getAttribute("cat");}
	}
	 else  { thisinput[0].className = 'nav_select';}*/
    }
   }
  }else{
   ObjBlur();
  }
  thisObj.onblur = ObjBlur;
  function ObjBlur(){
   thisObj.parentNode.className = 's_box';
   thisObj.id =  "";
   thisul[0].style.display = "none";
   thisObj.blur();
   }
 }
 
 function CoLeeSelect2(thisObj){   // the Select above the Navigator
 var thisinput = thisObj.getElementsByTagName("input");
 var thisul = thisObj.getElementsByTagName("ul");
 var thisli = thisul[0].getElementsByTagName("li");
 if(thisObj.id != "CoLeeSelect"){
  thisObj.id = "CoLeeSelect";
  thisObj.focus();
  thisul[0].style.display = "block";
  for(var i=0;i<thisli.length;i++){
   thisli[i].onmouseover = function(){
    for(var j=0;j<thisli.length;j++){
     // thisli[j].className = "";
	 //jQuery(this).removeClass("li_on");
	 if(thisli[j].className=='last_li')thisli[j].className = "last_li";
	 //  else if(thisli[j].className == 'last_li_on')thisli[j].className = 'last_li';
	     else thisli[j].className = "";
     }
	 this.className = "highlight";
	//jQuery(this).addClass("li_on");
	if(this.className=="last_li");//this.className = "last_li_on";
	  // else if(this.className == 'last_li_on')this.className = 'last_li';
	      else  this.className = "li_on";
    }
   thisli[i].onclick = function(){
    if(this.innerText)thisinput[0].value = this.innerText;
	if(this.textContent)thisinput[0].value = this.textContent;
	if( thisinput[0].value.charAt(thisinput[0].value.length-1) == " ") thisinput[0].value =  thisinput[0].value.substr(0,  thisinput[0].value.length-1);//ie7下会末尾多一个空格，此处把空格去除
	/*if( thisinput[0].value!='Please select...') {
		thisinput[0].className = 'nav_select_s';
		if(this.id=='pro1'){temp1='';temp1=this.getAttribute("urlkey");}
		if(this.id=='pro2'){temp2=this.getAttribute("pro"); temp3=this.getAttribute("cat");}
	}
	 else  { thisinput[0].className = 'nav_select';}*/
	 if(this.getAttribute("orderhref")) window.location.href=this.getAttribute("orderhref")+"&order_m="+thisinput[0].value;
	
	if(this.getAttribute("riqi"))$dome("swim-date-year-month-value").value = this.getAttribute("riqi");
	 
    }
   }
  }else{
   ObjBlur();
  }
  thisObj.onblur = ObjBlur;
  function ObjBlur(){
   thisObj.id =  "";
   thisul[0].style.display = "none";
   thisObj.blur();
   if(thisinput[0].id == 'swim-date-day' || thisinput[0].id =='swim-date-year-month')thisObj.focus();
   }
 }
 
 
 
 function changeEvents(obj,currennum,totalnum){ // Home Page Calendar Events
		   for(var i=1;i<=totalnum;i++){			         
					 if(i!=currennum){
  	 			          document.getElementById('h_c_e_container_m_con_'+i).style.display="none";
						 }else{							 
							 document.getElementById('h_c_e_container_m_con_'+i).style.display="block";
							 }			   
			   }
			num = new Array();
			jQuery("#feature, #whatson, #venues, #news").hide();
			if(currennum ==1 )jQuery("#feature").show();
			  else if(currennum ==2 )jQuery("#whatson").show();
			     else if(currennum ==3 )jQuery("#venues").show();
			       else if(currennum ==4 )jQuery("#news").show();
			
		}
 		
 function changeEvents2(obj,currennum,totalnum){ // Home Page - Blog Facebook Twitter  
           
		   var bpath = "";
		   bpath = jQuery('.h_calendar_events_container_t .facebook .h_c_e_nav_w img').attr("relpath");
		   for(var i=1;i<=totalnum;i++){			         
					 if(i!=currennum){
  	 			          document.getElementById('ha_c_e_container_m_con_'+i).style.display="none";						  
						 }else{							 							
							if(i==2){									
	//							newbg = tembg.replace("h_wi_fb_bg.png","h_wi_fb_bg_blue.png");
//								jQuery('.h_wi_fb').css("backgroundImage",newbg);
                                jQuery('#h_wi_fb').addClass('h_wi_fbblue');
								jQuery('#h_wi_fb').removeClass('h_wi_bgbg');
								jQuery('#h_wi_fb').removeClass('h_wi_blogblack');	
								jQuery('.h_calendar_events_container_t .facebook .h_c_e_nav_w img').attr("src",bpath+"/h_nav_fbook_hoverbg.png");
								jQuery('.h_wi_fb .h_calendar_events_container .h_calendar_events_container_m').css("overflow-y","scroll");
							}else if(i==1){
								jQuery('#h_wi_fb').addClass('h_wi_bgbg');								 
 							    jQuery('#h_wi_fb').removeClass('h_wi_fbblue');	
								jQuery('#h_wi_fb').removeClass('h_wi_blogblack');								
								jQuery('.h_calendar_events_container_t .facebook .h_c_e_nav_w img').attr("src",bpath+"/h_wi_fb_facebook_button.png");
								jQuery('.h_wi_fb .h_calendar_events_container .h_calendar_events_container_m').css("overflow-y","hidden");								
							}else if(i==3){	
								jQuery('#h_wi_fb').removeClass('h_wi_bgbg');						 
 							    jQuery('#h_wi_fb').removeClass('h_wi_fbblue');
								jQuery('#h_wi_fb').addClass('h_wi_blogblack');		
								jQuery('.h_calendar_events_container_t .facebook .h_c_e_nav_w img').attr("src",bpath+"/h_wi_fb_facebook_button.png");
							}								 
							 document.getElementById('ha_c_e_container_m_con_'+i).style.display="block";							 
							 }			   
			   }		
		}
 function hpollresult(obj,currennum,totalnum){ // Home Page -- Daily Poll
		   for(var i=1;i<=totalnum;i++){			         
					 if(i==currennum){  						    
							document.getElementById('h_pooll_'+i).style.display="block";	
						 }else{										    
							 document.getElementById('h_pooll_'+i).style.display="none";
					 }			   
			   }		
}

/*************** 获取窗口大小 ***************/
var winWidth = 0;
var winHeight = 0;
function findDimensions() //函数：获取尺寸
{
//获取窗口宽度
if (window.innerWidth)
winWidth = window.innerWidth;
else if ((document.body) && (document.body.clientWidth))
winWidth = document.body.clientWidth;
//获取窗口高度
if (window.innerHeight)
winHeight = window.innerHeight;
else if ((document.body) && (document.body.clientHeight))
winHeight = document.body.clientHeight;
//通过深入Document内部对body进行检测，获取窗口大小
if (document.documentElement  && document.documentElement.clientHeight && document.documentElement.clientWidth)
{
winHeight = document.documentElement.clientHeight;
winWidth = document.documentElement.clientWidth;
}
//结果输出至两个文本框

}
findDimensions();
//调用函数，获取数值
window.onresize=findDimensions; 
function resisef(w,h,id){
	findDimensions();
	dome_pop_up(w,h,id)
}
//-->
function dome_pop_up(w,h,id){	
	WLeft_f2   =   Math.ceil((winWidth   -   w)   /   2  );
    WTop_f2   =   Math.ceil((winHeight   -   h)   /   2   ); 
	if(WTop_f2<0) WTop_f2=10;
	obj_f2 = document.getElementById(id);
    obj_f2.style.left = WLeft_f2 +"px";
    obj_f2.style.top =WTop_f2 +"px";		
}


 
 /************event month sort**jonathan20110422*********/
  function initCmonth(){
	   var cdate = new Date();
	   var cmonth = cdate.getMonth();
	   var months =new Array('January', 'February', 'March', 'April ', 'May ', 'June ', 'July ', 'August ', 'September ',
					'October', 'November ', 'December' );  
	   cmonth = months[cmonth];
	   jQuery("#event_month_val").val(cmonth);	
 }
	 
 function sortMonths(){
	   var cdate = new Date();
	   var cmonth = cdate.getMonth();	
	   var months =new Array('January', 'February', 'March', 'April ', 'May ', 'June ', 'July ', 'August ', 'September ',
					'October', 'November ', 'December' );   
	   var stringpre = "<li><div onclick=\"senddata_simple(this,'event_search_month_show_ul','#event_month_val');\">";
	   var stringlas = "</li>";
	   var monthsort = ""; 
		 for(var i=cmonth;i<12;i++){		 
			     monthsort+=(stringpre+ months[i]+stringlas);		 
		 }  
		 for(var i=0;i<cmonth;i++){
    			 monthsort+=(stringpre+ months[i]+stringlas);		 			 
			 }
		monthsort = "<li><div onclick=\"senddata_simple(this,'event_search_month_show_ul','#event_month_val');\">Please select</div></li>"+monthsort;	 
	   jQuery("#event_search_month_show_ul").html(monthsort);
 
	}
/******end month sort***********/	

function dome_pop_show(obj,obj1,obj2){	



   if(obj2 == 'dome_newsletter_box'){ /*******Home Page THE DOME NEWSLETTER ******/

	    jQuery("#dome_newsletter_box .h_news_pop_input #name").val(jQuery(".h_newletter_fullname #fullname").val())

		jQuery("#dome_newsletter_box .h_news_pop_input #emailaddress").val(jQuery(".h_newletter_email #email").val())

		dome_show(obj1);

   }

   if(obj.checked==true){           	  

	   dome_show(obj1);

	}

	

}


 function getbyid(id){
	return document.getElementById(id);	
	}

function showUl(id,divid){	
		  getbyid(id).style.display="block";
			  if(""!=divid||null!=divid){
				  try{
					getbyid(divid).focus();
					}catch(e){}
			  }	  
}
		
function hidUl(id){	
      getbyid(id).style.display="none";	  
	}		
	
function senddata(obj,vid,id,type){
	   var cdate = jQuery(obj).html();
	   var months = '';
	   var years = '';
	   jQuery(vid).val(cdate);		 

	   if(type=='m'){		
        	   months = cdate;
		       years = jQuery('#e_year_val').val();
			   
			   var isrun = false;
			   if(!(years%100)){
						   if(!((years/100)%4)){
							   isrun = true;
							   }
				   
				   }else{
					   if(!(years%4)){
							isrun = true;
						   }
					   }
			   switch(months){
					case "Dece":
					case "Janu":
					case "Marc":
					case "May":
					case "July":
					case "Augu":
					case "Octo":			
					jQuery("#e_day_ul").html(jQuery(".31dayscontainer").html());
					break;
					case "Apri":
					case "June":	
					case "Sept":
					case "Nove":	
					jQuery("#e_day_ul").html(jQuery(".30dayscontainer").html());
					break;
					case "Febr":
						 if(isrun){							  
								jQuery("#e_day_ul").html(jQuery(".29dayscontainer").html());
							 }else{
								jQuery("#e_day_ul").html(jQuery(".28dayscontainer").html());
								
								 }						
						break;
		
					default:		
				   }
		   
		}
		if(type=='y'){
			   years = cdate;
		       months = jQuery('#e_month_val').val();					 
			   var isrun = false;
			   if(!(years%100)){
						   if(!((years/100)%4)){
							    isrun = true;
							   }
				   
				   }else{
					   if(!(years%4)){
							isrun = true;
						   }
					   }					
			   switch(months){
					case "Dece":
					case "Janu":
					case "Marc":
					case "May":
					case "July":
					case "Augu":
					case "Octo":			
					jQuery("#e_day_ul").html(jQuery(".31dayscontainer").html());
					break;
					case "Apri":
					case "June":	
					case "Sept":
					case "Nove":	
					jQuery("#e_day_ul").html(jQuery(".30dayscontainer").html());
					break;
					case "Febr":
						 if(isrun){
								jQuery("#e_day_ul").html(jQuery(".29dayscontainer").html());
							 }
							 else{
								jQuery("#e_day_ul").html(jQuery(".28dayscontainer").html());
								 }						
						break;
		
					default:		
				   }	

	 }
	
        hidUl(id);		
	}	
	
function senddata_simple(liobj,ulid,inputid){	
		 jQuery(inputid).val(jQuery(liobj).html());	 
		 hidUl(ulid);	
		 if(ulid=="cor_room_show_ul"){			
			window.location.href=jQuery(liobj).attr("rell")
		 }
	}	
function senddata_simple_events(liobj,ulid,inputid){
		 jQuery(inputid).val(jQuery(liobj).html());		
		 jQuery(inputid).removeClass();
		 jQuery(inputid).addClass(" evtinput_"+jQuery(liobj).attr("rel")+" ");
    	 jQuery("#catid").val(jQuery(liobj).attr("cartid"));
		 hidUl(ulid);	
}	
	

function addBookmark(title,url) {
      if (window.sidebar) {   window.sidebar.addPanel(title, url,"");  }
	     else if( document.all ) {

          window.external.AddFavorite( url, title);

               } else if( window.opera && window.print ) {
         return true;
}
}

var sessionii = 0;
function CoLeeSelect2_book_tickets(thisObj){   // the Select above the Navigator 
	 var thisinput = thisObj.getElementsByTagName("input");
	 var thisul = thisObj.getElementsByTagName("ul");
	 var thisli = thisul[0].getElementsByTagName("li"); 
	 
	 var selectval = null;
	 
	jQuery("#t0").val('');
	jQuery("#t1").val('');
	jQuery("#t2").val('');
	jQuery("#t3").val('');
	jQuery("#t4").val('');

	 
	 if(thisObj.className=="filtclasz"&&sessionii==0){	
		 jQuery(thisObj).css("top","4px");
		 jQuery(thisinput[0]).css("padding","7px");
	 	 jQuery(thisinput[0]).css("background-position","0 bottom");
		 jQuery(thisinput[0]).css("width","157px");
	     jQuery(thisul[0]).css("left","1px");
		 jQuery(thisul[0]).css("top","30px");	 
	 }

	 if(thisObj.id != "CoLeeSelect"){	  
				  thisObj.id = "CoLeeSelect";
				  thisObj.focus();
				  thisul[0].style.display = "block";		  
				  for(var i=0;i<thisli.length;i++){
						   thisli[i].onclick = function(){							   
									  if(thisObj.className=="filtclasz"){		   
											 jQuery(thisObj).css("top","6px");
											 jQuery(thisinput[0]).css("padding","5px 7px");
											 jQuery(thisinput[0]).css("background-position","0 top");
											 jQuery(thisinput[0]).css("width","153px");
											 jQuery(thisul[0]).css("left","-1px");
											 jQuery(thisul[0]).css("top","28px");	
											 sessionii++;
									   }								  
									if(this.innerText) selectval = this.innerText;
									if(this.textContent) selectval = this.textContent;
									thisinput[0].value = selectval;		
									
									if((jQuery(thisObj).attr("rel"))==1){
												selectval = selectval.match(/\d+/);	
												jQuery("#ticket_num").val(selectval);
												ticket_num_selected();
												//jQuery(".eventbooking_multickets").empty();
													//for(var i=0;i<selectval-1;i++){									
													//	var jqob = jQuery("#copytickets").clone().prependTo(".eventbooking_multickets");																							
													//	 jQuery(jqob).css("z-index",188-(selectval-i));													
													//	 var thisinputss = jQuery(jqob).children("div").children("input");
													//	 jQuery.each(thisinputss,function(j){
													//	     thisinputss[j].name ="r"+i+i;	
													//     });
												//  }
												
										}
										
									
							 if( thisinput[0].value.charAt(thisinput[0].value.length-1) == " ")
							 thisinput[0].value =  thisinput[0].value.substr(0,  thisinput[0].value.length-1);							   
					      }
			     }			  
			   
	  }else{
	     ObjBlur();
	  }  
	  thisObj.onblur = ObjBlur;
	  
	  function ObjBlur(){	  
		   if(thisObj.className=="filtclasz"&&sessionii==0){		   
											 jQuery(thisObj).css("top","6px");
											 jQuery(thisinput[0]).css("padding","5px 7px");
											 jQuery(thisinput[0]).css("background-position","0 top");
											 jQuery(thisinput[0]).css("width","153px");
											 jQuery(thisul[0]).css("left","-1px");
											 jQuery(thisul[0]).css("top","28px");	
											 sessionii++;
			}
		   sessionii = 0;
		   thisObj.id =  "";	   
		   thisul[0].style.display = "none";
		   thisObj.blur();	   
	   }
	 }

function CoLeeSelect2_book_zones(thisObj){   // the Select above the Navigator 
	 var thisinput = thisObj.getElementsByTagName("input");
	 var thisul = thisObj.getElementsByTagName("ul");
	 var thisli = thisul[0].getElementsByTagName("li"); 
	 
	 var selectval = null;
	 if(thisObj.className=="filtclasz"&&sessionii==0){	
		 jQuery(thisObj).css("top","4px");
		 jQuery(thisinput[0]).css("padding","7px");
	 	 jQuery(thisinput[0]).css("background-position","0 bottom");
		 jQuery(thisinput[0]).css("width","157px");
	     jQuery(thisul[0]).css("left","1px");
		 jQuery(thisul[0]).css("top","30px");	 
	 }

	 if(thisObj.id != "CoLeeSelect"){	  
				  thisObj.id = "CoLeeSelect";
				  thisObj.focus();
				  thisul[0].style.display = "block";		  
				  for(var i=0;i<thisli.length;i++){
						   thisli[i].onclick = function(){							   
									  if(thisObj.className=="filtclasz"){		   
											 jQuery(thisObj).css("top","6px");
											 jQuery(thisinput[0]).css("padding","5px 7px");
											 jQuery(thisinput[0]).css("background-position","0 top");
											 jQuery(thisinput[0]).css("width","153px");
											 jQuery(thisul[0]).css("left","-1px");
											 jQuery(thisul[0]).css("top","28px");	
											 sessionii++;
									   }								  
									if(this.innerText) selectval = this.innerText;
									if(this.textContent) selectval = this.textContent;
									thisinput[0].value = selectval;		
									
									if((jQuery(thisObj).attr("rel"))==2){											
											if(selectval.match(/(green)/)){
												   var strZdatas = "<li><span>FLAT FLOOR ZONE 1</span></li><li><span>FLAT FLOOR ZONE 2</span></li><li><span>FLAT FLOOR                                                         ZONE 3</span></li><li><span>FLAT FLOOR ZONE 4</span></li><li><span>FLAT FLOOR ZONE 5</span></li>";												
														jQuery(".eb_chooseseat ul").html(strZdatas);	
														/*if(jQuery("#leftseatradio:checked").val()!=null){
															 jQuery(".be_seatinfobg").css("background-position","0 -129px");
														}else{
															 jQuery(".be_noseat").css("background-position","0 -129px");	   
														}*/
											 }	
											 if(selectval.match(/(blue)/)){
	 											   var strZdatas = "<li><span>STALLS ZONE 6</span></li><li><span>STALLS ZONE 7</span></li><li><span>STALLS ZONE 8                                                                </span></li><li><span>STALLS ZONE 9</span></li><li><span>STALLS ZONE 10</span></li><li><span>STALLS ZONE 11</span></li><li><span>STALLS ZONE 12</span></li><li><span>STALLS ZONE 13</span></li><li><span>STALLS ZONE 14</span></li>";												
														jQuery(".eb_chooseseat ul").html(strZdatas);	
															/*if(jQuery("#leftseatradio:checked").val()!=null){
															 jQuery(".be_seatinfobg").css("background-position","0 0");
														}else{
															 jQuery(".be_noseat").css("background-position","0 0");	   
														}*/
											 }	
											 if(selectval.match(/(red)/)){
												   var strZdatas = "<li><span>BALCONY ZONE 15</span></li><li><span>BALCONY ZONE 16</span></li><li><span>BALCONY ZONE 17</span></li><li><span>BALCONY ZONE 18</span></li>";												
														jQuery(".eb_chooseseat ul").html(strZdatas);	
															/*if(jQuery("#leftseatradio:checked").val()!=null){
															 jQuery(".be_seatinfobg").css("background-position","0 -172px");
														}else{
															 jQuery(".be_noseat").css("background-position","0 -172px");	   
														}*/
											 }	
											  if(selectval.match(/(BEST)/)){
												   var strZdatas = "<li><span>FLAT FLOOR ZONE 1</span></li><li><span>FLAT FLOOR ZONE 2</span></li><li><span>FLAT FLOOR                                                         ZONE 3</span></li><li><span>FLAT FLOOR ZONE 4</span></li><li><span>FLAT FLOOR ZONE 5</span></li><li><span>STALLS ZONE 6</span></li><li><span>STALLS ZONE 7</span></li><li><span>STALLS ZONE 8                                                                </span></li><li><span>STALLS ZONE 9</span></li><li><span>STALLS ZONE 10</span></li><li><span>STALLS ZONE 11</span></li><li><span>STALLS ZONE 12</span></li><li><span>STALLS ZONE 13</span></li><li><span>STALLS ZONE 14</span></li><li><span>BALCONY ZONE 15</span></li><li><span>BALCONY ZONE 16</span></li><li><span>BALCONY ZONE 17</span></li><li><span>BALCONY ZONE 18</span></li>";											   
														jQuery(".eb_chooseseat ul").html(strZdatas);
															/*if(jQuery("#leftseatradio:checked").val()!=null){
															 jQuery(".be_seatinfobg").css("background-position","0 0");
														}else{
															 jQuery(".be_noseat").css("background-position","0 0");	   
														}*/
											 }
											  
											  jQuery("#ticket_best_zone").val(selectval);
												ticket_num_selected();
								     }
										
									
							 if( thisinput[0].value.charAt(thisinput[0].value.length-1) == " ")
							 thisinput[0].value =  thisinput[0].value.substr(0,  thisinput[0].value.length-1);							   
					      }
			     }			  
			   
	  }else{
	     ObjBlur();
	  }  
	  thisObj.onblur = ObjBlur;
	  
	  function ObjBlur(){	  
		   if(thisObj.className=="filtclasz"&&sessionii==0){		   
											 jQuery(thisObj).css("top","6px");
											 jQuery(thisinput[0]).css("padding","5px 7px");
											 jQuery(thisinput[0]).css("background-position","0 top");
											 jQuery(thisinput[0]).css("width","153px");
											 jQuery(thisul[0]).css("left","-1px");
											 jQuery(thisul[0]).css("top","28px");	
											 sessionii++;
			}
		   sessionii = 0;
		   thisObj.id =  "";	   
		   thisul[0].style.display = "none";
		   thisObj.blur();	   
	   }
	 }

var zoneSelectClass =
{
	'sobj':null,
	'id': 1,
   'rmdisable': function (obj){
					   if(obj.checked==true){   			
							   jQuery(obj).parent().parent().children(".be_seatinfobg").css("background-position","0 -86px");
							   jQuery(obj).parent().parent().children(".be_noseat").css("background-position","0 top");
						   if(jQuery("#zones-val").val().match(/(green)/)){
	 	                       jQuery(obj).parent().parent().children(".be_noseat").css("background-position","0 -129px");
							}
						   if(jQuery("#zones-val").val().match(/(red)/)){
	 	                       jQuery(obj).parent().parent().children(".be_noseat").css("background-position","0 -172px");
							}
						   jQuery(obj).parent().parent().children(".be_selected").children(".coverinput-trans-chooseseat").css("display","none");
						   jQuery(obj).parent().parent().children(".be_selected").children("div").children("input").css("background-position","0 bottom");
						     jQuery(obj).parent().parent().children(".be_selected").children(".eb_chooseseat").children(".showzone-place").css("background-position","0 bottom");
						   jQuery(obj).parent().parent().children(".be_selected").children("h3").css("color","#2c2c2c");	   
						   jQuery(obj).parent().parent().children(".be_selected").children("div").children("input").removeAttr("disabled");	 
						   zoneSelectClass.sobj =  obj;						       
						}	
	},
    'addisable':function (obj){
				   if(obj.checked==true){   
					   jQuery(obj).parent().parent().children(".be_seatinfobg").css("background-position","0 top");
					   if(jQuery("#zones-val").val().match(/(green)/)){
	 	                     jQuery(obj).parent().parent().children(".be_seatinfobg").css("background-position","0 -129px");
					   }
					   if(jQuery("#zones-val").val().match(/(red)/)){
 	                       jQuery(obj).parent().parent().children(".be_seatinfobg").css("background-position","0 -172px");
						}
					   jQuery(obj).parent().parent().children(".be_selected").children(".coverinput-trans-chooseseat").css("display","block");
					   jQuery(obj).parent().parent().children(".be_noseat").html("");
					   jQuery(obj).parent().parent().children(".be_noseat").css("background-position","0 -43px");
					    jQuery(obj).parent().parent().children(".be_selected").children(".eb_chooseseat").children(".showzone-place").css("background-position","0 0");
					   jQuery(obj).parent().parent().children(".be_selected").children("div").children("input").css("background-position","0 top");
					   jQuery(obj).parent().parent().children(".be_selected").children("h3").css("color","#868686");   
					   jQuery(obj).parent().parent().children(".be_selected").children("div").children("input").attr("disabled","disabled");
					       zoneSelectClass.sobj =  obj;						  
					}	
				},
    'be_showseat':function (obj,seattitle){			
	  if(obj.checked==true){			  
				
		  		var ticket_selected_num = jQuery("#ticket_selected_num").val();
				//alert('TICKET_SELECTED='+ticket_selected_num);
		  		if(jQuery("#selfchooseradio"+ticket_selected_num).attr("checked")){
			    	jQuery("#seatselected"+ticket_selected_num).val(seattitle);
					//alert('SEAT_TITLE='+seattitle);
		  			jQuery(".be_selfchosen"+ticket_selected_num).html(jQuery(obj).parent().children(".zseatinfo").html());	  
		  		}
			  jQuery(".zseatinfo").css("display","none");
			  jQuery(obj).parent().children(".zseatinfo").css("display","block");
			  
  	 		 
	  }else{
			  jQuery(obj).parent().children(".zseatinfo").css("display","none");
	  }
}
};

function CoLeeSelect2_selectzone(thisObj,numorder){   // the Select above the Navigator  
var thisinput = thisObj.getElementsByTagName("input");
var thisul = thisObj.getElementsByTagName("ul");
var thisli = thisul[0].getElementsByTagName("li"); 

if(thisObj.id != "CoLeeSelect"){
thisObj.id = "CoLeeSelect";
thisObj.focus();
thisul[0].style.display = "block";
for(var i=0;i<thisli.length;i++){
	thisli[i].onclick = function(){	       
                if(this.innerText) selectval = this.innerText;
				if(this.textContent) selectval = this.textContent;
				thisinput[0].value = selectval;			
				colorzonestr = "";		
				selecttype = selectval.substring(0,selectval.indexOf(' '));
				selectval = selectval.match(/\d+/);	
				if(selecttype=="FLAT"){
					colorzonestr = "<span style='color:#fff; font:bold 11px/27px Aral;'>FLAT FLOOR </span><span style='color:#aed683; font:bold 11px/27px Aral;'>ZONE "+selectval+"</span>";
				}else if(selecttype=="STALLS"){
					colorzonestr = "<span style='color:#fff; font:bold 11px Aral;'>STALLS </span><span style='color:#13abe0; font:bold 11px/27px Aral;'> ZONE "+selectval+"</span>";
				}else{
					colorzonestr = "<span style='color:#fff; font:bold 11px/27px Aral;'>BALCONY </span><span style='color:#ea6477; font:bold 11px/27px Aral;'>ZONE "+selectval+"</span>";
					}					
				jQuery(thisObj).children(".showzone-place").html(colorzonestr);					
				if( thisinput[0].value.charAt(thisinput[0].value.length-1) == " ") 
				thisinput[0].value =  thisinput[0].value.substr(0,  thisinput[0].value.length-1);		
				
				jQuery("#ticket_selected_num").val(numorder);
				//alert(numorder);
				var venue = jQuery("#event_venue").val();
					for(var i=0; i<=18;i++){
						if(selectval==i){
							//alert(venue);
							//alert(i);
							if(venue==2 && (i==1||i==2||i==3||i==7||i==8||i==9||i==11||i==12)){		
								jQuery(".bookingevent_step1_timg").css("width","1023px");
								   jQuery(".bookingevent_step1_bimg").css("width","1023px");							   
								   jQuery(".bookingevent_step1_timg .bemiddle").css("width","874px");
								   jQuery(".bookingevent_step1_bimg .bemiddle").css("width","874px");
								   jQuery(".bookingevent_m").css({"background-position":"right 0","padding-left":"35px","width":"988px"});
								   jQuery(".bookingevent_step1_content").css("width","970px");
								   jQuery(".bookingevent_sc_down_right").css("width","543px");
								   jQuery(".bookingevent_sc_down_left").css("padding-right","15px");
								   jQuery(".bookingevent_step1 .close_bt").css("right","-74px");											   
							}else if(venue==3 && (i==2||i==4||i==5||i==6||i==10||i==11||i==12||i==14||i==15)){		
								   jQuery(".bookingevent_step1_timg").css("width","1023px");
								   jQuery(".bookingevent_step1_bimg").css("width","1023px");							   
								   jQuery(".bookingevent_step1_timg .bemiddle").css("width","874px");
								   jQuery(".bookingevent_step1_bimg .bemiddle").css("width","874px");
								   jQuery(".bookingevent_m").css({"background-position":"right 0","padding-left":"35px","width":"988px"});
								   jQuery(".bookingevent_step1_content").css("width","970px");
								   jQuery(".bookingevent_sc_down_right").css("width","543px");
								   jQuery(".bookingevent_sc_down_left").css("padding-right","15px");
								   jQuery(".bookingevent_step1 .close_bt").css("right","-74px");								   
							}else if((selectval==16&&i==16)||(selectval==17&&i==17)){		
								   jQuery(".bookingevent_step1_timg").css("width","1023px");
								   jQuery(".bookingevent_step1_bimg").css("width","1023px");							   
								   jQuery(".bookingevent_step1_timg .bemiddle").css("width","874px");
								   jQuery(".bookingevent_step1_bimg .bemiddle").css("width","874px");
								   jQuery(".bookingevent_m").css({"background-position":"right 0","padding-left":"35px","width":"988px"});
								   jQuery(".bookingevent_step1_content").css("width","970px");
								   jQuery(".bookingevent_sc_down_right").css("width","533px");
								   jQuery(".bookingevent_sc_down_left").css("padding-right","18px");
								   jQuery(".bookingevent_step1 .close_bt").css("right","-74px");								   
							}else{
								     jQuery(".bookingevent_step1_timg").css("width","961px");
									 jQuery(".bookingevent_step1_bimg").css("width","961px");							   
									 jQuery(".bookingevent_step1_timg .bemiddle").css("width","812px");
									 jQuery(".bookingevent_step1_bimg .bemiddle").css("width","812px");
									 jQuery(".bookingevent_m").css({"background-position":"0 0","padding-left":"48px","width":"913px"});
									 jQuery(".bookingevent_step1_content").css("width","880px");
									 jQuery(".bookingevent_sc_down_right").css("width","442px");
									 jQuery(".bookingevent_sc_down_left").css("padding-right","20px");
									 jQuery(".bookingevent_step1 .close_bt").css("right","-3px");		
							}								   
						      jQuery("#zone_"+selectval).css("display","block");						
							  
						}else{
							  jQuery("#zone_"+i).css("display","none");
						}
					}
				
			}
	 }
}else{
ObjBlur();
}
thisObj.onblur = ObjBlur;
function ObjBlur(){
thisObj.id =  "";
thisul[0].style.display = "none";
thisObj.blur();
}
}

function popup_book(){
	dome_show('dome_sendtof_pop');
	ticket_num_selected();
}

function ticket_num_selected(){
	jQuery(".eventbooking_multickets").html('<img src="/skin/frontend/default/default/images/opc-ajax-loader.gif"/>');
	
	var ticket_num = jQuery("#ticket_num").val();
	var ticket_best_zone = jQuery("#ticket_best_zone").val();
	jQuery("#copytickets").empty();
	jQuery("#copytickets").removeAttr("class");
	jQuery("#hide").empty();
	jQuery.ajax({
		   type: "POST",
		   url: "/index.php/eventseats/post/tickets",
		   data: "event_id="+jQuery("#event_id").val()+"&ticket_num="+ticket_num+"&ticket_best_zone="+ticket_best_zone+"&event_date="+jQuery("input[name='event_date']:checked").val(),
		   success: function(msg){
			jQuery(".eventbooking_multickets").html(msg);
		   }
		 });
	
	jQuery.ajax({
	   type: "POST",
	   url: "/index.php/eventseats/post/getzoneforchoose",
	   data: "event_id="+jQuery("#event_id").val()+"&ticket_num="+ticket_num+"&ticket_best_zone="+ticket_best_zone+"&event_date="+jQuery("input[name='event_date']:checked").val(),
	   success: function(msg){
		jQuery("#bookingevent_zone_for_choose").html(msg);
	   }
	 });
	
	/*jQuery.ajax({
		   type: "POST",
		   url: "/index.php/eventseats/post/getpriceforchoose",
		   data: "event_id="+jQuery("#event_id").val()+"&ticket_num="+ticket_num+"&ticket_best_zone="+ticket_best_zone+"&event_date="+jQuery("input[name='event_date']:checked").val(),
		   success: function(msg){
			jQuery(".tprice").html(msg);
		   }
		 });*/
	
	
}

function updateVals(event_id, id, seatid)
{	
	jQuery("#t"+id).val(seatid);
	
	var t1 = jQuery("#t0").val();
	var t2 = jQuery("#t1").val();
	var t3 = jQuery("#t2").val();
	var t4 = jQuery("#t3").val();
	var t5 = jQuery("#t4").val();

	jQuery.ajax({
		   type: "POST",
		   url: "/index.php/eventseats/post/getseatprice",
		   data: "event_id="+event_id+"&t1="+t1+"&t2="+t2+"&t3="+t3+"&t4="+t4+"&t5"+t5,
		   success: function(msg){
			jQuery(".tprice").html(msg);
		   }
		 });
	
}

function unsetVal(val)
{
	jQuery(val).val('');
}
function confirm_book(){
	jQuery("#confirm_loading").show();
	
	var ticket_num = jQuery("#ticket_num").val();
	
	var confirm_para = "ticket_num="+ticket_num;
	confirm_para+="&event_id="+jQuery("#event_id").val();

	if(jQuery("input[name='event_date']:checked").val()==undefined){
		alert("No date selected yet.")
		return;
	}else{
		confirm_para+="&event_date="+jQuery("input[name='event_date']:checked").val();
	}
	
	
	var i=1;
	jQuery("input[name='seatselected']").each(function(){
		confirm_para+="&tickets[]="+jQuery(this).val();
		i++;
	});
	
	jQuery("input[name='tprices']").each(function(){
		confirm_para+="&prices[]="+jQuery(this).val();
		i++;
	});
	
	if(i==1){
		alert("No seat avaliable yet!");
		return;
	}
	
	confirm_para += "&coupon_code="+jQuery("#coupon_code").val();
	
	jQuery.ajax({
		   type: "POST",
		   url: "/index.php/eventseats/post/confirmtickets",
		   data: confirm_para,
		   success: function(msg){
				jQuery("#confirm_loading").hide();
				if(msg!=""){
					alert(msg);
				}else{
					popup_cart();
				}
		   }
		 });

}

function chose_seat(eventid, seatid, rowid)
{
	jQuery.ajax({
	   type: "POST",
	   url: "/index.php/eventseats/post/getseatprice",
	   data: "event_id="+eventid+"&seat_id="+seatid+"&row_id="+rowid,
	   success: function(msg){
		jQuery(".tprice").html(msg);
	   }
	 });
}
function popup_cart(){
	jQuery.ajax({
		   type: "POST",
		   url: "/index.php/eventseats/post/showticketslist",
		   data: "",
		   success: function(msg){
				jQuery("#tickets_list").html(msg);
		   }
		 });
	jQuery.ajax({
		   type: "POST",
		   url: "/index.php/eventseats/post/showticketssubtotal",
		   data: "",
		   success: function(msg){
				jQuery("#tickets_subtotal").html(msg);
		   }
		 });
	
	update_tickettotalprice();
	dome_hidden('dome_sendtof_pop');
	dome_show('dome_sendtof_pop2');
}

function update_tickettotalprice(){
	jQuery("#tickets_totalprice").html('<img src="/skin/frontend/default/default/images/opc-ajax-loader.gif"/>');
	
	
	var no_delivery=0;
	if(document.getElementById("no_delivery").checked){
		no_delivery=1;
		jQuery("#delivery_desc").html('Please Note: You have decided to collect your tickets from the box office ');
	}else{
		jQuery("#delivery_desc").html('Tick this box if you wish to collect your ticket(s) from the box office ');
	}
	
	jQuery.ajax({
		   type: "POST",
		   url: "/index.php/eventseats/post/showticketstotalprice",
		   data: "no_delivery="+no_delivery,
		   success: function(msg){
				jQuery("#tickets_totalprice").html(msg);
		   }
		 });
}

function cancel_cart(){
	jQuery.ajax({
		   type: "POST",
		   url: "/index.php/eventseats/post/canceltickets",
		   data: "",
		   success: function(msg){
				
		   }
		 });
	
	dome_hidden('dome_sendtof_pop2');
	jQuery("#tickets_list").html('<tr><td><img src="/skin/frontend/default/default/images/opc-ajax-loader.gif"/></td></tr>');
	
}

function cart_back(){
	cancel_cart();
	dome_show('dome_sendtof_pop');
}

function checkout_cart(){
	var no_delivery=0;
	if(document.getElementById("no_delivery").checked){
		no_delivery=1;
	}
	
	//window.location.href = "/index.php/checkout/cart/addtickets?no_delivery="+no_delivery;
	window.location.href = "/index.php/checkout/onepage";
}

function apply_coupon(){
	jQuery.ajax({
		   type: "POST",
		   url: "/index.php/eventseats/post/applycoupon",
		   data: "coupon_code="+jQuery("#coupon_code").val(),
		   success: function(msg){
				if(msg){alert(msg)};
		   }
		 });
	
}

function changeEventDateView(value){
	jQuery("input[name='event_date'][value='"+value+"']").attr("checked",true);
}

function view_main_seat_plan(){
	var selectval=0;
	jQuery(".showzone-place").html('');
	jQuery("#ticket_selected_num").val(0);
	var venue = jQuery("#event_venue").val();
		for(var i=0; i<=18;i++){
			if(selectval==i){
				//alert(venue);
				//alert(i);
				if(venue==2 && (i==1||i==2||i==3||i==7||i==8||i==9||i==11||i==12)){		
					jQuery(".bookingevent_step1_timg").css("width","1023px");
					   jQuery(".bookingevent_step1_bimg").css("width","1023px");							   
					   jQuery(".bookingevent_step1_timg .bemiddle").css("width","874px");
					   jQuery(".bookingevent_step1_bimg .bemiddle").css("width","874px");
					   jQuery(".bookingevent_m").css({"background-position":"right 0","padding-left":"35px","width":"988px"});
					   jQuery(".bookingevent_step1_content").css("width","970px");
					   jQuery(".bookingevent_sc_down_right").css("width","543px");
					   jQuery(".bookingevent_sc_down_left").css("padding-right","15px");
					   jQuery(".bookingevent_step1 .close_bt").css("right","-74px");											   
				}else if(venue==3 && (i==2||i==4||i==5||i==6||i==10||i==11||i==12||i==14||i==15)){		
					   jQuery(".bookingevent_step1_timg").css("width","1023px");
					   jQuery(".bookingevent_step1_bimg").css("width","1023px");							   
					   jQuery(".bookingevent_step1_timg .bemiddle").css("width","874px");
					   jQuery(".bookingevent_step1_bimg .bemiddle").css("width","874px");
					   jQuery(".bookingevent_m").css({"background-position":"right 0","padding-left":"35px","width":"988px"});
					   jQuery(".bookingevent_step1_content").css("width","970px");
					   jQuery(".bookingevent_sc_down_right").css("width","543px");
					   jQuery(".bookingevent_sc_down_left").css("padding-right","15px");
					   jQuery(".bookingevent_step1 .close_bt").css("right","-74px");								   
				}else if((selectval==16&&i==16)||(selectval==17&&i==17)){		
					   jQuery(".bookingevent_step1_timg").css("width","1023px");
					   jQuery(".bookingevent_step1_bimg").css("width","1023px");							   
					   jQuery(".bookingevent_step1_timg .bemiddle").css("width","874px");
					   jQuery(".bookingevent_step1_bimg .bemiddle").css("width","874px");
					   jQuery(".bookingevent_m").css({"background-position":"right 0","padding-left":"35px","width":"988px"});
					   jQuery(".bookingevent_step1_content").css("width","970px");
					   jQuery(".bookingevent_sc_down_right").css("width","533px");
					   jQuery(".bookingevent_sc_down_left").css("padding-right","18px");
					   jQuery(".bookingevent_step1 .close_bt").css("right","-74px");								   
				}else{
					     jQuery(".bookingevent_step1_timg").css("width","961px");
						 jQuery(".bookingevent_step1_bimg").css("width","961px");							   
						 jQuery(".bookingevent_step1_timg .bemiddle").css("width","812px");
						 jQuery(".bookingevent_step1_bimg .bemiddle").css("width","812px");
						 jQuery(".bookingevent_m").css({"background-position":"0 0","padding-left":"48px","width":"913px"});
						 jQuery(".bookingevent_step1_content").css("width","880px");
						 jQuery(".bookingevent_sc_down_right").css("width","442px");
						 jQuery(".bookingevent_sc_down_left").css("padding-right","20px");
						 jQuery(".bookingevent_step1 .close_bt").css("right","-3px");		
				}								   
			      jQuery("#zone_"+selectval).css("display","block");						
				  
			}else{
				  jQuery("#zone_"+i).css("display","none");
			}
		}
}
