function pop_position (w,h)
	{
	var WindowWidth=0, WindowHeight=0;

	if (typeof( window.innerWidth) == 'number')
		{
	    //Non-IE
	    WindowWidth = window.innerWidth;
	    WindowHeight = window.innerHeight;
	    }
	else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
		{
		//IE 6+ in 'standards compliant mode'
		WindowWidth = document.documentElement.clientWidth;
		WindowHeight = document.documentElement.clientHeight;
		}
	else if (document.body && (document.body.clientWidth || document.body.clientHeight))
		{
		//IE 4 compatible
		WindowWidth = document.body.clientWidth;
		WindowHeight = document.body.clientHeight;
		}

	l=(WindowWidth-w)/2;
	t=((WindowHeight-h)/2)+55;

	return ('left='+l+',top='+t+',width='+w+',height='+h);
	}

function pop_img(url,w,h,lang)
	{
	h = h + 50;
	w = w + 15;
	file = 'pop/photos.php?pic=' + url + "&l=" + lang;
	popwin=window.open(file,'',pop_position(w,h)+',personal=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0');
	}

function pop_video(video,format,lang)
	{
	if(format == 'mov') {
		w = 480;
		h = 360 + 15;
	} else {
		w = 320;
		h = 240 + 43;
	}
	file = 'pop/videos.php?video=' + video + '&format=' + format + "&l=" + lang;
	popwin=window.open(file,'',pop_position(w+10,h+50)+',personal=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0');
	}

function pop_lyrics(lyric, lang)
	{
	w = 400;
	h = 500;
	file = 'pop/lyrics.php?lyric=' + lyric + "&l=" + lang;
	popwin=window.open(file,'',pop_position(w,h)+',personal=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,copyhistory=0');
	}

function pop_mp3(song)
	{
	w = 320;
	h = 100;
	url = 'pop/song.php?song=' + song;
	popwin=window.open(url,'',pop_position(w,h)+',personal=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0');
	}

function pop_cdinfo(cd, lang)
	{
	w = 600;
	h = 500;
	file = 'pop/' + cd + '.php?l=' + lang;
	popwin=window.open(file,'',pop_position(w,h)+',personal=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,copyhistory=0');
	}

function pop_shipping(cd, lang)
	{
	w = 500;
	h = 275;
	file = 'pop/shipping.php?l=' + lang + '&cd=' + cd;
	popwin=window.open(file,'',pop_position(w,h)+',personal=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0');
	}

function pop_mlist(act,lang)
	{if(act == 'add') {
		h = 200;
	} else {
		h = 175;
	} w = 400;

	file = 'pop/list_' + act + '.php?l=' + lang;
	popwin=window.open(file,'',pop_position(w,h)+',personal=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0');
	}

function Validate_String(string, return_invalid_chars)
	{
	valid_chars = '1234567890-_.^~abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
	invalid_chars = '';

	if(string == null || string == '') {
		return(true);
	}

	//For every character on the string.
	for(index = 0; index < string.length; index++)
		{
		chars = string.substr(index, 1);

		//Is it a valid character?
		if(valid_chars.indexOf(chars) == -1)
			{
			//If not, is it already on the list of invalid characters?
			if(invalid_chars.indexOf(chars) == -1)
				{
				//If it's not, add it.
				if(invalid_chars == '')
					{
					invalid_chars += chars;
					}
				else
					{
					invalid_chars += ', ' + chars;
					}
				}
			}
		}

	//If the string does not contain invalid characters, the function will return true.
	//If it does, it will either return false or a list of the invalid characters used
	//in the string, depending on the value of the second parameter.
	if(return_invalid_chars == true && invalid_chars != '')
		{
		last_comma = invalid_chars.lastIndexOf(',');

		if(last_comma != -1)
			{
			invalid_chars = invalid_chars.substr(0, $last_comma) + ' and ' + invalid_chars.substr(last_comma + 1, invalid_chars.length);

			return(invalid_chars);
			}
		}
	else
		{
		return(invalid_chars == '');
		}
	}
function Validate_Email_Address(email_address)
	{
	//Assumes that valid email addresses consist of user_name@domain.tld
	at = email_address.indexOf('@');
	dot = email_address.lastIndexOf('.');

	if(at == -1 || dot == -1 || dot <= at + 1 || dot == 0 || dot == email_address.length - 1)
		return(false);

		user_name = email_address.substr(0, at);
		domain_name = email_address.substr(at + 1, email_address.length);

		if(Validate_String(user_name) === false || Validate_String(domain_name) === false)
			return(false);

	return(true);
	}

function Validate()
	{
	valid = Validate_Email_Address(document.addemailf.eEmail.value);
		if(valid == true && document.addemailf.eName.value != '')
			document.addemailf.add.disabled=false;
		else
			document.addemailf.add.disabled=true;
	}

function Validate_del()
	{
	valid = Validate_Email_Address(document.delemailf.eEmail.value);
		if(valid == true)
			document.delemailf.del.disabled=false;
		else
			document.delemailf.del.disabled=true;
	}

function Validate_Contact()
	{
	valid = Validate_Email_Address(document.contactf.eEmail.value);
		if(valid == true && document.contactf.eName.value != '' && document.contactf.eMsg.value != '')
			document.contactf.send.disabled=false;
		else
			document.contactf.send.disabled=true;
	}

function closeThisWindow(){
	setTimeout(closeit,2000);
}
function closeit(){
	self.close();
}
function calculateShipping(){
	//if regular
	if(document.shipForm.mailing[0].checked){
		price = regularShipping();
	//express
	}else{
		price = expressShipping();
	}
	document.shipForm.shipping.value = price;
}
function regularShipping(){
	//if canada
	if(document.shipForm.country[0].checked){
		return '2.02';
	//if usa
	}else if(document.shipForm.country[1].checked){
		return '4.20';
	}
	//international
	return '7.25';
}
function expressShipping(){
	//if canada
	if(document.shipForm.country[0].checked){
		return '8.85';
	//if usa
	}else if(document.shipForm.country[1].checked){
		return '14.96';
	}
	//international
	return '16.98';
}