function topSubShopCart()
{	
	var itemThis = $("#topShopCart");	
	$("div.subShopCart").css({'width':(itemThis.find("div.ShowInfo").parent("div.cart_panel").width()-2)+"px"});
	$("div.subShopCart").slideDown('slow');
}

function topSubShopCartClose()
{	
	$("div.subShopCart").slideUp('slow');
}

function topSubShopCartReopen()
{	
    var itemThis = $("#topShopCart");	
	$("div.subShopCart").css({'width':(itemThis.find("div.ShowInfo").parent("div.cart_panel").width()-2)+"px"});
	$("div.subShopCart").css("display", "block");
}


function checkString(objValue)
{
	var reg = /^\s*$/;
	if(reg.test(objValue))
	{
		return false;
	}
	else
	{
		return true;
	}
}

function checkNumFunction(objValue)
{	
	var reg = /^\d+$/;
	if(reg.test(objValue) == false)
	{
		return false;
	}
	else
	{
		return true;
	}	
}

function topQuantityValidation()
{	
	var itemVal = $("input.txtQty").val();
	if(!checkString(itemVal))
	{
		$("span.txtQtyMsg").html("Please enter quantity");
		$("span.txtQtyMsg").css("display", "block");
    	return false;    
	}
	else
	{
    	if(!checkNumFunction(itemVal))    
	    {  
			$("span.txtQtyMsg").html("Please enter value between 1 to 20.For bulk order please contact at <a href='mailto:support@rebelfone.com'>support@rebelfone.com </a>");
			$("span.txtQtyMsg").css("display", "block");
        	return false;    
	    }
    	else
	    {
    	    if(itemVal <=0 || parseInt(itemVal)>=21)
        	{            
				$("span.txtQtyMsg").html("Please enter value between 1 to 20.For bulk order please contact at <a href='mailto:support@rebelfone.com'>support@rebelfone.com </a>");
				$("span.txtQtyMsg").css("display", "block");
	            return false;    
    	    }
	    }
	}
}

function midQuantityValidation()
{	
	var itemVal = $(".shopInfo input.txtQty").val();
	if(!checkString(itemVal))
	{
		$(".shopInfo span.txtQtyMsg").html("Please enter quantity");
		$(".shopInfo span.txtQtyMsg").css("display", "block");
    	return false;    
	}
	else
	{
    	if(!checkNumFunction(itemVal))    
	    {  
			$(".shopInfo span.txtQtyMsg").html("Please enter value between 1 to 20.For bulk order please contact at <a href='mailto:support@rebelfone.com'>support@rebelfone.com </a>");
			$(".shopInfo span.txtQtyMsg").css("display", "block");
        	return false;    
	    }
    	else
	    {
    	    if(itemVal <=0 || parseInt(itemVal)>=21)
        	{            
				$(".shopInfo span.txtQtyMsg").html("Please enter value between 1 to 20.For bulk order please contact at <a href='mailto:support@rebelfone.com'>support@rebelfone.com </a>");
				$(".shopInfo span.txtQtyMsg").css("display", "block");
	            return false;    
    	    }
	    }
	}
}

function satelliteOpen()
{
    window.open("Promocode.htm", "newwindow","width=300,height=50,scrollbars=0,menu=0");
}

$(document).ready(function() {
	$("#allredbox").appendTo(".info_view");
});
