// 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((600)+"GB");
      $('.ram p').text((256)+"MB");
      $('.storage p').text((15)+"GB");
      $('.price p').text("$"+(19.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=116');
	  break;
	  
	  case 2:
	  $('.cpu p').text((1000)+"GB");
      $('.ram p').text((512)+"MB");
      $('.storage p').text((30)+"GB");
      $('.price p').text("$"+(38.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=117');
	  break;
	  
	  case 3:
	  $('.cpu p').text((1400)+"GB");
      $('.ram p').text((768)+"MB");
      $('.storage p').text((45)+"GB");
      $('.price p').text("$"+(56.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=118');
	  break;
	  
	  case 4:
	  $('.cpu p').text((1800)+"GB");
      $('.ram p').text((1024)+"MB");
      $('.storage p').text((60)+"GB");
      $('.price p').text("$"+(73.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=119');
	  break;
	  
	  case 5:
	  $('.cpu p').text((2200)+"GB");
      $('.ram p').text((1280)+"MB");
      $('.storage p').text((75)+"GB");
      $('.price p').text("$"+(89.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=120');
	  break;
	  
	  case 6:
	  $('.cpu p').text((2600)+"GB");
      $('.ram p').text((1536)+"MB");
      $('.storage p').text((90)+"GB");
      $('.price p').text("$"+(104.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=131');
	  break;
	  
	  case 7:
	  $('.cpu p').text((3000)+"GB");
      $('.ram p').text((1792)+"MB");
      $('.storage p').text((105)+"GB");
      $('.price p').text("$"+(118.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=132');
	  break;
	  
	  case 8:
	  $('.cpu p').text((3400)+"GB");
      $('.ram p').text((2048)+"MB");
      $('.storage p').text((120)+"GB");
      $('.price p').text("$"+(131.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=133');
	  break;
	  
	  case 9:
	  $('.cpu p').text((3800)+"GB");
      $('.ram p').text((2304)+"MB");
      $('.storage p').text((135)+"GB");
      $('.price p').text("$"+(143.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=134');
	  break;
	  
	  case 10:
	  $('.cpu p').text((4200)+"GB");
      $('.ram p').text((2560)+"MB");
      $('.storage p').text((155)+"GB");
      $('.price p').text("$"+(154.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=135');
	  break;
	  
	  case 11:
	  $('.cpu p').text((4600)+"GB");
      $('.ram p').text((2816)+"MB");
      $('.storage p').text((170)+"GB");
      $('.price p').text("$"+(164.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=136');
	  break;
	  
	  case 12:
	  $('.cpu p').text((5000)+"GB");
      $('.ram p').text((3072)+"MB");
      $('.storage p').text((185)+"GB");
      $('.price p').text("$"+(174.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=137');
	  break;
	  
	  case 13:
	  $('.cpu p').text((5400)+"GB");
      $('.ram p').text((3328)+"MB");
      $('.storage p').text((200)+"GB");
      $('.price p').text("$"+(184.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=138');
	  break;
	  
	  case 14:
	  $('.cpu p').text((5800)+"GB");
      $('.ram p').text((3584)+"MB");
      $('.storage p').text((215)+"GB");
      $('.price p').text("$"+(194.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=139'); 
	  break;
	  
	  case 15:
	  $('.cpu p').text((10000)+"GB");
      $('.ram p').text((4096)+"MB");
      $('.storage p').text((250)+"GB");
      $('.price p').text("$"+(239.95)+"/mo");
	  $('.order p a').attr('href', 'http://www.dmehosting.com/clients/cart.php?a=add&pid=152'); 
	  break;
	  
	  }
	  
  }} ); 
    
});
