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';}*/

	$dome("swim-date-year-month-value").value = this.getAttribute("riqi");

	 if(this.getAttribute("riqi")!=null || this.getAttribute("riqiday")!=null ){

		 

		// window.location.href="?date="+$dome("swim-date-year-month").getAttribute("riqi")+"-"+$dome("swim-date-day").value;

	 }

    }

   }

  }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";		

}



function dome_pop_up1(w,h,id,title,eventlink){	

	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";	

    

    $dome("eventitle").value=title;

    $dome("eventlink").value=eventlink;

}





 

 /************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"));
	 	 jQuery("#eventlistrelid").val(jQuery(liobj).attr("rel"));//added for result page

		 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;

}

}




