//print function
function print_page(){
	var noprint='Your Browser Does Not Appear to\nSupport the "Print" Function, Sorry.';
	if (window.print) {
		window.print();
	} else {
		alert(noprint);
	}
}

//gives user choice of web or downloadable pdf file
function which_version(depth, version_nu){
	msg = 'Because of some problems with how PDF files work,\n'+
			'I had to use a non-web PDF version to get the graphics\n'+
			'to look as bright as the PNG source files. This version takes\n' +
			'about 10-15 minutes to download over a dial-up modem, \n' +
			'it will look like nothing is happening, but it is.\n\n' +
			'Over broadband it takes a few seconds.\n\n' +
			'If you want to go ahead with the download, click on the \'OK\' button.\n\n'+
			'If you can\'t deal with waiting, or want to do it later,\n'+
			'Click the \'Cancel\' button. That will cancel the download.\n\n';
	msg2 = 'Because I couldn\'t get the colors bright enough\n' +
				'in the web pdf version, I made a non-web pdf file,\n' +
				'then zipped it. Once the file has downloaded\n' +
				'(choose the \'save to disk\' option on download), \n' +
				'just unzip it with a program like www.winzip.com.\n' +
				'\n' +
				'Hope you like it, thanks, Harald';

	/*if (confirm(msg))
	{
		location = depth + '\/images\/comics\/pdf\/' + version_nu + '.pdf';
	}
	else {}*/
	alert(msg2);
	location = depth + 'images\/comics\/pdf\/' + version_nu + '.zip';
}
// basic cookie code, from public domain version
// set time

function Get_Cookie(name) {
    var start = document.cookie.indexOf(name + "=");
    var len = start + name.length + 1;
    if ((!start) && (name != document.cookie.substring(0, name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";", len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len, end));
}

var today = new Date();
today.setTime(today.getTime());

function Set_Cookie(name, value, expires, path, domain, secure) {
	
	var expires_date = new Date(today.getTime() + (expires));

	document.cookie = name + "=" +escape(value) +
		( (expires) ? ";expires=" + expires_date.toGMTString() : "") + //expires.toGMTString()
		( (path) ? ";path=" + path : "") + 
		( (domain) ? ";domain=" + domain : "") +
		( (secure) ? ";secure" : "");
}
function Delete_Cookie(name, path, domain) {
    if (Get_Cookie(name)) document.cookie = name + "=" +
        ( (path) ? ";path=" + path : "") +
        ( (domain) ? ";domain=" + domain : "") +
        ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

//maintains xhtml compliance cause there is no embed tag
function moz_flash(depth,folder,file,css_id) {
		document.write('\<embed src="'+depth+'images\/'+folder+'\/'+file+'" id="'+css_id+'" type="application\/x-shockwave-flash"'+
			'pluginspace="http:\/\/www.macromedia.com\/shockwave\/download\/index.cgi\?P1_Prod_Version=ShockwaveFlash"\>\<\/embed\>');
}

function PopImagePage(url, window_size)
{
	var path, posx = 0, posy = 0;
	// use large default, small for custom stuff
	var sizex = 850, sizey = 670;
	
	if ( window_size == 'wide' ){
		sizex = 1150;
		sizey = 950;
		if ( screen.availWidth <= 1030 ){
			sizex = 950;
			sizey = 700;
		}
		else if ( screen.availWidth <= 800 ){
			sizex = 750;
			sizey = 550;
		}
	}

	topPos = 8;
	leftPos = 10;
	screen.availWidth <= 800 ? leftPos = 0: leftPos = 10;
	screen.availHeight <= 600 ? topPos = 0: topPos = 8;
	features = 'scrollbars=yes,toolbar=no,menubar=no,status=no,resizable=no, width=' + sizex + ',height=' + sizey + ',top=' + topPos + ',left= ' + leftPos;

	var popupWindow = window.open(url, 'imagewindow', features );
	popupWindow.focus();
}

// make static global
var displayStatus = 'block';
var clickStatus = 'show';
// main tools for show / hide behavior
function onoffswitch(which_id)
{
// 	alert('helloworld');
	var whichItem = 'item-' + which_id;
	
	if ( displayStatus == 'none' ) {
		displayStatus = 'block';
		clickStatus = 'hide';
	}
	else {
		displayStatus = 'none';
		clickStatus = 'show';
	}
// 	alert(displayStatus);
	document.getElementById( whichItem ).style.display=displayStatus; 
	document.getElementById('open-close-status').innerHTML="(" + clickStatus + ")";
}



