var gmb_top = 0, gmb_move=0, nl_flag = 0; var hpt=0;

$(document).ready(function() {	

    $(".large-img img").mouseover( function() {
		//$(this).css({opacity: 0.7});
		$(this).css({folter: 'alpha(opacity = 40)',  opacity: 0.4});
		
	});
	
    $(".large-img img").mouseout( function() {
		//$(this).css({opacity: 1.0});
		$(this).css({folter: 'alpha(opacity = 100)', opacity: 1.0});		
	});	

	$('.large-img').click(function(){
		var obj 	= 	$(this);
		var img 	= 	obj.attr('img');
		var img_width	=	obj.attr('width');
		var img_height	=	obj.attr('height');		
		var title	=	obj.attr('head');				
		
		var screen_width = $(window).width();
		var left_pos = (screen_width-img_width)/2;
		
		var screen_height = $(window).height();					
		var top_pos_add = (screen_height-img_height)/2;		
		
		var enlarge = $(".enlarge");
		enlarge.css('height', (parseInt(img_height)+36)+'px');
		enlarge.css('width', img_width+'px');
		
		var top = $(window).scrollTop();
		$('.enlarge-ext').css('position', 'absolute')			
		enlarge.css("left", left_pos);
		enlarge.css("top", top+(top_pos_add<0 ? 0 : top_pos_add));
				
		$('.enlarge-img').css('height', img_height+'px');
		$('.enlarge-img').html('<img src="'+img+'" width="'+img_width+'" height="'+img_height+'" />')
		$('.enlarge-top-title').html(title);
		
		enlarge.show();
		enlarge.expose({loadSpeed: 10, color: "#333"});		
	});
	// click Esc will close the floating window 
	$(document).keypress(function(e) { 
	    if (e.keyCode  == 27) { 	    	
			$.mask.close();
			$('.enlarge').hide();
			$('.enlarge-img').html('');	    	
	    }  
	});
	
	$('.enlarge-top-close').click(function(){
		$.mask.close();
		var box_div = $(this).parent().parent();
		$(box_div).hide();
//		$('.enlarge-img').html('');	
	});
	
	
	// get stats for scroller
	$('.leda-header-scroll-banner').click(function(){
		click_stats('scroll', 'top-scroll-banner', location.href, 'scroll', '', 0);
	});
	
	$('.leda-2-3-gn-marq').show();
	
	$('.leda-home-link').click(function(){
		location = '/';
	})
	// side menu open
	$('.s-men-side-loc1 a').click(function(){
		if ($(this).attr('href')==undefined){
			var item_id = $(this).attr('id');
			$('.s-men-side-loc2, .s-men-side-loc2-ac, .s-men-side-loc2sc, .s-men-side-loc2sc-ac').remove();
			var container_div = $(this).parent().parent();			
			$(container_div).after(side_menu[item_id]);
		}
	});

	// tabs
	$('.s-men-top-tab').click(function(){
		var url = $('a', this).attr('href');
		location = url;
	})	
	// patch for games
	if ($('.s-men-top-tab-s').attr('games')=='on'){
		$('.s-men-top-tab-s').css('background', 'url(/_media/public/global/top_tab_games-active.gif) no-repeat;')
		$('.s-men-top-tab-s div').css('background', ' ');

	}
		
	$('.s-men-top-tab, .s-men-top-tab-g').hover(function(){
		if ($(this).attr('games')=='on'){
			$(this).attr('class', 's-men-top-tab-g-s');		
		}
		else{
			$(this).attr('class', 's-men-top-tab-s');		
		}
	},function(){
		if ($(this).attr('games')=='on'){
			$(this).attr('class', 's-men-top-tab-g');	
		}
		else{	
			$(this).attr('class', 's-men-top-tab');	
		}
	});	
		
	// news tabs
	$('.leda-news-ti-tab').hover(function(){
		$(this).css('background', '#FFEA5F');
		$('a', this).css('color', '#000');		
	},function(){
		$(this).css('background', '');
		$('a', this).css('color', '#fff');
	});		
	$('.leda-news-ti-tab').click(function(){
		var href = $('a', $(this)).attr('href');
		location = href;		
	})

	// only in hp tabs

	if ($('div[tab_type]').attr('tab_type')=='hp'){
		$('.leda-hp-tabs-da-box[active=on]').show();
		var tab_count = $('.leda-hp-tabs').attr('tab_count');	
		switch_auto_hp_tab(0, tab_count);
	}
	
	if ($('div[tab_type]').attr('tab_type')=='hp_sports'){
		$('.leda-hp-tabs-da-box[active=on]').show();
	}	

	// sports news tab
	$('.leda-news-tab-sp-dl dt').click(function(){
		location = $(this).attr('link');
	});
	
	$('.leda-news-tab-sp-dl').hover(function(){
		$('dd', $(this)).show();
	},function(){
		$('dd', $(this)).hide();
	});		
	
	$('.leda-news-tab-sp-dl dd div').click(function(){
		location = $(this).attr('link');
	});
	
	$('.leda-news-tab-sp-dl dd div').hover(function(){
		$(this).css({background: '#FFEEA5'})
	},function(){
		$(this).css({background: '#FFF'})
	});		
	
		
	// general tabs
	$('.glo-tab-div').hover(function(){
		$('div[side=middle]', $(this)).addClass('glo-tab-div-hover-m');
		$('div[side=left]', $(this)).addClass('glo-tab-div-hover-l');		
		$('div[side=right]', $(this)).addClass('glo-tab-div-hover-r');				
	},function(){
		$('div[side=middle]', $(this)).removeClass('glo-tab-div-hover-m');
		$('div[side=left]', $(this)).removeClass('glo-tab-div-hover-l');		
		$('div[side=right]', $(this)).removeClass('glo-tab-div-hover-r');				
	});		
	
	$('.glo-tab-div').click(function(){		
		if ($(this).attr('tab_link')){
			location = $(this).attr('tab_link');
		}
		else{
			$('.glo-tab-div').attr('active', 'off')
			$(this).attr('active', 'on');
			hpt = 1;	
			hp_tab_draw_sel($(this));
		}
	});		
				
	// lang drop down menu
	var lang_select = new Array, cur_lang_row = '';
	var li = 0, tmp_str;
	$('.leda-header-flags_box img').each(function(i){
		if ($(this).attr('act')=='on'){
			var src = ($(this).attr('code')=='en' ? '/_media/public/global/us-uk.jpg' : $(this).attr('src'));
			if ($(this).attr('code')!=lang_code)
				tmp_str = '<div class="leda-2-1-lang-1-uno" onclick="flag_row(this, -1)" onmouseover="flag_row(this, 1)" onmouseout="flag_row(this, 0)" code="'+$(this).attr('code')+'"><div class="leda-2-1-lang-1-fl"><img align="left" src="'+src+'" alt="'+$(this).attr('lang_name')+'" title="'+$(this).attr('lang_name')+'" hspace="0" /></div><div class="leda-2-1-lang-1-lb">'+$(this).attr('lang_name')+'</div></div>';
			else
				tmp_str = '';
			if ($(this).attr('code')==lang_code)
				cur_lang_row = '<div class="leda-2-1-lang-1-cur-uno"><div class="leda-2-1-lang-1-cur-fl"><img align="left" src="'+src+'" alt="'+$(this).attr('alt')+'" title="'+$(this).attr('alt')+'" hspace="0" /></div><div class="leda-2-1-lang-1-cur-lb">'+$(this).attr('lang_name')+'</div></div>';
			if (tmp_str)
				lang_select[li++] = tmp_str;			
		}
	})			
	$('.leda-2-1-lang dl').hover(function(){
		$('dd', this).css('display', 'block');		
		$('dt', this).addClass('on');
	},function(){
		$('dd', this).css('display', 'none')
		$('dt', this).removeClass('on');		
	});	
	
	$('.leda-2-1-lang dt').html(cur_lang_row);	
	$('.leda-2-1-lang dd').html(lang_select.join(' '));
	$('.leda-2-1-lang dt').css('display', 'block');

	// newsletter subscribsion
	$('#newsletter').focus(function(){
		if (nl_flag){
			nl_flag = 0;
			$(this).val('');
			$('.leda-2-1-2-msg').html(insert_email_lbl);
		}
	});
	
	$('#unsubs_btn').click(function(){
		email = jQuery.trim($('#newsletter').val());		
		if (email){
			if (!email.match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i)){
				$('.leda-2-1-2-msg').show();
				$('.leda-2-1-2-frm').css('margin-top', '40');
				$('.leda-2-1-2-msg').html(invalid_email_lbl);
				nl_flag = 1;
		    }
		    else{
		    	$.post((lang_code=="f"?"/"+lang_code:"")+"/_sys_app/ajax_unsubscribe/", { email: email },
  							function(data){
								var data_arr = data.split('###');
	     						$('.leda-2-1-2-msg').show();
								$('.leda-2-1-2-frm').css('margin-top', '40');
								$('.leda-2-1-2-msg').html(data_arr[1]);
								nl_flag = 1;
  							}
						);
		    }
		}
	});
	$('#subs_btn').click(function(){
		email = jQuery.trim($('#newsletter').val());
		if (email){
		
	    	var checkbox_arr = new Array, i=0;
	    	$('.leda-2-1-2-3 input:checked').each(function(){
	    		checkbox_arr[i++] = $(this).val();
	    	});
		
			if (!email.match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i)){
				$('.leda-2-1-2-msg').show();
				$('.leda-2-1-2-frm').css('margin-top', '40');
				$('.leda-2-1-2-msg').html(invalid_email_lbl);
				nl_flag = 1;
		    }
		    else if (checkbox_arr.length==0){
				$('.leda-2-1-2-msg').show();
				$('.leda-2-1-2-frm').css('margin-top', '40');
				$('.leda-2-1-2-msg').html(invalid_cat_lbl);
				nl_flag = 1;		    	
		    }
		    else{		    	
		    	var category = checkbox_arr.join("\t");		    
		    	$.post((lang_code=="f"?"/"+lang_code:"")+"/_sys_app/ajax_subscribe/", { email: email, category: category },
  							function(data){  					
  								var data_arr = data.split('###');
     							$('.leda-2-1-2-msg').show();
								$('.leda-2-1-2-frm').css('margin-top', '40');
								$('.leda-2-1-2-msg').html(data_arr[1]);
								if (data_arr[0]==1){									
									$('.leda-iframe').attr('src', 'http://'+www_base_domain+'/_sys_app/sync_icontact/&email='+jQuery.trim($('#newsletter').val()))
								}
								nl_flag = 1;
  							}
						);
		    }
		}
	});
	
	$('#newsletter').focus(function(){
		$('.leda-2-1-2-frm').css('margin-top', '47');
		$('.leda-2-1-2-msg').html();			
	});
	
	// gambling news
	if ($('.leda-2-3-gn-bo')){		
		gmb_move = 1;
		marq_gmb_news($.browser.msie);
	}			
	
	$('.leda-2-3-gn-bo-t2').hover(function(){
		gmb_move = 0;
	}, function(){
		gmb_move = 1;
		marq_gmb_news($.browser.msie);
	});
	
	// set click stats...
	var link = new String;
	var j = 0;	
		
	//var str = '';
	$('.leda-header-top-aff-banner img, .right-aff-banner img, .left-aff-banner img').each(function(){
		var l_onclick = $(this).attr('extlink');
		if (l_onclick)
			$(this).wrap('<a target="_blank" href="'+l_onclick+'"></a>');
		//str += l_onclick + "\n";
	});
	//alert(str);
	
	$('.s-art a, .leda-news-view-art a').each(function(){
			var url = '';
			if ($(this).attr('extlink')){
				$(this).attr('href', $(this).attr('extlink'));
				$(this).attr('target', '_blank');
				url = $(this).attr('extlink');
				$(this).attr('tmp_href', url);
			}
	});
	
	$('a').click(function(){
		var link = new String($(this).attr('href'));		

		if ((link && link.indexOf('http://')!=-1)){
		
			//arr['href'][j++] = link+"\n";
			ba_id = '';
			type = '';
			dont_redirect = 1;
			if ($(this).attr('target')=='_new')
				dont_redirect = 1;
			var theitem, cc_type='', cc_ba_id='';

			if ($(this).attr('cc_type')!=undefined)
				theitem = $(this);
			else if ($(this).parent().attr('cc_type')!=undefined)
				theitem = $(this).parent();
			else if ($(this).parent().parent().attr('cc_type')!=undefined)
				theitem = $(this).parent().parent();			
			
			if ($(theitem).attr('cc_type') && $(theitem).attr('cc_type')!=undefined)
				cc_type = $(theitem).attr('cc_type');
			if ($(theitem).attr('cc_ba_id') && $(theitem).attr('cc_ba_id')!=undefined)
				cc_ba_id = $(theitem).attr('cc_ba_id');	
								
			//alert(link +"\n"+ location.href +"\n"+ cc_type +"\n"+ cc_ba_id +"\n"+dont_redirect)
			if (cc_type)
				click_stats('href', link, location.href, cc_type, cc_ba_id, dont_redirect);
		}
	})
	j = 0;
	
	$('img, a').click(function(){
		var theitem, cc_type='', cc_ba_id='';
		if ($(this).attr('cc_type')!=undefined)
			theitem = $(this);
		else if ($(this).parent().attr('cc_type')!=undefined)
			theitem = $(this).parent();
		else if ($(this).parent().parent().attr('cc_type')!=undefined)
			theitem = $(this).parent().parent();			

		if ($(theitem).attr('cc_type') && $(theitem).attr('cc_type')!=undefined)
			cc_type = $(theitem).attr('cc_type');
		if ($(theitem).attr('cc_ba_id') && $(theitem).attr('cc_ba_id')!=undefined)
			cc_ba_id = $(theitem).attr('cc_ba_id');
		dont_redirect = 0;
		if ($(this).attr('tmp_href')){
			$(this).attr('href', $(this).attr('tmp_href'));
			new_link = $(this).attr('href');
			dont_redirect = 1		
		}		
		else{	
			var link = new String($(this).attr('onclick'));					
			for(var m=0, flag=1, new_link='', letter='', follow=0; m<link.length && flag; m++){
				letter = link.charAt(m);
				if (letter=="'"){
					switch(follow){
						case 0:
								follow = 1;							
							break;
						case 1:
								follow = 2;
								break;							
							break;
					}			
				}
				else if (follow==1){
					new_link += letter;			
				}
			}
		}
		if (new_link && cc_type){
			//arr['onclick'][j++] = new_link+"\n";
			ba_id = '';
			type = '';			
			click_stats('onclick', new_link, location.href, cc_type, cc_ba_id, dont_redirect);
		}
		
	})
	
	// content search btn
	$('#srch-btn').hover(function(){
		var img = $(this).attr('src');
		img = img.replace('go.', 'go_h.');
		$(this).attr('src', img);
	},function(){
		var img = $(this).attr('src');
		img = img.replace('go_h.', 'go.');
		$(this).attr('src', img);
	});
	
	
	//promotions search
	$('#pro-search, #pro-search-1').click(function(){
		var ids_add = '';
		if ($(this).attr('id')=='pro-search-1')
			ids_add = '-1';
		var result_arr = new Array();
		result_arr['room'] = $('#pro_srch_room'+ids_add).val();			
		result_arr['platform'] = $('#pro_srch_platform'+ids_add).val();		
		result_arr['usa_player'] = $('#pro_srch_usa_player'+ids_add).val();
		result_arr['client_version'] = $('#pro_srch_client_version'+ids_add).val();
		result_arr['date'] = $('#pro_srch_date'+ids_add).val();
		result_arr['star'] = $('#pro_srch_star'+ids_add).val();
		result_arr['bonus'] = $('#pro_srch_bonus'+ids_add).val();
		if	(result_arr['bonus']==0 && result_arr['room']==0 && result_arr['platform']==0 && result_arr['usa_player']==0 && (result_arr['date']==0 || result_arr['date']==-1)  && result_arr['star']==0){
			$('.leda-pro-srch-err').html('Please choose one of the options above.');
			$('.leda-pro-srch-err').slideToggle("slow");
			setTimeout('$(\'.leda-pro-srch-err\').slideToggle("slow")', 2000);
		}
		else{
			var tmp_arr = Array(), j=0;
			for(var i in result_arr){
				if (result_arr[i])
					tmp_arr[j++] = i+'='+result_arr[i];
			}
			if ($('.leda-pro-srch[id=who'+ids_add+'], .leda-pro-srch-ff[id=who'+ids_add+']').attr('action'))
				location = 'http://www.' + www_base_domain + $('.leda-pro-srch[id=who'+ids_add+'], .leda-pro-srch-ff[id=who'+ids_add+']').attr('action') + '?prosearch=on&' + tmp_arr.join('&');
			else
				location = 'http://www.' + www_base_domain + $('.leda-pro-srch[id=who'+ids_add+'], .leda-pro-srch-ff[id=who'+ids_add+']').attr('path') + '?prosearch=on&' + tmp_arr.join('&');
		}		
	})
	
	$('.leda-pro-back').click(function(){
		location = 'http://www.' + www_base_domain + $('.leda-pro-srch, .leda-pro-srch-ff').attr('path');
	});
	
	// 888 camp	
	var is_camp_888 = 0;
	is_camp_888 = $('.camp-888').attr('run');
	if (is_camp_888){
		$('.camp-888').css('width', (dcs_popup_banner_width+8)+'px');
		$('.camp-888').css('height', (dcs_popup_banner_height+23)+'px');		
		$('.camp-888-ff').css('width', (dcs_popup_banner_width+6)+'px');
		$('.camp-888-ff').css('height', (dcs_popup_banner_height+17)+'px');		

		$('.camp-888-1').css('width', (dcs_popup_banner_width)+'px');
		$('.camp-888-1').css('height', (dcs_popup_banner_height)+'px');		
		
		$('.camp-888-2').css('width', dcs_popup_banner_width);		
		
		var dim_arr = center_888();
		$('.camp-888, .camp-888-ff').css('margin-left', dim_arr[0]);
		$('.camp-888, .camp-888-ff').css('margin-top', dim_arr[1]);
		var goto = $('.camp-888-1 img').attr('goto');
		var type = $('.camp-888-1 img').attr('cc_type');
		$('.camp-888-1 img').wrap('<a target="_blank" href="'+goto+'"></a>');
		$('.camp-888-1 img').click(function(){
			click_stats('onclick', goto, location.href, type, '', 1);
			$('.camp-888, .camp-888-ff').fadeOut("slow");
		});
		$('.camp-888-2-1').click(function(){
			$('.camp-888, .camp-888-ff').fadeOut("slow");
		})	
		setTimeout('show_888_camp()', 2000);	
	}

	$('#com-name, #com-comment').focus(function(){
		$('.cl-news-com-err').html('');
		$('.cl-news-com-err').hide();
	});
	
	$('#new-comment-btn').click(function(){
		var com_name = $.trim($('#com-name').val());
		var com_comment = $.trim($('#com-comment').val());
		var com_nid = $('#com-nid').val();
		var com_code = $('#com-code').val();
		var main_folder = $(this).attr('main_folder');

		if (!com_name || !com_comment){
			$('.cl-news-com-msg, .cl-news-com-err').html('');
			$('.cl-news-com-msg, .cl-news-com-err').hide();
			$('.cl-news-com-err').show();
			$('.cl-news-com-err').html('Please, fill out name and comment.');		
			return;
		}
		else{
	    	$.post("/" + (main_folder), { ajax: 'on', name: com_name, comment: com_comment, nid: com_nid, code: com_code },
						function(data){
							$('#com-name').val('');
							$('#com-comment').val('');
							$('.cl-news-com-msg, .cl-news-com-err').hide();
							$('.cl-news-com-msg').show();
							$('.cl-news-com-msg').html(data);
						}
					);		
		}
				
	});	

	$('#com-comment').keyup(function(){
		var max = 500;
		var str = $(this).val();
		var total = str.length;
		total = parseInt(total);
		$('#con-limit').html(total?total:'0');
		if (total>max){
			str = str.substring(0, max);
			$(this).val(str);			
		}
	});
	$('#com-comment').keydown(function(){	
	});	
	
	// jp
	$('#jp-sel').change(function(){
		//location = $(this).val();		
		if ($(this).val())
			click_stats('jackpots', $(this).val(), location.href, 'jackpots', '', 0);
	});	
	
	// jackpots
	$('.leda-art-jp-1').hover(function(){
		$(this).css('background', '#eee');
	},function(){
		$(this).css('background', '#fff');		
	});
	
	
});

// 888 camp
function show_888_camp(){
	$('.camp-888, .camp-888-ff').slideDown("slow")
}
function center_888(){
	var win_w = $.browser.mozilla ? $(window).attr('innerWidth'): document.body.clientWidth;		
	var win_h = $.browser.mozilla ? $(window).attr('innerHeight'): document.body.clientHeight;		

	left_marg = top_marg = 0;
	if (win_w>dcs_popup_banner_width){		
		var left_marg = win_w-dcs_popup_banner_width;
		left_marg = Math.floor(left_marg/2);
	}
	if (win_h>dcs_popup_banner_height){		
		var top_marg = win_h-dcs_popup_banner_height;
		top_marg = Math.floor(top_marg/2);
	}	
	return Array(left_marg, top_marg);
}


function marq_gmb_news(is_ie){
	var buf = '', buf2 = '';
	$.each(gmb_news, function(key, val){
		buf2 += '<div class="leda-2-3-gn-bo">';
		buf2 += '<div class="leda-2-3-gn-bo-1"><a href="'+val['href']+'" cc_type="gmb-news">'+val['title']+'</a></div>';
		buf2 += '<div class="leda-2-3-gn-bo-2"><a href="'+val['href']+'" cc_type="gmb-news">'+val['abst']+'</a></div>';
		buf2 += '</div>';		
	})		
	buf += buf2 + buf2 + buf2 + buf2;
	if (!is_ie){				
		$('.leda-2-3-gn-marq').remove();
		$('.leda-2-3-gn-bo-t2').html(buf);		
		move_ff_marq();
	}
	else{
		$('.leda-2-3-gn-bo-t').remove();		
		$('.leda-2-3-gn-marq').html(buf);		
	}
}

function move_ff_marq(){
	gmb_top -= 2;
	$('.leda-2-3-gn-bo-t2').css('position', 'relative');
	$('.leda-2-3-gn-bo-t2').css('top', gmb_top);
	if (gmb_move)
		setTimeout('move_ff_marq()', 100);
}

function click_stats(type, go_url, cur_url, type, ba_id, dont_redirect){
	go_url += ' ';
	$.post("/_sys_app/classic_clicks/",
		{ target_url: go_url, current_url: cur_url, type: type, ba_id: ba_id},
		function(data){
			if (!dont_redirect)
		    	location = go_url;
	  	}
	);
}

function flag_row(me, what){
	switch(what){
		case -1:
				var loc;
				if ($(me).attr('code')=='en')
					loc = 'http://www.'+www_base_domain+'/';
				else
					loc = 'http://'+$(me).attr('code')+'.'+www_base_domain+'/';
				click_stats('href', loc, location.href, 'lang-sel', '', 0);	
			break;
		case 1:
				$(me).css('background', '#FFFF57');
				$('.leda-2-1-lang-1-lb', me).css('color', '#000');
			break;
		case 0:
				$(me).css('background', '#000');
				$('.leda-2-1-lang-1-lb', me).css('color', '#fff');				
			break;
	}
}

function search_the_site(){
	var query = $.trim($('#query2').val());
	if (query){
		location = "/search/?query="+query+"&search=1";
	}
	return false;
}	

function switch_auto_hp_tab(counter, tab_count){
	if (hpt==1)
		return;
	var tab_1 = $('.glo-tab-div[index=1]');
	var tab_2 = $('.glo-tab-div[index=2]');
	var tab_3 = $('.glo-tab-div[index=3]');	
	var tab_4 = $('.glo-tab-div[index=4]');	
	counter = parseInt(counter);
	var tab;
	switch(counter%tab_count){
		case 0:
				tab = tab_1;
			break;
		case 1:
				tab = tab_2;		
			break;
		case 2:
				tab = tab_3;		
			break;		 		 
		case 3:
				tab = tab_4;		
			break;		 		 			
	}
	hp_tab_draw_sel(tab);
	setTimeout('switch_auto_hp_tab('+(counter+1)+', '+tab_count+')', 5000);
}	

function hp_tab_draw_sel(cur){
	// remove sel class from all
	$('.glo-tab-div div[side=middle]').removeClass('glo-tab-div-sel-m');
	$('.glo-tab-div div[side=left]').removeClass('glo-tab-div-sel-l');
	$('.glo-tab-div div[side=right]').removeClass('glo-tab-div-sel-r');		
	// remove reg class from all
	$('.glo-tab-div div[side=middle]').removeClass('glo-tab-div-reg-m');
	$('.glo-tab-div div[side=left]').removeClass('glo-tab-div-reg-l');
	$('.glo-tab-div div[side=right]').removeClass('glo-tab-div-reg-r');				
	// remove hover class from all
	$('.glo-tab-div div[side=middle]').removeClass('glo-tab-div-hover-m');
	$('.glo-tab-div div[side=left]').removeClass('glo-tab-div-hover-l');
	$('.glo-tab-div div[side=right]').removeClass('glo-tab-div-hover-r');						
	// add reg class for all
	$('.glo-tab-div div[side=middle]').addClass('glo-tab-div-reg-m');
	$('.glo-tab-div div[side=left]').addClass('glo-tab-div-reg-l');		
	$('.glo-tab-div div[side=right]').addClass('glo-tab-div-reg-r');				
	
	// now deal with the select one
	$('div[side=middle]', $(cur)).removeClass('glo-tab-div-reg-m');
	$('div[side=left]', $(cur)).removeClass('glo-tab-div-reg-l');
	$('div[side=right]', $(cur)).removeClass('glo-tab-div-reg-r');		

	$('div[side=middle]', $(cur)).addClass('glo-tab-div-sel-m');
	$('div[side=left]', $(cur)).addClass('glo-tab-div-sel-l');
	$('div[side=right]', $(cur)).addClass('glo-tab-div-sel-r');

	// show the selected tab content	
	$('.leda-hp-tabs-da-box').hide();
	$('.leda-hp-tabs-da-box[who='+$(cur).attr('who')+']').show();
	
}