function getCookie(NameOfCookie){
    if (document.cookie.length > 0) {              
		begin = document.cookie.indexOf(NameOfCookie+"=");       
		if (begin != -1) {           
			begin += NameOfCookie.length+1;       
			end = document.cookie.indexOf(";", begin);
		if (end == -1) end = document.cookie.length;
			return unescape(document.cookie.substring(begin, end));
		} 
	}
	return null;
}

function setCookie(NameOfCookie, value, expiredays) {
	var ExpireDate = new Date();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

	document.cookie = NameOfCookie + "=" + escape(value) + 
	((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

function delCookie (NameOfCookie) {
  if (getCookie(NameOfCookie)) {
    document.cookie = NameOfCookie + "=" +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function getStyle() {
	Style=getCookie('Style');

	switch (Style) {
		case 'blue':
			document.write("<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/blue/style.css\" />");
			break;
		case 'grey':
			document.write("<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/grey/style.css\" />");
			break;
		case 'green':
			document.write("<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/green/style.css\" />");
			break;
		case 'orange':
			document.write("<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/orange/style.css\" />");
			break;
		case 'purple':
			document.write("<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/purple/style.css\" />");
			break;
		case 'white':
			document.write("<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/white/style.css\" />");
			break;
		default:
			document.write("<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/blue/style.css\" />");
			break;
	}
}

function getImage() {
	Style=getCookie('Style');

	switch (Style) {
		case 'blue':
			document.write("<img class=\"header_logo\" alt=\"\" src=\"style/blue/logo.jpg\" />");
			break;
		case 'grey':
			document.write("<img class=\"header_logo\" alt=\"\" src=\"style/grey/logo.jpg\" />");
			break;
		case 'green':
			document.write("<img alt=\"\" src=\"style/green/logo.jpg\" />");
			break;
		case 'orange':
			document.write("<img class=\"header_logo\" alt=\"\" src=\"style/orange/logo.jpg\" />");
			break;
		case 'purple':
			document.write("<img class=\"header_logo\" alt=\"\" src=\"style/purple/logo.jpg\" />");
			break;
		case 'white':
			document.write("<img class=\"header_logo\" alt=\"\" src=\"style/white/logo.jpg\" />");
			break;
		default:
			document.write("<img class=\"header_logo\" alt=\"\" src=\"style/blue/logo.jpg\" />");
			break;
	}
}

function open_image(url, width, height) {
	if(url.length > 1 && width  > 0 && height  > 0) {
		window.open(url, 'image', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizeable=auto,width=' + width + ',height=' + height);
	}
}