﻿// JScript File
if (document.domain != 'smoothjazzy.blogspot.com') {
var qs = new Querystring();
var cl2 = qs.get("b");
var bc = 'black';	

if (cl2 != null) {
	bc = cl2;
} else {
	var cook2 = readCookie('jazzybgcolor');
	
	if (cook2 != null) {
		bc = cook2;
	}
}	

document.write('<style type="text/css">body {background-color:' + bc + ';}</style>');
}


function doHeader(msg, site, pageName, color) {
//check for the color preference, query string, then cookie
var qs = new Querystring();
var cl = qs.get("c");
var cp = 'Lime';
var cl2 = qs.get("b");
var bc = 'black';

if (cl != null) {
	cp = cl;
} else {
	var cook = readCookie('jazzycolor');
	
	if (cook != null) {
		cp = cook;
	}
}

if (cl2 != null) {
	bc = cl2;
} else {
	var cook2 = readCookie('jazzybgcolor');
	
	if (cook2 != null) {
		bc = cook2;
	}
}	

document.write('<table style="background-color:' + bc + '; color: ' + cp + ';font-family: Arial;border-style: solid; border-color: ' + cp + ';border-width: thin;text-align: center;vertical-align: text-top;font-size: 50px;" width="760px" cellpadding="2px" cellspacing="0px">');
document.write('<tr><td colspan="8">');
document.write(site);
document.write('</td></tr>');
document.write('<tr><td style="font-size: 14px" colspan="8">');
document.write(msg);
document.write('</td></tr><tr>');

if (pageName == 'home') {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:13%"><a href="http://www.smoothjazzy.com/index.html" style="text-decoration:none">{Home}</a><br/>Last Update--></td>');
} else {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:13%"><a href="http://www.smoothjazzy.com/index.html" style="text-decoration:none">Home</a><br/>Last Update--></td>');
}

if (pageName == 'america') {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:17%"><a href="http://www.smoothjazzy.com/america.html" style="text-decoration:none">{America\'s T-Girl&trade;?}</a><br/>');
} else {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:17%"><a href="http://www.smoothjazzy.com/america.html" style="text-decoration:none">America\'s T-Girl&trade;?</a><br/>');
}

document.write(date_america());
document.write('</td>');

if (pageName == 'blog') {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:11%"><a href="http://smoothjazzy.blogspot.com/" style="text-decoration:none">{Blog}</a><br/>');
} else {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:11%"><a href="http://smoothjazzy.blogspot.com/" style="text-decoration:none">Blog</a><br/>');
} 

document.write(date_blog());
document.write('</td>');

if (pageName == 'myspace') {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:12%"><a href="http://www.smoothjazzy.com/myspace.html" style="text-decoration:none">{MySpace}</a><br/>');	
} else {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:12%"><a href="http://www.smoothjazzy.com/myspace.html" style="text-decoration:none">MySpace</a><br/>');	
}

document.write(date_myspace());
document.write('</td>');

if (pageName == 'tranny') {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:12%"><a href="http://www.smoothjazzy.com/tranny.html" style="text-decoration:none">{Tranny}</a><br/>');
} else {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:12%"><a href="http://www.smoothjazzy.com/tranny.html" style="text-decoration:none">Tranny</a><br/>');
}

document.write(date_tranny());
document.write('</td>');

if (pageName == 'programming') {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:13%"><a href="http://www.smoothjazzy.com/programming.html" style="text-decoration:none">{Programming}</a><br/>');
} else {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:13%"><a href="http://www.smoothjazzy.com/programming.html" style="text-decoration:none">Programming</a><br/>');
}

document.write(date_programming());
document.write('</td>');

if (pageName == 'fun') {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:13%"><a href="http://www.smoothjazzy.com/fun.html" style="text-decoration:none">{Having Fun}</a><br/>');
} else {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:13%"><a href="http://www.smoothjazzy.com/fun.html" style="text-decoration:none">Having Fun</a><br/>');
}

document.write(date_fun());
document.write('</td>');

if (pageName == 'photos') {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:9%"><a href="http://www.smoothjazzy.com/photos.html" style="text-decoration:none">{Photos}</a><br/>');
} else {
	document.write('<td style="font-size: 12px;border-top: solid thin ' + cp + ';text-align: center;width:9%"><a href="http://www.smoothjazzy.com/photos.html" style="text-decoration:none">Photos</a><br/>');
}

document.write(date_photos());
document.write('</td></tr></table>');

if (pageName != 'blog') {
	document.write('<table style="color:' + cp + ';background-color:' + bc + '; font-family: Arial; text-align: right; vertical-align: text-top" width="760px" cellpadding="2px" cellspacing="0px"><tr><td style="font-size: 9px; text-align: right"><b>Don\'t like these <span style="color:Red">c</span><span style="color:#FF5500">o</span><span style="color:Green">l</span><span style="color:Blue">o</span><span style="color:Yellow">r</span><span style="color:Fuchsia">s</span><span style="color:White">?</span> <a href="color_confirm.html">Change them.</a></b></td></tr></table>');
	document.write('<span style="color:' + cp + '">');
	document.write('<table style="background-color:' + bc + '; font-family: Arial; vertical-align: text-top" width="760px" cellpadding="0px" cellspacing="0px"><tr><td>');
}

}

function date_america() {
	return '08.17.06';
}

function date_blog() {
	return '*Often*';
}
function date_myspace() {
	return '07.30.06';
}
function date_tranny() {
	return '1.07.07';
}
function date_programming() {
	return '12.20.06';
}
function date_fun() {
	return '03.05.07';
}
function date_photos() {
	return '10.15.06';
}

function doFooter(msg, site) {
var qs = new Querystring();
var cl = qs.get("c");
var cp = 'Lime';
var cl2 = qs.get("b");
var bc = 'black';

if (cl != null) {
	cp = cl;
} else {
	var cook = readCookie('jazzycolor');
	
	if (cook != null) {
		cp = cook;
	}
}	

if (cl2 != null) {
	bc = cl2;
} else {
	var cook2 = readCookie('jazzybgcolor');
	
	if (cook2 != null) {
		bc = cook2;
	}
}	

if(document.domain == 'www.smoothjazzy.com' || document.domain == 'localhost') {
	document.write('</td></tr></table>');
}
document.write('</span><table style="background-color:' + bc + '" cellpadding="2px" cellspacing="0px" width="760px"><tr><td style="background-color:' + bc + '; color:' + cp + '; font-family: Arial; font-size: 10px; text-align: center;" colspan="20">note: If you came here looking for the coolest smooth jazz stream ever, you missed it by one character, but here it is - <a href="http://www.smoothjazz.com">www.smoothjazz.com</a></td></tr>');
document.write('<tr><td style="background-color:' + bc + '; color:' + cp + '; font-family: Arial; font-size: 10px; text-align: center;" colspan="20">&copy; 2006 Jasmine D. Adamson, Supernova Software - <a href="http://www.smoothjazzy.com/color_change.html">Change User Preferences</a> - ');
document.write('Contact me on <a href="http://www.myspace.com/jasmine1971">Myspace</a> or on my <a href="http://smoothjazzy.blogspot.com/">blog</a><br/></td></tr></table>');
}

function doPhoto() {
	var qs = new Querystring();
	var cl = qs.get("img");
		
	document.write('<p><a href="'+document.referrer+'">&lt; Back</a></p>')
	
	if (cl != null) {
		document.write('<img alt="" src="images/' + cl + '" />');
	} else {
		document.write('Oops, an error occured.');
	}
}

function doVideo() {
	var qs = new Querystring();
	var cl = qs.get("img");
		
	document.write('<p><a href="'+document.referrer+'">&lt; Back</a></p>')
	
	if (cl != null) {
		document.write('<embed src="video/' + cl + '" controller="true" />');
	} else {
		document.write('Oops, an error occured.');
	}
}

//this section is all about the cookie
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toLocaleDateString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

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 eraseCookie(name)
{
	createCookie(name,"",-1);
}

/* Client-side access to querystring name=value pairs
	Version 1.2.3
	22 Jun 2005
	Adam Vandenberg
*/
function Querystring(qs) { // optionally pass a querystring to parse
	this.params = new Object()
	this.get=Querystring_get
	
	if (qs == null)
		qs=location.search.substring(1,location.search.length)

	if (qs.length == 0) return

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ')
	var args = qs.split('&') // parse out name/value pairs separated via &
	
// split out each name=value pair
	for (var i=0;i<args.length;i++) {
		var value;
		var pair = args[i].split('=')
		var name = unescape(pair[0])

		if (pair.length == 2)
			value = unescape(pair[1])
		else
			value = name
		
		this.params[name] = value
	}
}

function Querystring_get(key, default_) {
	// This silly looking line changes UNDEFINED to NULL
	if (default_ == null) default_ = null;
	
	var value=this.params[key]
	if (value==null) value=default_;
	
	return value
}

//this reads the form from the color-changer and puts the cookie
function colorFormSubmit() {
	//first read the color values from the query string
	var qs = new Querystring();
	var cl = qs.get("c");
	var cl2 = qs.get("b");
	
	if (cl != null) {
		createCookie('jazzycolor', cl, 3650);
	}

	if (cl2 != null) {
		createCookie('jazzybgcolor', cl2, 3650);
	}
	window.location="color_save.html";
}