﻿function SetDivHeight()
{
    // Declare
    var totalHeight = getTotalDivHeight();	
   
    // Determine if the total amount of divs are larger than the screen size 
    if(totalHeight < windowHeight()){
        $(document.getElementById("WebBottomContainer")).height(windowHeight()-totalHeight -35);
    }  
     
}

function getTotalDivHeight()
{
    var totalHeight = 0;
    totalHeight += $(document.getElementById("WebMainContainer")).height();
    return totalHeight;
}

function windowHeight() 
{
    var height = 0;
    if( typeof( window.innerHeight ) == 'number' ) {
    //Non-IE
    height = window.innerHeight;
    } else if( document.documentElement && document.documentElement.clientHeight ) {
    //IE 6+ in 'standards compliant mode'
    height = document.documentElement.clientHeight;
    } else if( document.body && document.body.clientHeight ) {
    height = document.body.clientHeight;                                                                                                                   }
    return parseInt(height);
}	

function firstItemInCartAlert($text)
{
    alert($text)
}

function validateDeliveryDate(field, message, todayInput, dateFormat) {
	var dateInput = $(field).val();
	if (dateInput == '') {
		return true;
	};
	try {
		var deliveryDate = $.datepicker.parseDate(dateFormat, dateInput);
		var todayDate = $.datepicker.parseDate(dateFormat, todayInput);
		if (deliveryDate < todayDate) {
			alert(message);
			$(field).val('');
			$(field).focus();
			return false;
		};
	}
	catch (err) {
		alert(message);
		$(field).val('');
		$(field).focus();
		return false;
	};
}
