function LightBox()
{
  var width = document.documentElement.clientWidth + document.documentElement.scrollLeft;

  var layer = document.createElement('div');
  layer.style.zIndex = 2;
  layer.id = 'layer';
  layer.style.position = 'absolute';
  layer.style.top = '0px';
  layer.style.left = '0px';
  layer.style.height = document.documentElement.scrollHeight + 'px';
  layer.style.width = width + 'px';
  layer.style.backgroundColor = 'black';
  layer.style.opacity = '.6';
  layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=60)");
  document.body.appendChild(layer);

/*
  var div = document.createElement('div');
  div.style.zIndex = 3;
  div.id = 'box';
  div.style.position = (navigator.userAgent.indexOf('MSIE 6') > -1) ? 'absolute' : 'fixed';
  div.style.top = '200px';
  div.style.left = (width / 2) - (400 / 2) + 'px'; 
  div.style.height = '50px';
  div.style.width = '400px';
  div.style.backgroundColor = 'white';
  div.style.border = '2px solid silver';
  div.style.padding = '20px';
  document.body.appendChild(div);

  var p = document.createElement('p');
  p.innerHTML = '<span class="title">Sign In</span>';
  div.appendChild(p);

  var a = document.createElement('a');
  a.innerHTML = 'Sign In';
  a.href = 'javascript:void(0)';
  a.onclick = function()
  {
    document.body.removeChild(document.getElementById('layer'));
    document.body.removeChild(document.getElementById('box'));
  };
  div.appendChild(a);
  */
}

jQuery.fn.delay = function(time,func){
	this.each(function(){
		setTimeout(func,time);
	});
	
	return this;
};

function CloseLogin() {
	  if(document.getElementById('layer')){document.body.removeChild(document.getElementById('layer'))};
	  document.getElementById("LoginBox").style.display="none";
}

/* THIS LOADS THE SLIDER */
$(document).ready(function(){	
	$("#slider").easySlider({
		auto: true,
		controlsShow: false,
		speed: 1100,
		vertical: false,
		pause: 4000,
		continuous: true 
	});
	
	// This Loads onclicks for Pawn and Sell butons
	$("#iwanttosell_button").css({ cursor:"pointer" });
	$("#iwanttosell_button").click(function () {
    	$("#form_pawn").slideUp(500,function(){
			$(".NeedCash").fadeOut(500,function(){
				$(".form1").fadeIn(1000,function(){});					
			});							 
							 
			$("#form_sell").slideDown(1000,function(){});									  
      	});	
	  
    });
	
	$("#iwanttopawn_button").css({ cursor:"pointer" });
	$("#iwanttopawn_button").click(function () {
    	$("#form_sell").slideUp(500,function(){
			$(".NeedCash").fadeOut(500,function(){
				$(".form2").fadeIn(1000,function(){});					
			});										 
			$("#form_pawn").slideDown(1000,function(){});									  
      	});	
    });
	
	LoadAutoExpandingTextArea();
	
	
});	
	
function AutoExpandFix() {
	
	$(this).delay(500,function(){
		LoadAutoExpandingTextArea();
  });

}

function LoadAutoExpandingTextArea() {
	// Expanding text areas
	$('textarea.expanding').autogrow({
		maxHeight: 100,
		minHeight: 10
	});
}


function FadeItem(FadePecent, Item) {
	var NewOpacity = (FadePecent/100); 
	Item.style.opacity = NewOpacity	; /* FOR FF */
	Item.style.filter = "alpha(opacity=" + FadePecent + ")"; /* FOR IE */
	Item.onmouseout = function() { 
		FadeItem(100, this);
	}
}

function CheckForm(FormtoCheck) {
	$(this).delay(3000,function(){
								
		var Label = document.getElementById("ctl00_" + FormtoCheck + "_FormStatus");
							   
		if(Label.innerHTML=="1") { // Then form complete - Move to next stage
			window.location = "FormDetails.aspx";
		}		
 	});
}