﻿function setCookie(name, value, expires)
{
	var date = new Date();
	date.setDate(date.getDate() + expires);
	document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : ";expires=" + date.toGMTString() + "; path=/");
}

function getCookie(name)
{
	if (document.cookie.length > 0)
	{
		var start = document.cookie.indexOf(name + "=");
		if (start != -1)
		{ 
			start += name.length + 1; 
			var end = document.cookie.indexOf(";", start);
			if (end == -1)
				end = document.cookie.length;
			
			return unescape(document.cookie.substring(start, end));
		} 
	}

	return "";
}

function GetStyle(obj, property)
{
	///<summary>Gets the style property value of the passed object</summary>
	///<param name="obj" type="object">The object containing the desired style property</param>
	///<param name="property" type="string">The style property to retrieve, ex: width, margin-left</param>
	///<returns>string</returns>

	var nonComputedProperty = "";
	var style = null;
	
	var elements = property.split("-");
	for (var i = 0; i < elements.length; i++)
	{
		var element = elements[i];
		if (i ==0)
		{
			nonComputedProperty += element;
		}
		else
		{
			nonComputedProperty += element.substring(0, 1).toUpperCase() + element.substring(1, element.length);
		}
	}

	if (obj.currentStyle)
	{
		style = obj.currentStyle[nonComputedProperty];
	}
	else if (window.getComputedStyle)
	{
		style = document.defaultView.getComputedStyle(obj, null).getPropertyValue(property);
	}
	
	return style;
}