/*
########################################
# (c) by Ing. Robert Graf
# Product : Housemusic Online
# File ...: Programs/http/JavaScript/My.js
# Language: JavaScript
# Author .: Ing. Robert Graf
# Version : 2007-06-06
########################################
*/

/*
########################################
# My.js
########################################
*/

function GetCSSFontSizeDef ()
{
	var ScreenWidth = screen.width;
	var FS11 = 11;

	if (ScreenWidth)
	{
		//if      (ScreenWidth >= 1920) FS11 = 16; // 21"
		//else if (ScreenWidth >= 1600) FS11 = 15; // 21"
		if      (ScreenWidth >= 1920) FS11 = 12; // wide screen
		else if (ScreenWidth >= 1600) FS11 = 12; // wide screen
		else if (ScreenWidth >= 1440) FS11 = 12; // wide screen
		else if (ScreenWidth >= 1280) FS11 = 12; // 19"
		else if (ScreenWidth >= 1152) FS11 = 12; // 17"
		else if (ScreenWidth >= 1024) FS11 = 11; // 17"
		else if (ScreenWidth >= 800)  FS11 = 10; // 15"
		else                          FS11 =  9; // 15"
	}

	var FS10 = Math.max(Math.round(FS11 * 0.9),9);
	var FS9  = Math.max(Math.round(FS11 * 0.81),9);

	// Return
	return (
		'.FS11 {font-size:' + FS11 + 'px !important;}\n' +
		'.FS10 {font-size:' + FS10 + 'px !important;}\n' +
		'.FS9  {font-size:' + FS9  + 'px !important;}');
}


/*
########################################
# Cookie.js
########################################
*/

function SetCookie (Name, Value, MaxAge, Options)
{
	// Default parameters
	if (Options == undefined) {Options = {};}

	// 'Max-Age' isn't supported by MSIE 6 & 7, so the old 'Expires' will be used
	var dt = new Date();
	dt.setTime(dt.getTime() + (MaxAge * 1000));

	// Set cookie fields
	document.cookie = Name + '=' + escape(Value) +
		// '; Max-Age=' + escape(MaxAge) +
		'; Expires=' + dt.toGMTString() +
		((Options.Comment) ? '; Comment=' + escape(Options.Comment) : '') +
		((Options.Domain) ? '; Domain=' + escape(Options.Domain) : '') +
		((Options.Path) ? '; Path=' + escape(Options.Path) : '') +
		((Options.Secure) ? '; Secure' : '') +
		'; Version=1';

	// Return
	return (IsCookie(Name));
}


function IsCookie (Name)
{
	// Return
	return ((document.cookie.match(Name) == Name) ? true : false);
}


function GetCookie (Name)
{
	// Get value
	var Results = document.cookie.match(Name + '=(.*?)(;|$)');

	// Return
	return ((Results) ? unescape(Results[1]) : null);
}


function DeleteCookie (Name, Options)
{
	// Default parameters
	if (Options == undefined) {Options = {};}

	// Return
	return (IsCookie(Name) ? SetCookie(Name, null, 0, Options) : true);
}


/*
########################################
# EOF
########################################
*/
