
function file_name_only(str) 
{
	var slash = '/'
	if (str.match(/\\/)) slash = '\\'
	return str.substring(str.lastIndexOf(slash) + 1, str.lastIndexOf('.'))
}

var planID;

function iChooseYou(id) {
	planID = id;
	if (id == 3) {
		$('HostingPlanB').fade({duration: .01});
		$('HostingPlanC').fade({duration: .01});
		$('ChooseLinkA').fade({duration: .01});		
		new Effect.Appear('CancelLinkA',{duration: .5});
		$('plan_info').update($('HostingInfoA').innerHTML);
	}
	if (id == 2) {
		$('HostingPlanA').fade({duration: .01});
		$('HostingPlanC').fade({duration: .01});
		$('ChooseLinkB').fade({duration: .01});		
		new Effect.Appear('CancelLinkB',{duration: .5});		
		$('plan_info').update($('HostingInfoB').innerHTML);
	}
	if (id == 1) {
		$('HostingPlanA').fade({duration: .01});
		$('HostingPlanB').fade({duration: .01});
		$('ChooseLinkC').fade({duration: .01});		
		new Effect.Appear('CancelLinkC',{duration: .5});		
		$('plan_info').update($('HostingInfoC').innerHTML);
	}
	new Effect.BlindDown('hosting_order_form',{duration: .5});
}
function iChooseNone(id) {	
	new Effect.BlindUp('hosting_order_form',{duration: .1});
	$('CancelLinkA').fade({duration: .01});		
	$('CancelLinkB').fade({duration: .01});		
	$('CancelLinkC').fade({duration: .01});	

	$('HostingInfoA').fade({duration: .01});		
	$('HostingInfoB').fade({duration: .01});		
	$('HostingInfoC').fade({duration: .01});	
					
	$('HostingPlanA').appear({duration: .1});
	$('ChooseLinkA').appear({duration: .1});		
	$('HostingPlanB').appear({duration: .3});
	$('ChooseLinkB').appear({duration: .3});				
	$('HostingPlanC').appear({duration: .5});		
	$('ChooseLinkC').appear({duration: .5});				
}

var clientCounter = 0;

function devLeft() {
	var currentCounter = clientCounter;
	if(clientCounter == 0) {
		clientCounter = clientList.length - 1;
	}
	else {
		clientCounter--;
	}
	
	$('client_'+currentCounter).fade({duration: .3,beforeStart: function () {$('client_'+currentCounter).style.position = 'absolute';},afterFinish: function () {$('client_'+currentCounter).style.position='relative';$('client_name').update(clientList[clientCounter]);}});
	$('client_'+clientCounter).appear({duration: .3,beforeStart: function () {$('client_'+clientCounter).style.position = 'absolute';},afterFinish: function () {$('client_'+clientCounter).style.position='relative';}});
	$('client_name').update(clientList[clientCounter]);
}

function devRight() {
	var currentCounter = clientCounter;
	if(clientCounter == (clientList.length - 1)) {
		clientCounter = '0';
	}
	else {
		clientCounter++;
	}
	
	$('client_'+currentCounter).fade({duration: .3,beforeStart: function () {$('client_'+currentCounter).style.position = 'absolute';},afterFinish: function () {$('client_'+currentCounter).style.position='relative';$('client_name').update(clientList[clientCounter]);}});
	$('client_'+clientCounter).appear({duration: .3,beforeStart: function () {$('client_'+clientCounter).style.position = 'absolute';},afterFinish: function () {$('client_'+clientCounter).style.position='relative'; }});
	
}

function submitHostingForm() {
	$('errors').style.display = 'none';
	var emailAddress = $('email_address').value;
	var domainName = $('domain_name').value;
	var buyDomain = $('buy_domain').checked;
	var staticIP = $('static_ip').checked;
	var ssl = $('ssl').checked;
	var comments =  $('comments').value;
	var hasError = false;
	if(!emailAddress) {
		$('email_label').addClassName('error');
		hasError = true;
		$('errors').appear({duration: .3});
	}
	else {
		new Ajax.Request('/ajax_actions.php',{
			parameters: {
				action: 'hosting_contact',
				email_address: emailAddress,
				domain_name: domainName,
				buy_domain: buyDomain,
				static_ip: staticIP,
				ssl: ssl,
				comments: comments,
				plan_id: planID
			},
			onSuccess: function () {
				$('hosting_plans').fade({duration: .1});
				$('contact_complete').appear({duration: .3});
			}
		
		});
	}
	
	
	
	
}
