var code1, code2;

function order_unlock1(){
$("#one_solution").html("<input type=\"radio\" name=\"c3\" checked=\"true\" value=\""+code1+"\">");
order_unlock();
}

function order_unlock2(){
$("#one_solution").html("<input type=\"radio\" name=\"c3\" checked=\"true\" value=\""+code2+"\">");
order_unlock();
}

(function($){
$.fn.Attention = function() {		
		this.show();	
		this.animate({ backgroundColor: "#eef2f6"}, 500).
/*					animate({ backgroundColor: "#8ff064"}, 500).
					animate({ backgroundColor: "#eef2f6"}, 500).
					animate({ backgroundColor: "#8ff064"}, 500).
					animate({ backgroundColor: "#eef2f6"}, 500).
					animate({ backgroundColor: "#8ff064"}, 500).
					animate({ backgroundColor: "#eef2f6"}, 500).
					animate({ backgroundColor: "#8ff064"}, 500).
					animate({ backgroundColor: "#eef2f6"}, 500).
					animate({ backgroundColor: "#8ff064"}, 500).
					animate({ backgroundColor: "#eef2f6"}, 500). */
					animate({ backgroundColor: "#8ff064"}, 500).
					animate({ backgroundColor: "#eef2f6"}, 500).
					animate({ backgroundColor: "#8ff064"}, 500).
					animate({ backgroundColor: "#eef2f6"}, 500).		
					animate({ backgroundColor: "#8ff064"}, 500).
					animate({ backgroundColor: "#eef2f6"}, 500).
					animate({ backgroundColor: "#8ff064"}, 500).
					animate({ backgroundColor: "#eef2f6"}, 500).
					animate({ backgroundColor: "#8ff064"}, 500);		
	};

$.fn.BrAtt = function(){
			this.stop(true, true);			
			this.css("background", "transparent");
	};
	
})(jQuery);	

function step2_stop(){
	$("#step21").BrAtt();
	$("#step22").BrAtt();
	$("#step23").BrAtt();
}

function step1_stop(){
	$("#step11").BrAtt();
	$("#step12").BrAtt();
}

function load_page(url){		
	window.location=url;	
}

$(document).ready(function(){
	var cur_aff_type;
	/*********  STOP flashing *********/
	$("select#sel_brand").click(function(){$("#step11").BrAtt();});
	$("select#sel_model").click(function(){$("#step12").BrAtt();});
	$("select#country").click(function(){$("#step22").BrAtt();});
	$("select#network").click(function(){$("#step23").BrAtt();});
	
	/*********  FUNCTION for MAIN_PAGE *********/
	//if user select brand
	$("select#quick_brand").change(function(){
		var brand = $("select#quick_brand").val();		
		$("#quick_model").attr("disabled", "true");
		$("#qm_outer").addClass("inactive");
		$("select#sel_model").html("");
		if(brand=='- Please select -'); //Clear list of models		
		else
		{
			//Display list of models according with brand			
			$.getJSON("/order_product_ajax.php",
			{model: brand,  action: "get_models"},
			function(returnVal){			
			 	var options = "";			 	
				options += "<option value='' style='color:#999' disabled selected>- Please select -</option>";
				options += "<option  style='background: #8ff064; color:#000000' disabled>TOP "+returnVal['TOP']+" MOST POPULAR...</option>";
				for(i = 0; i < returnVal['MODELS'].length; i++){
					if(i==returnVal['TOP'])options += "<option  style='background: #8ff064; color:#000000' disabled>ALL MODELS...</option>";
					options += "<option value='"+returnVal['MODELS'][i]['MODEL']+"'>"+returnVal['MODELS'][i]['MODEL']+"</option>";
				}
				$("select#quick_model").html(options);
				$("#quick_model").removeAttr("disabled");
				$("#qm_outer").removeClass("inactive");	
				$("#qm_outer > a").attr("href", returnVal['LINK']);			
				$("#quick_unlock").attr("href", returnVal['LINK']);	
				$("#quick_unlock").attr("onclick", "load_page('"+returnVal["LINK"]+"')");									
			});
		}
	});
	//if user select model
	$("select#quick_model").change(function(){
		var brand = $("select#quick_brand").val();
		var model = $("select#quick_model").val();
		
			$.getJSON("/order_product_ajax.php",
			{model: model,
			manu: brand,
			action: "get_model_image"},
			function(returnVal)
			{				
				$("#quick_unlock").attr("href", returnVal["MODEL_LINK_ALL"]);					
				$("#quick_unlock").attr("onclick", "load_page('"+returnVal["MODEL_LINK_ALL"]+"')");	
			});	
			
	});	
	//Affiliates
	$("select#report").change(function(){
		var report_type = $("select#report").val();
		if(report_type=='month'){
			$("#month_select").show();
			$("#what_select").text("Select Month:");
			}
		else{
			$("#month_select").hide();
			$("#what_select").text("Select Year:");
		}
	});


	$("select#ban_filter").change(function(){
		var filter_type = $("select#ban_filter").val();
		if(filter_type=='no-filter'){
			$("div.ban").show();
		}else{
			$("div.ban").hide();
			$("div."+filter_type).show();
		}		
	});	
	
	$("input[name='f_register[TYPE]']").click(function(){		
		choose_type = $(this).val();
		if(choose_type==cur_aff_type)return false;
		else cur_aff_type=choose_type;	
		if(cur_aff_type=='Business') $("#b_params").slideDown();
		else $("#b_params").slideUp();
	});
	
	$("select[name='f_register[P_METHOD]']").change(function(){		
		var method = $("select[name='f_register[P_METHOD]']").val();
		if(method=='CHEQUE'){
			$("#method_warning").show();
			$("select[name='f_register[P_CUR]']").val('GBP');
			$("select[name='f_register[P_CUR]']").attr('disabled','true');
			$("#aff_email").hide();
		}else{
			$("#method_warning").hide();
			$("select[name='f_register[P_CUR]']").removeAttr("disabled");
			$("#aff_email").show();
		}
		
	});
	
	

});
/*****************/

function show_solution(returnVal){
					$("#step3_inactive").hide();
					$("#step3_form").css("background-color", "#fff");
					if(returnVal.length != null){
						$("#quote1").animate({opacity: 'show'}, "slow", "linear");						
						$("#delivery_time1").text(returnVal[0]["DELIVERY_DESCRIPTION"]);						

						if(returnVal[0]["MBG"]==1){
							$("#mbg1").removeClass('cross');
							$("#mbg1").addClass('tick');
						}
						else{
							$("#mbg1").removeClass('tick');
							$("#mbg1").addClass('cross');						
						}
						if(returnVal[0]["WEEKEND_DELIVERY"]==1){
							$("#wed1").removeClass('cross');
							$("#wed1").addClass('tick');
						}
						else{
							$("#wed1").removeClass('tick');
							$("#wed1").addClass('cross');						
						}		
						if(returnVal[0]["DESCRIPTION"]!='' && returnVal[0]["DESCRIPTION"]!=null){
							$("#desc1_outer").show();
							$("#desc1").html(returnVal[0]["DESCRIPTION"]);
						}
						else $("#desc1_outer").hide();
						
						$("#unlock_price1_gbp").html(returnVal[0]["PRICE_GBP_NOW_CURRENCY"]);
						$("#unlock_price1_usd").html(returnVal[0]["PRICE_USD_NOW_CURRENCY"]);
						$("#unlock_price1_eur").html(returnVal[0]["PRICE_EUR_NOW_CURRENCY"]);
						$("#unlock_price1_cad").html(returnVal[0]["PRICE_CAD_NOW_CURRENCY"]);
						$("#unlock_price1_nzd").html(returnVal[0]["PRICE_NZD_NOW_CURRENCY"]);
						$("#unlock_price1_aud").html(returnVal[0]["PRICE_AUD_NOW_CURRENCY"]);						
						code1=returnVal[0]["PRODUCT_ID"];
						if(returnVal.length>1){
							$("#quote2").animate({opacity: 'show'}, "slow", "linear");
							$("#delivery_time2").text(returnVal[1]["DELIVERY_DESCRIPTION"]);												
							$("#unlock_price2_gbp").html(returnVal[1]["PRICE_GBP_NOW_CURRENCY"]);
							$("#unlock_price2_usd").html(returnVal[1]["PRICE_USD_NOW_CURRENCY"]);
							$("#unlock_price2_eur").html(returnVal[1]["PRICE_EUR_NOW_CURRENCY"]);
							$("#unlock_price2_cad").html(returnVal[1]["PRICE_CAD_NOW_CURRENCY"]);
							$("#unlock_price2_nzd").html(returnVal[1]["PRICE_NZD_NOW_CURRENCY"]);
							$("#unlock_price2_aud").html(returnVal[1]["PRICE_AUD_NOW_CURRENCY"]);	
							code2=returnVal[1]["PRODUCT_ID"];					
						}
					}
					else{
						$("#quote3").animate({opacity: 'show'}, "slow", "linear");
					}	
}

function prepare_manu(manu){
			$("#model_image").html("");			
			//Display list of models according with brand								
			$.getJSON("/order_product_ajax.php",
			{model: manu,  action: "get_models"},
			function(returnVal){			
			 	var options = "";				
				options += "<option value='- Please select -' style='color:#999'>- Please select -</option>";
				options += "<option  style='background: #8ff064; color:#000000' disabled>TOP "+returnVal['TOP']+" MOST POPULAR...</option>";
				for(i = 0; i < returnVal['MODELS'].length; i++){
					if(i==returnVal['TOP'])options += "<option  style='background: #8ff064; color:#000000' disabled>ALL MODELS...</option>";
					options += "<option value='"+returnVal['MODELS'][i]['MODEL']+"'>"+returnVal['MODELS'][i]['MODEL']+"</option>";
				}				
				$("select#sel_model").html(options);
				$("#sel_model").removeAttr("disabled");
				$("#modelblock").removeClass("inactive");	
				$("#modelblock > a").attr("href", returnVal['LINK']);			
			});												
}

function model_main(){
		var brand = $("select#sel_brand").val();
		var model = $("select#sel_model").val();
		$("#step2_form").removeClass("step_completed");
		$("#step3").removeClass("step") 
		$("#step3_form").removeClass("step_active");
		$("#step3_form").addClass("step_inactive");
		$("#step3").removeClass("step") 
		$("#step3").addClass("step_locked");						
		$("#quote1").hide();
		$("#quote2").hide();
		$("#quote3").hide();
	
		$("#step2").removeClass("step") 
		$("#step2").addClass("step_locked");	
		$("#c1").attr("disabled", "true");
		$("#c2").attr("disabled", "true");
		$("#c1").removeAttr("checked");							
		$("#c2").removeAttr("checked");					
		$("#step1 > div.top").addClass("act");
		
		$("#country").attr("disabled", "true");
		$("#country option:first").attr("selected", "yes");
		$("#network").attr("disabled", "true");
		$("#network option").remove();
		
		if(model=='- Please select -'){
			$("#step3").removeClass("step") 
			$("#step3").addClass("step_locked");						
			$("#quote1").hide();
			$("#quote2").hide();
			$("#quote3").hide();
			$("#step21").hide();
		
			$("#step2").removeClass("step") 
			$("#step2").addClass("step_locked");	
			$("#c1").attr("disabled", "true");
			$("#c2").attr("disabled", "true");
			$("#c1").removeAttr("checked");							
			$("#c2").removeAttr("checked");	
			$("#step1 > div.top").removeClass("ready");				
			$("#step1 > div.top").addClass("act");
//			$("#step2 > div.top").removeClass("act");
			$("#step2 > div.top").removeClass("ready");
			
			$("#step1_form").removeClass("step_completed");
			$("#step1_form").addClass("step_active");
			$("#step2_form").removeClass("step_active");
			$("#step2_form").addClass("step_inactive");
			$("#step3_inactive").show();
			
			$("#country").attr("disabled", "true");
			$("#country option:first").attr("selected", "yes");
			$("#network").attr("disabled", "true");
			$("#network option").remove();
			$("#model_image").html("");
			$("#step12").Attention();		
		}
		else{ 	
			$("#step1_form").removeClass("step_active");
			$("#step1_form").addClass("step_completed");
			$("#step2").removeClass("step_locked");
			$("#step2").addClass("step");
			$("#step2_form").removeClass("step_inactive");
			$("#step2_form").addClass("step_active");
			$("#c1").removeAttr("disabled");
			$("#c2").removeAttr("disabled");
			$("#step2 > div.top").addClass("act");
			$("#step2 > div.top").removeClass("ready");
			$("#step1 > div.top").removeClass("act");
			$("#step1 > div.top").addClass("ready");
			$("#model").val(model);
			$("#step3_inactive").show();	
			
			$.getJSON("/order_product_ajax.php",
			{model: model,
			manu: brand,
			action: "get_model_image"},
			function(returnVal)
			{
				var image = '';
				image += "<img src='"+returnVal["IMAGE_URL"]+"/"+returnVal["IMAGE_FILENAME"]+"\'>";
				$("#step21").Attention();		
				$("#model_image").html(image);
			});							
		}

}

function model_special(){
	var brand = $("select#sel_brand").val();
	var model = $("select#sel_model").val();
	var country = $("select#country_s").val();
	var network = $("select#network_s").val();
	
		$("#step3").removeClass("step") 
		$("#step3_form").removeClass("step_active");
		$("#step3_form").addClass("step_inactive");
		$("#step3").removeClass("step") 
		$("#step3").addClass("step_locked");						
		$("#quote1").hide();
		$("#quote2").hide();
		$("#quote3").hide();
	
		$("#step1 > div.top").addClass("act");
		
	
	if(model=='- Please select -'){
		$("#step3").removeClass("step") 
		$("#step3").addClass("step_locked");		
		$("#step21").hide();		
		$("#quote1").hide();
		$("#quote2").hide();
		$("#quote3").hide();	
		$("#step1 > div.top").removeClass("ready");				
		$("#step1 > div.top").addClass("act");			
		$("#step1_form").removeClass("step_completed");
		$("#step1_form").addClass("step_active");
		$("#step3_inactive").show();			
		$("#model_image").html("");
	}
	else{
		$("#step1_form").removeClass("step_active");
		$("#step1_form").addClass("step_completed");
		$("#step1 > div.top").removeClass("act");
		$("#step1 > div.top").addClass("ready");
		$("#model").val(model);
		$("#step3_inactive").show();	
		//
		$("#step3").removeClass("step_locked");
		$("#step3").addClass("step");
		$("#step3_form").removeClass("step_inactive");
		$("#step3_form").addClass("step_active");
		$("#step3 > div.top").addClass("act");
		$("#quote1").hide();
		$("#quote2").hide();
		$("#quote3").hide();

		/*	
		$.getJSON("order_product_ajax.php",
		{model: model,
		manu: brand,
		action: "get_model_image"},
		function(returnVal)
		{
			var image = '';
			image += "<img src='"+returnVal["IMAGE_URL"]+"/"+returnVal["IMAGE_FILENAME"]+"\'>";				
			$("#model_image").html(image);
		});		
		*/
					//get pricing solution
			$.getJSON("/order_product_ajax.php",
				{model: model, manu: brand, country: country, network_id: network, ajax: 'true', action: "get_solution"},
				function(returnVal){show_solution(returnVal);});				
	} 
}

$(document).ready(function(){
	var cur_nk;
	//if user select brand
	$("select#sel_brand").change(function(){
		var brand = $("select#sel_brand").val();		
		$("#step2_form").removeClass("step_completed");
		$("#step22").hide();
		$("#step22-cap").hide();
		$("#step23").hide();
		$("#sel_model").attr("disabled", "true");
		$("#modelblock").addClass("inactive");
		$("select#sel_model").html("");
		$("#step3").removeClass("step") 
		$("#step3").addClass("step_locked");	
		$("#step3_form").removeClass("step_active");
		$("#step3_form").addClass("step_inactive");
		$("#step3_inactive").show();	
		$("#quote1").hide();
		$("#quote2").hide();
		$("#quote3").hide();
		$("#step2").removeClass("step") 
		$("#step2").addClass("step_locked");	
		$("#step2_form").removeClass("step_active");
		$("#step2_form").addClass("step_inactive");
		$("#step1 > div.top").addClass("act");
		$("#step1 > div.top").removeClass("ready");
		$("#step1_form").removeClass("step_completed");
		$("#step1_form").addClass("step_active");
		
		$("#country").attr("disabled", "true");
		$("#country option:first").attr("selected", "yes");
		$("#network").attr("disabled", "true");		
		
		$("#c1").removeAttr("checked");							
		$("#c2").removeAttr("checked");
		$("#c1").attr("disabled", "true");
		$("#c2").attr("disabled", "true");	
		step2_stop();
		step1_stop();
		

		if(brand=='- Please select -'){ //Clear list of models
			$("#sel_model").attr("disabled", "true");
			$("#modelblock").addClass("inactive");
			$("select#sel_model").html("");
			$("#step3").removeClass("step") 
			$("#step3").addClass("step_locked");						
			$("#quote1").hide();
			$("#quote2").hide();
			$("#quote3").hide();
			$("#step2").removeClass("step");
			$("#step2").addClass("step_locked");	
			$("#step1 > div.top").removeClass("ready");
			$("#step1 > div.top").addClass("act");
			$("#step1_form").removeClass("step_completed");
			$("#step1_form").addClass("step_active");
			
			$("#country").attr("disabled", "true");
			$("#country option:first").attr("selected", "yes");
			$("#network").attr("disabled", "true");
			$("#network option").remove();	
			
			$("#c1").removeAttr("checked");							
			$("#c2").removeAttr("checked");
			$("#c1").attr("disabled", "true");
			$("#c2").attr("disabled", "true");
			$("#model_image").html("");			
			$("#step11").Attention();		
			$("#step12").hide();	
			$("#step21").hide();	
		}
		else
		{
			$("#step12").show();
			$("#model_image").html("");
			//Display list of models according with brand			
			$.getJSON("/order_product_ajax.php",
			{model: brand,  action: "get_models"},
			function(returnVal){			
			 	var options = "";			 	
				options += "<option value='- Please select -' style='color:#999'>- Please select -</option>";
				options += "<option  style='background: #8ff064; color:#000000' disabled>TOP "+returnVal['TOP']+" MOST POPULAR...</option>";
				for(i = 0; i < returnVal['MODELS'].length; i++){
					if(i==returnVal['TOP'])options += "<option  style='background: #8ff064; color:#000000' disabled>ALL MODELS...</option>";
					options += "<option value='"+returnVal['MODELS'][i]['MODEL']+"'>"+returnVal['MODELS'][i]['MODEL']+"</option>";
				}
				$("select#sel_model").html(options);
				$("#sel_model").removeAttr("disabled");
				$("#modelblock").removeClass("inactive");				
				$("#step12 > a").attr("href", returnVal['LINK']);		
				$("#step12").Attention();								
			});

		}
	});

	//if user select model
	$("select#sel_model").change(function(){
		$("#step22").hide();
		$("#step22-cap").hide();
		$("#step23").hide();
		step2_stop();
		step1_stop();		
		if($("select#network_s").val()) model_special();
		else model_main();		
	});

	//$("input[name='network_know']").change(function(){
	$("input[name='network_know']").click(function(){
		var manu, model;
		choose_net = $(this).val();
		if(choose_net==cur_nk)return false;
		else cur_nk=choose_net;		
		manu = $("select#sel_brand").val();				
		model = $("select#sel_model").val();				
		$("#step2 > div.top").removeClass("ready");
		$("#step2_form").removeClass("step_completed");
		$("#step2_form").addClass("step_active");
		$("#step3_form").removeClass("step_active");
		$("#step3_form").removeClass("step_completed");
		$("#step3_form").addClass("step_inactive");
		$("#step3 > div.top").removeClass("act");	
		$("#step3 > div.top").removeClass("ready");
		$("#step3").removeClass("step");
		$("#step3").addClass("step_locked");
		$("#step3_inactive").show();
		
		$("#quote1").hide();
		$("#quote2").hide();
		$("#quote3").hide();
		$("#model").val(model);
		//if choose_net == "Yes"
		//enable country selection
		if(choose_net == "yes"){			
			$("#country").removeAttr("disabled");
			step2_stop();
			$("#step22").show();			
			$("#step22-cap").show();			
			$("#step22").Attention();
		}		
		else if(choose_net == "no"){
			step2_stop();
			$("#step22").hide();
			$("#step22-cap").hide();
			$("#step23").hide();
			$("#step2_form").removeClass("step_active");
			$("#step2_form").addClass("step_completed");
			$("#country").attr("disabled", "true");
			$("#country option:first").attr("selected", "yes");
			$("#network").attr("disabled", "true");
			$("#network option").remove();
			$("#quote1").hide();
			$("#quote2").hide();
			$("#quote3").hide();	
			$("#step3").removeClass("step_locked");
			$("#step3").addClass("step");
			$("#step3_form").addClass("step_active");
			$("#step3_form").removeClass("step_inactive");		
			$("#step2 > div.top").addClass("act");	
			$("#step2 > div.top").addClass("ready");	
			$("#step3 > div.top").addClass("act");	
			
			manu = $("select#sel_brand").val();
			model = $("select#sel_model").val();
			
			//get solution
			//get pricing solution
			$.getJSON("/order_product_ajax.php",
				{model: model, manu: manu, ajax: 'true', action: "get_solution"},
				function(returnVal){
					show_solution(returnVal);		
				});
			///////////////
		}
	});
	
	//if user select country
	$("select#country").change(function(){
		var manu, model;
		step2_stop();		
		$("#step2_form").removeClass("step_completed");
		$("#step2_form").addClass("step_active");
		$("#step2 > div.top").addClass("act");
		$("#step2 > div.top").removeClass("ready");
		
		$("#step3").removeClass("step") 
		$("#step3").addClass("step_locked");
		$("#step3_inactive").show();					
		$("#quote1").hide();
		$("#quote2").hide();
		$("#quote3").hide();
		$("#step3_form").removeClass("step_active");
		$("#step3_form").addClass("step_inactive");
		
		selected_country = $("select#country").val();
		manu = $("select#sel_brand").val();
		model = $("select#sel_model").val();		
		$("select#network").attr("disabled","disabled");
		$("select#network").val("");

		if(selected_country != "" && selected_country != '-----'){
			//call ajax page for getting network option tags
			$.getJSON("/order_product_ajax.php",
			{model: model, manu: manu, country: selected_country, action: "get_network"},
			function(returnVal){
				var options = "";
				options += "<option value=''>- Please select -</option>";
				for(i = 0; i < returnVal.length; i++){
						options += "<option value='"+returnVal[i]["NETWORK_ID"]+"'>"+returnVal[i]["NETWORK_BRAND"]+"</option>";
					}
				$("select#network").html(options);
				$("#network").removeAttr("disabled");
				$("#step22").BrAtt();
				$("#step23").show();
				$("#step23").Attention();
			});
		}
	});



	//if user select network
	$("select#network").change(function(){
		var manu, model;	
		selected_network = $("select#network").val();
		selected_country = $("select#country").val();
		manu = $("select#sel_brand").val();
		model = $("select#sel_model").val();
		$("#step3").removeClass("step") 
		$("#step3").addClass("step_locked");
//		$("#step3_inactive").show();
		$("#step3_from").removeClass("step_active");
		
		if(selected_network==''){
			$("#step3").removeClass("step") 
			$("#step3").addClass("step_locked");	
			$("#step2 > div.top").removeClass("ready");		
			$("#step2 > div.top").addClass("act");
			$("#step2_form").addClass("step_active");
			$("#step2_form").removeClass("step_completed");
			$("#quote1").hide();
			$("#quote2").hide();
			$("#quote3").hide();
			$("#step3_form").removeClass("step_active");
			$("#step3_form").addClass("step_inactive");
			$("#step3_inactive").show();
		}
		else{ 	
			$("#step23").BrAtt();
			$("#step2_form").removeClass("step_active");
			$("#step2_form").addClass("step_completed");		
			$("#step3").removeClass("step_locked");
			$("#step3").addClass("step");
			$("#step3_form").removeClass("step_inactive");
			$("#step3_form").addClass("step_active");
			$("#step3 > div.top").addClass("act");
			$("#step2 > div.top").removeClass("act");
			$("#step2 > div.top").addClass("ready");
			
			$("#quote1").hide();
			$("#quote2").hide();
			$("#quote3").hide();
			
			//get pricing solution
			$.getJSON("/order_product_ajax.php",
				{model: model, manu: manu, country: selected_country, network_id: selected_network, ajax: 'true', action: "get_solution"},
				function(returnVal){
					show_solution(returnVal);
				});
		}		
		
								
		//$("div[name^='quote_result']").hide();
		//$("#quote_nosolution").hide();
		//$("#quote_empty").animate({opacity: 'show'}, "slow", "linear");
	});

});

function cart_currency_change(selected_currency)
{
	switch(selected_currency){
		case "EUR":
			selected_sign = "&euro;";
			tld = 'eu';
			break;
		case "USD":
			selected_sign = "$";
			tld = 'us';
			break;
		case "NZD":
			selected_sign = "$";
			tld = 'nz';
			break;
		case "CAD":
			selected_sign = "$";
			tld = 'ca';
			break;
		case "AUD":
			selected_sign = "$";
			tld = 'au';
			break;
		default:
			selected_sign = "&pound;";
			tld = 'gb';
			break;
	}

	//change currency in cart
	$.get("/currency_set_ajax.php",
		{currency: selected_currency},
		function(returnVal)
		{
			var tmp_array = new Array();
			tmp_array = returnVal.split(',');			
			$("#cart_amount").text(tmp_array[0]);
			$("#flag_image").attr("src", "{{$smarty.const.IMAGES_URL}}/flags/"+tld+".png");
			$("#cart_currency").html(selected_sign);
		}
	);
	
	//change lowest price and currency in header 
	/*
	$.getJSON("currency_set_ajax.php",
		{currency: selected_currency, lowcost: 1},
		function(returnVal)
		{
			var display_low_price = '',display_max_price = '';
			display_low_price = selected_sign+''+returnVal['PRICE'];
			display_max_price = selected_sign+''+returnVal['MAX_PRICE'];
			$("#price_instant").html(display_low_price);
			$("#price_regular").html(display_low_price);
			$("#rbmin").html(display_low_price);
			$("#rbmax").html(display_max_price);
		}
	);
	*/
	//////////
	$("#selected_currency").val(selected_currency);
	set_currency(selected_currency);
	//change price if listed
	$("b[id^='unlock_price']").hide();
	$("#unlock_price1_"+selected_currency.toLowerCase()).show();
	$("#unlock_price2_"+selected_currency.toLowerCase()).show();

	//$("#unlock_price_instant_"+selected_currency.toLowerCase()).show();
	//$("#select_solution_"+selected_currency.toLowerCase()).show();
	//$("#unlock_price_"+selected_currency.toLowerCase()).show();
}
