function printPage()
{
    window.print();
}

function addedPopup()
{
    window.open("/popup-add.aspx","mywindow","resizable=0,width=400,height=100,toolbar=0,menubar=no,location=0,scrollbars=0,statusbar=0");
}

function createCookie(productId)
{
    var cookieValue = readCookie('holidayplannerproducts');
    var value;
    
    if (cookieValue){
    
        if (cookieValue.indexOf(productId) > -1)
        {
            return;
        }
        else value=cookieValue+','+productId;
    }
    else value=productId;
    

	var date = new Date();
	date.setTime(date.getTime()+(365*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();

	document.cookie = "holidayplannerproducts="+value+expires+"; path=/";
    
    getHolidayPlanner();
}

function readCookie(name)
{

    var nameEQ = name + "=";
	
	var ca = document.cookie.split(';');
	
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function removeCookie(productId)
{
    var cookieValue = readCookie('holidayplannerproducts');
    
    cookieValue = cookieValue.replace(productId+",", "")
    cookieValue = cookieValue.replace(","+productId, "")
    cookieValue = cookieValue.replace(productId, "")
    
    var date = new Date();
	date.setTime(date.getTime()+(365*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
    
    document.cookie = 'holidayplannerproducts=' + cookieValue + expires + '; path=/';
    
    getHolidayPlanner();
}

function removeCookieAlt(productId)
{
    var cookieValue = readCookie('holidayplannerproducts');
    
    cookieValue = cookieValue.replace(productId+",", "")
    cookieValue = cookieValue.replace(","+productId, "")
    cookieValue = cookieValue.replace(productId, "")
    
    var date = new Date();
	date.setTime(date.getTime()+(365*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
    
    document.cookie = 'holidayplannerproducts=' + cookieValue + expires + '; path=/';
    
    document.location = document.location.href
}
