function switchContest(num){
		
		$('t1').removeClassName('sel');
		$('t2').removeClassName('sel');
		$('t4').removeClassName('sel');
		
		$('contest_t1').hide();
		$('contest_t2').hide();
		$('contest_t4').hide();
		
		$('t' + num).addClassName('sel');
		$('contest_t' + num).show();
		
		return false;
}
function position_popup(num){
	
		var cntr_hgt = $('marketing_container').getStyle('height');
		cntr_hgt = cntr_hgt.replace("px","");
		cntr_hgt = parseInt(cntr_hgt);
		$('fade_layer').setStyle({ height:cntr_hgt+'px' });
	
		$('fade_layer').show();
		move_popup();
		$('popup_layer').show();
		$('card').setAttribute('src', '/img/home_pro/card_preview_' + num + '.jpg');
		return false;
}
function move_popup(){
		var coords = $('marketing_container').cumulativeScrollOffset();
		var newtop = coords.top + 100 + 'px';
		var newwidth = (138) + 'px';
		$('popup_layer').setStyle({ top:newtop, left:newwidth });
}
function hideLayer(){
		$('fade_layer').hide();
		$('popup_layer').hide();
		$('card').setAttribute('src', '/img/spacer.gif');
		return false;
}

function showIntense()
{
	document.getElementById('intenseshine').style.display = '';
	document.getElementById('chictwists').style.display = 'none';
	document.getElementById('modernknots').style.display = 'none';
	document.getElementById('ponytailperfection').style.display = 'none';
	
	document.getElementById('styleimg').innerHTML = '<img src="/img/home_pro/up_and_away_image.jpg"/>';
	//document.getElementById('styleproduct').innerHTML = '<img src="/img/home_pro/up_and_away_product.gif" usemap="#up_and_away_map"/><map name="up_and_away_map"><area shape="rect" coords="101,43,211,77" href="../products/product.aspx?catcode=AXE_HAIR^F1_Styling^F2_MediumControl&topcat=F2_MediumControl&prdcode=133" alt="thickening lotion 06 body builder" /><area shape="rect" coords="98,76,197,112" href="../products/product.aspx?catcode=AXE_HAIR^F1_Styling^F2_MaximumControl&topcat=F2_MaximumControl&prdcode=129" alt="vinyl glam 02 mega shine spray" /></map>';
	
	document.getElementById('chic').innerHTML = '<a onclick="showChic()"></a>';
	document.getElementById('pony').innerHTML = '<a onclick="showPony()"></a>';
	document.getElementById('modern').innerHTML = '<a onclick="showModern()"></a>';
	document.getElementById('intense').innerHTML = '<div class="selected"></div>';
}
function showPony()
{
	document.getElementById('intenseshine').style.display = 'none';
	document.getElementById('chictwists').style.display = 'none';
	document.getElementById('modernknots').style.display = 'none';
	document.getElementById('ponytailperfection').style.display = '';
	
	document.getElementById('styleimg').innerHTML = '<img src="/img/home_pro/instant_update_image.jpg"/>';
	//document.getElementById('styleproduct').innerHTML = '<a href="../products/product.aspx?catcode=AXE_HAIR^F1_Styling^F2_HS&topcat=F2_HS&prdcode=137"><img src="/img/home_pro/instant_update_product.gif"/></a>';
	
	document.getElementById('chic').innerHTML = '<a onclick="showChic()"></a>';
	document.getElementById('pony').innerHTML = '<div class="selected"></div>';
	document.getElementById('modern').innerHTML = '<a onclick="showModern()"></a>';
	document.getElementById('intense').innerHTML = '<a onclick="showIntense()"></a>';
}
function showModern()
{
	document.getElementById('intenseshine').style.display = 'none';
	document.getElementById('chictwists').style.display = 'none';
	document.getElementById('modernknots').style.display = '';
	document.getElementById('ponytailperfection').style.display = 'none';
	
	document.getElementById('styleimg').innerHTML = '<img src="/img/home_pro/middle_ground_image.jpg"/>';
	//document.getElementById('styleproduct').innerHTML = '<img src="/img/home_pro/middle_ground_product.gif" usemap="#middle_ground_map"/><map name="middle_ground_map"><area shape="rect" coords="80,41,185,78" href="../products/product.aspx?catcode=AXE_HAIR^F1_Styling^F2_HS&topcat=F2_HS&prdcode=282" alt="iron silk 07 ultra straightening spray" /><area shape="rect" coords="80,75,178,116" href="../products/product.aspx?catcode=AXE_HAIR^F1_Styling^F2_MaximumControl&topcat=F2_MaximumControl&prdcode=129" alt="vinyl glam 02 mega shine spray" /><area shape="rect" coords="80,115,199,145" href="../products/product.aspx?catcode=AXE_HAIR^F1_Styling^F2_HSpray&topcat=F2_HSpray&prdcode=191" alt="quick dry 18 isntant finishing spray" /></map>';
	
	document.getElementById('chic').innerHTML = '<a onclick="showChic()"></a>';
	document.getElementById('pony').innerHTML = '<a onclick="showPony()"></a>';
	document.getElementById('modern').innerHTML = '<div class="selected"></div>';
	document.getElementById('intense').innerHTML = '<a onclick="showIntense()"></a>';
}
function showChic()
{
	document.getElementById('intenseshine').style.display = 'none';
	document.getElementById('chictwists').style.display = '';
	document.getElementById('modernknots').style.display = 'none';
	document.getElementById('ponytailperfection').style.display = 'none';
	
	document.getElementById('styleimg').innerHTML = '<img src="/img/home_pro/perfectly_undone_image.jpg"/>';
	//document.getElementById('styleproduct').innerHTML = '<a href="../products/product.aspx?catcode=AXE_HAIR^F1_Styling^F2_HS&topcat=F2_HS&prdcode=137"><img src="/img/home_pro/perfectly_undone_product.gif"/></a>';
	
	document.getElementById('chic').innerHTML = '<div class="selected"></div>';
	document.getElementById('pony').innerHTML = '<a onclick="showPony()"></a>';
	document.getElementById('modern').innerHTML = '<a onclick="showModern()"></a>';
	document.getElementById('intense').innerHTML = '<a onclick="showIntense()"></a>';
}

var loadingAjax = false;

function checkAjax(e)
{
    if(!loadingAjax){
		Event.stop(e);
        loadingAjax = true;
		var userCode = $('_ctl0__ctl0_brandlayout0__ctl0_mainbody0__ctl0__ctl0__ctl0__ctl0__ctl0_login').value;
        var url = "clientsalon.aspx?storecode="+userCode;
		new Ajax.Request(url,{method: 'get',
         	   onSuccess: function(result)
            	{
                var response = result.responseText || "no response text";
				var url2 = "UpdateExtProp.aspx?propertyname=ProProfiles&propertyvalue="+response;
				new Ajax.Request(url2,{method: 'get',
				   onSuccess: function(resultProfile)
						{
							$('error_code').hide();
							var response2 = resultProfile.responseText || "no response text";
							//alert(response2);
							loadingAjax = false;
							location.href='member.aspx';
						},
						onFailure: function()
						{
							//alert("Code client invalide");
							$('error_code').show();
							loadingAjax = false;
						}
					});
            	},
            onFailure: function()
            {
				$('error_code').show();
                //alert("Code client invalide");
                loadingAjax = false;
            }
        });
	}
}
function initialize()
{
$('error_code').hide();
if ($('__aspnetForm') != null){Event.observe('__aspnetForm', 'submit', checkAjax, false)};
}
Event.observe(window, 'load', initialize, false);