function writeSWFButton(title, url, active)
{
	var swf = "";
	var params = '';
	
	var ncolor;
	ncolor = (color == '') ? '0099ff' : color;
	
	params += "?ntitle=" + title;
	params += "&nbg=" + ncolor;
	params += "&nurl=" + url;
	params += "&nactive=" + active;
	
	swf +="<div>\n";

	// let's see how this goes...
	//swf +="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"150\" height=\"29\">\n";
	//swf +="<param name=\"movie\" value=\"/imgs/nav3.swf" + params + "\">\n";
	//swf +="<param name=\"quality\" value=\"high\">\n";
	//swf +="<param name=\"salign\" value=\"tl\">\n";
	//swf +="<param name=\"bgcolor\" value=\"#ffffff\">\n";
	//swf +="<param name=\"wmode\" value=\"transparent\">\n";
	//swf +="<param name=\"menu\" value=\"false\">\n";
	//swf +="<embed src=\"/imgs/nav3.swf" + params + "\" width=\"150\" height=\"29\" quality=\"high\" salign=\"tl\" menu=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></embed>\n";
	//swf +="</object>\n";
	//swf +="</div>\n";

	swf +="<object type='application/x-shockwave-flash' data=\"/imgs/nav3.swf" + params + "\" width='150' height='29'>\n";
	swf +="<param name='movie' value=\"/imgs/nav3.swf" + params + "\" />\n";
	swf +="</object>\n";
	swf +="</div>\n";

	document.write(swf);
}

function changer(id)
{
	$('ul#ultra-bet li').each( function() 
	{ 
		var $this = $(this);	
		($this.html() == alph) ? alert(alph) : '';
	});
}

$(document).ready(function()
{
	$('#ultra-promo').after('<div id="navvy">').cycle({
        	fx:     'fade',
        	pause:  1,
        	pager:  '#navvy',
		delay: 5000
	});

	$("#also-on-site").load("/script/also.script.php");
});

function show_tracks(id)
{
	$('#tracks' + id).toggle();
}

var welcome;

function get_mail_parts(isrc)
{
	var t = "<table id='mailer' cellpadding='0' cellspacing='5' border='0'>\n";
	t +="<tr>\n";
	t +="<td valign='top' class='mailer-left'>Send To</td>\n";
	t +="<td valign='top' class='mailer-right'><textarea id='sendto' style='width: 250px; height: 35px;'></textarea></td>\n";
	t +="</tr>\n";
	t +="<tr>\n";
	t +="<td valign='top' class='mailer-left'>Your Name</td>\n";
	t +="<td valign='top' class='mailer-right'><input id='yourname' type='text' style='width: 250px;' maxlength='35' /><input id='h_isrc' type='hidden' value='" + isrc + "' /></td>\n";
	t +="</tr>\n";
	t +="<tr>\n";
	t +="<td valign='top' class='mailer-left'>&nbsp;</td>\n";
	t +="<td valign='top' class='mailer-right'><input type='button' onclick=\"sendmail(); return false;\" value='Submit' />\n";
	t +="<p><br />All fields are required.<br />Separate multiple recipients with a comma.</p></td>\n";
	t +="</tr>\n";
	t +="</table>\n";

	return t;
}


function sendmail()
{
	var sendto = $('textarea#sendto').val();
	var yourname = $('input#yourname').val();
	//var youremail =  $('input#youremail').val();
	//var message = $('textarea#message').val();
	var h_isrc = $('input#h_isrc').val();
	
	$.post('/script/sendmail.script.php', { a: sendto, b: yourname, e: h_isrc }, 
		function(html) {
			if (html == 'success')
			{
				$('textarea#sendto').val('');
				$('input#yourname').val('');
				$('input#h_isrc').val('');

				$('#video-send').toggle();

				alert('Your note was sent.');
			}
			else
			{
				alert('There is an error, please check your inputs.');
			}
	});
}


function open_box(isrc)
{
	$('#video-send').toggle();

	if ($('#video-send-parts').html() == '')
	{
		$('#video-send-parts').html(get_mail_parts(isrc));
	}

	return false;
}


function OpenWindow(mypage, myname, w, h, scroll)
{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	
	winprops = 'height='+h+', width='+w+', top='+wint+', left='+winl+', scrollbars='+scroll+', resizable';
	win = window.open(mypage, myname, winprops);
	
	if (parseInt(navigator.appVersion) >= 4) 
	{ 
		win.window.focus();
	}
}
