// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
$(document).ready(function(){
  $('A[rel="external"]').click( function() {
    window.open( $(this).attr('href') );
    return false;
  });
$('.login-form a[rel=reqpassword]').click(function(){
    $('.login-form .reqpass').toggle();    
    return false;
  });
  
  
  slice_cost = 0
  $("#flasher").animate({"top": "+=50px"},"slow");
  $("#flasher").animate({opacity: 1.0}, 3000).animate({"top": "-=50px"},"slow");
  
  /* Slider on the signup and upgrade page */
  
	$('.slider-wrap #slider').addClass( "active");
	$('.slider-wrap #slider input').css("display","none");
	$('.slider-wrap #slider input').val(2);
	$('.slider-wrap #slider .ui-slider-handle').mousedown(function () { $(this).addClass("active");});
	$('.slider-wrap #slider .ui-slider-handle').mouseup(function () { $(this).removeClass("active");});
	$('.slider-wrap #slider.ui-slider-signup').slider({ min: 1, max: 15, startValue: 2, animate: true, slide:function(e,ui){
			var t = jQuery(this);
			var x = jQuery(t).slider( "value" );
			jQuery(t).find('input').val(x);
			for (var y = 0; y <= x; y++)
        {
           $(".slider-wrap #node-"+y).addClass("active");
        }
      for (var y = x+1; y <= 15; y++)
        {
           $(".slider-wrap #node-"+y).removeClass("active");
        }
      /*
	  $('.cpu p').text((x/5)+"GHz");
      $('.ram p').text((x*256)+"MB");
      $('.storage p').text((x*10)+"GB");
      $('.price p').text("$"+(x*100));*/
	  
	  switch(x)
	  {
	  
	  case 1:
	  $('.cpu p').text((200)+"GB");
      $('.ram p').text((64)+"MB");
      $('.storage p').text((3)+"GB");
      $('.price p').text("$"+(6.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=121');
	  break;
	  
	  case 2:
	  $('.cpu p').text((400)+"GB");
      $('.ram p').text((128)+"MB");
      $('.storage p').text((5)+"GB");
      $('.price p').text("$"+(9.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=122');
	  break;
	  
	  case 3:
	  $('.cpu p').text((800)+"GB");
      $('.ram p').text((256)+"MB");
      $('.storage p').text((10)+"GB");
      $('.price p').text("$"+(19.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=40');
	  break;
	  
	  case 4:
	  $('.cpu p').text((1200)+"GB");
      $('.ram p').text((512)+"MB");
      $('.storage p').text((25)+"GB");
      $('.price p').text("$"+(39.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=41');
	  break;
	  
	  case 5:
	  $('.cpu p').text((1600)+"GB");
      $('.ram p').text((768)+"MB");
      $('.storage p').text((40)+"GB");
      $('.price p').text("$"+(59.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=42');
	  break;
	  
	  case 6:
	  $('.cpu p').text((2000)+"GB");
      $('.ram p').text((1024)+"MB");
      $('.storage p').text((55)+"GB");
      $('.price p').text("$"+(79.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=43');
	  break;
	  
	  case 7:
	  $('.cpu p').text((2400)+"GB");
      $('.ram p').text((1280)+"MB");
      $('.storage p').text((70)+"GB");
      $('.price p').text("$"+(99.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=44');
	  break;
	  
	  case 8:
	  $('.cpu p').text((2800)+"GB");
      $('.ram p').text((1536)+"MB");
      $('.storage p').text((85)+"GB");
      $('.price p').text("$"+(119.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=45');
	  break;
	  
	  case 9:
	  $('.cpu p').text((3200)+"GB");
      $('.ram p').text((1792)+"MB");
      $('.storage p').text((100)+"GB");
      $('.price p').text("$"+(134.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=123');
	  break;
	  
	  case 10:
	  $('.cpu p').text((3600)+"GB");
      $('.ram p').text((2048)+"MB");
      $('.storage p').text((115)+"GB");
      $('.price p').text("$"+(149.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=124');
	  break;
	  
	  case 11:
	  $('.cpu p').text((4000)+"GB");
      $('.ram p').text((2304)+"MB");
      $('.storage p').text((130)+"GB");
      $('.price p').text("$"+(164.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=125');
	  break;
	  
	  case 12:
	  $('.cpu p').text((4400)+"GB");
      $('.ram p').text((2560)+"MB");
      $('.storage p').text((145)+"GB");
      $('.price p').text("$"+(179.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=126');
	  break;
	  
	  case 13:
	  $('.cpu p').text((4800)+"GB");
      $('.ram p').text((2816)+"MB");
      $('.storage p').text((160)+"GB");
      $('.price p').text("$"+(194.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=127');
	  break;
	  
	  case 14:
	  $('.cpu p').text((5200)+"GB");
      $('.ram p').text((3072)+"MB");
      $('.storage p').text((175)+"GB");
      $('.price p').text("$"+(209.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=128');
	  break;
	  
	  case 15:
	  $('.cpu p').text((6000)+"GB");
      $('.ram p').text((3584)+"MB");
      $('.storage p').text((200)+"GB");
      $('.price p').text("$"+(224.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=129'); 
	  break;
	  
	  }
	  
  }} ); 
    
});
