
jQuery(function($){
	$(document).ready(function() {load_category_content()});
});
	

function doClear(theText) {
     if (theText.value == theText.defaultValue) {
         theText.value = ""
     }
 }
 function weatherCountry(btn) {
     if (btn.value == "UK") {
         document.getElementById("searchform_ireland").style.visibility = "hidden"; 
         document.getElementById("searchform_uk").style.visibility = "visible"; 
     }
     if (btn.value == "IRELAND") {
         document.getElementById("searchform_uk").style.visibility = "hidden"; 
         document.getElementById("searchform_ireland").style.visibility = "visible"; 
     }
 }





var swfid = 0;

function make_visible(block_id){
				jQuery(function($){
					$('#second-block-1,#second-block-2').css({"display":"block"});
					if (block_id==1){
						$('#second-block-1').css({"opacity":"1"});
						$('#second-block-2').css({"opacity":"0"});
						$('#second-block-1').fadeTo(1500,0);
						$('#second-block-2').fadeTo(1500,1,start_fade_2);
					}else{
						$('#second-block-1').css({"opacity":"0"});
						$('#second-block-2').css({"opacity":"1"});
						$('#second-block-2').fadeTo(1500,0);
						$('#second-block-1').fadeTo(1500,1,start_fade_1);
					}
				}
				)
}

function start_fade_1(){
						jQuery(function($){
							$('#second-block-2').css({"display":"none"});
							setTimeout( "make_visible(1)", 5000 ); 
							//$('#second-block-1').css({"display":"block","opacity":"1"});
						}
						);
						}
						
						function start_fade_2(){
						jQuery(function($){
							$('#second-block-1').css({"display":"none"});
							setTimeout ( "make_visible(2)", 5000 ); 
							//$('#second-block-2').css({"display":"block","opacity":"0"});
						
						}
						);
						}

function mark_all_parent_categories(){
	/*var main_ul = document.getElementById("left-menu-cats");
	var par_element = document.getElementsByClassName("current-cat-parent")[0];	
	if (par_element){
		var parent = par_element.parentNode.parentNode;
		if (parent.tagName !='ul') parent.className = 'current-cat-parent';
	}*/
}

function del_li_dots(){
	if (document.getElementById("left-menu-cats")){
		var elements = document.getElementById("left-menu-cats").getElementsByTagName('li');	
	}
	var $ = jQuery;
	if (elements){
	for(var i=0;i<elements.length;i++){
		if(elements[i].getElementsByTagName('ul').length !=0){
			var cur_ul = elements[i].getElementsByTagName('ul')[0];
			if ($(cur_ul).css("display")!="none"){
				elements[i].style.background = "none";
			}
		}
	}
	}
}

function insertSWF(url, width, height, id){
	if(!id){
		id = (swfid+1);
	}
	return document.write(''+
						'<object type="application/x-shockwave-flash"  data="'+url+'" width="'+width+'" height="'+height+'" id="swf-'+id+'" align="middle">'+
						'	<param name="allowScriptAccess" value="sameDomain" />'+
						'	<param name="allowFullScreen" value="false" />'+
						'	<param name="movie" value="'+url+'" />'+
						'	<param name="quality" value="high" />'+
						'	<param name="bgcolor" value="#ffffff" />'+
						'	<param name="wmode" value="transparent" />'+
						'</object>');
}


function more_category_content(id){
					var $ = jQuery;
					var add = (id==null)?'':('-'+id);
					var height_plus = (id==null)?40:0;
							//$('#js-animate-container').css({'height':$('#js-category-content').height()+'px', 'overflow':'hidden'});
							$('#js-category-content-small'+add).css({'position':'absolute', 'overflow':'hidden','left':'-1000px'});
							$('#js-category-content-big'+add).css({'position':'static', 'overflow':'visible','left':'0px'});
							$('#js-animate-container'+add).animate({'height':$('#js-category-content-big'+add).height()+height_plus}, 1000);
}


function get_small_content(){
	var real_html = jQuery('#real-category-content').get(0).innerHTML;
	//var real_html = real_content.html();
	//var real_html = jQuery('#real-category-content').children('*').;
	return real_html.slice(0, real_html.indexOf("<!--more-->"));
}
					
function less_category_content(id){
				var $ = jQuery;
				//$('#js-animate-container').css({'height':$('#js-category-content').height()+'px', 'overflow':'hidden'});
				var add = (id==null)?'':('-'+id);
				var height_plus = (id==null)?40:0;
				$('#js-category-content-big'+add).css({'position':'absolute', 'overflow':'hidden','left':'-1000px'});
				$('#js-category-content-small'+add).css({'position':'static', 'overflow':'visible','left':'0px'});
				$('#js-animate-container'+add).animate({'height':$('#js-category-content-small'+add).height()+height_plus}, 1000);
	}
					

function load_category_content(ids){
		var $ = jQuery;
		//var add = (id==null)?'':('-'+id);
		if (ids==null){
			$('#js-category-content-big').css({'position':'absolute', 'overflow':'hidden','left':'-1000px'});
		}
		else {
			for (var i=0; i<ids.length; i++){
				var add = '-'+ids[i];
				$('#js-category-content-big'+add).css({'position':'absolute', 'overflow':'hidden','left':'-1000px' }); //'position':'absolute', 'overflow':'hidden','top':'-1000px' 'absolute', 'overflow':'hidden','visibility':'hidden','margin-right':'-2000px'
			}
		}
				
}





/*
							var container	= $('#js-category-content');
							var _height = 256;
							
							
							var mex_height	= $('div.category-description div.entry').height();
							for(var i = 0; i<real_content.length;i++){
								
								element = real_content[i];
								container.append(element);
								if(container.height() > _height){
									var new_element = $(element).clone(true);
									var content = $(element).text();
									var content_arr = content.split(' ');
									
									
									$(element).remove();
									
									$(new_element).empty();
									
									container.append(new_element);
									
									var newcontent = new Array();
									
									var j = 0;
									
									
									while(true){
										if(container.height() > _height || typeof(content_arr[j]) == 'undefined'){
											if(container.height() > _height){
												var mustaddmore = true;
											}else{
												if(real_content.length > i){
													var mustaddmore = true;
												}else{
													var mustaddmore = false;
												}
											}
											newcontent.splice(newcontent.length-2);
											
											if(newcontent.length)
												$(new_element).empty().text(newcontent.join(' '));
											else
												$(new_element).remove();
											
											if(mustaddmore){
												
												$('#js-category-content > *:last-child').append(' [...]');
												container.append('<p class="more"><a href="#more" onclick="more_category_content(); return false;">Read more</a></p>');
											}
											break;
										}
										$(new_element).append(content_arr[j]+' ');
										newcontent[j] = content_arr[j];
										j++
									}
									
									break;
								}
							}
							var min_height = $('#js-category-content > img.thumbnail').height() || 0;
							container.parents('#js-animate-container').css({'height':(container.height() > min_height ? (container.height()+10) : min_height+10), 'overflow':'hidden'});
						*/