function startChat() {
	 return window.open ('http://live.domvps.com', 'domVPS Live Support / Sales','status=0,toolbar=0,location=0,resizable=0,height=525,width=780,scrollbars=0');
}

$(document).ready( function() {

	$(".default_page").addClass("active");
	$("#nav li a").each( function() {
		if( document.location.href.indexOf($(this).text().toLowerCase()) != -1) {
			$(this).parent().addClass("active");
			$(".default_page").removeClass("active");
		}
	});
	
	$(".live-help").click( function(e) {
		e.preventDefault();
		startChat();
	});
	
	$("#plan-name li a").click( function(e) {
		e.preventDefault();
		$("#plan-name li a").each( function() {
			$(this).removeClass("active");
		});
		
		$(this).addClass("active");
		var plan_id = $(this).attr("plan_id");
		$(".plan-info").hide();
		$(".plan-" + plan_id).fadeIn();
	});
	
	$(".submit_button").click( function(e) {
		e.preventDefault();
		var name = $("#contact_user").val();
		var email = $("#contact_email").val();
		var phone = $("#contact_phone").val();
		var msg = $("#message").val();
		// alert(name + email + phone + msg);
		
		$(".classy_title").hide();
		$(".contact-form").html("<h3 style='margin-left: -0px'>Thanks for the message! We'll reply as soon as possible.</h3>");
	});
	
	$("#currency-switch").change( function() {
		var 
			newCur = $(this).val(),
			newSign = $(this).attr("data-sign");
		$(".price").each( function(e) {
			var current_currency = $(this).attr("data-currency");
			var current_amount = $(this).attr("data-amount");
			current_amount = current_amount.replace("&pound;",'');
			current_amount = current_amount.replace("&euro;",'');
			$(this).load("/include/convert.php?from="+current_currency+"&to="+ newCur+"&amount=" +current_amount, function(data) {
				var result = parseFloat(data);
				result = result.toFixed(2);
				if(newCur == "USD" || newCur == "CAD" || newCur == "AUD") $(this).html("$" + result);				
				else if(newCur == "GBP") $(this).html("&pound;" + result);		
				else if(newCur == "EUR") $(this).html("&euro;" + result);
				$(this).attr("data-currency", newCur);
				$(this).attr("data-amount", result);
			})
		});
	});
});
