//Opens smaller window for the Waterphone Story on the About page
function waterphoneStory() {
	window.open("story.php","_blank","width=795,height=595,top=5,left=5,location=no,menubar=no,scrollbars=yes");
}
//Opens smaller window for the Waterphone Story on the About page
function samplesBio(name) {
	window.open("samplesBio_" + name + ".php","_blank","width=500,height=600,top=5,left=5,location=no,menubar=no,scrollbars=yes");
}
//Opens smaller window for the About Prices page
function aboutPrices() {
	window.open("pricesAbout.php","_blank","width=500,height=585,top=5,left=5,location=no,menubar=no,scrollbars=no");
}
//Opens CDs window
function windowCD(cdname) {
	window.open("cd" + cdname + ".php","_blank","width=800,height=600,top=0,left=0,location=no,menubar=no,scrollbars=yes");
}

//Open photos in seperate window
function photoFull(location) {
	window.open(location,"_blank","location=no,menubar=no,scrollbars=yes,status=no,titlebar=no,toolbar=no");
}

//Only allows numbers in textboxes
function checkIt(evt) {
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        return false
    }
    return true
}

//clear cookies for buy page
function cookiesClear() {
	var mydate = new Date();
	mydate.setTime(mydate.getTime() - 1);
	document.cookie = "name=; expires=" + mydate.toGMTString(); 
	document.cookie = "price1=; expires=" + mydate.toGMTString(); 
	document.cookie = "price2=; expires=" + mydate.toGMTString(); 
	document.cookie = "shipping1=; expires=" + mydate.toGMTString(); 
	document.cookie = "shipping2=; expires=" + mydate.toGMTString(); 
}

//Shows text for Got Photo? link on Photos page
function showPhotoInfo() {
	document.getElementById('photoText').innerHTML = "<div align='left'>If you have an interesting photo(s) that contains one of my waterphones (or another instrument I make being played), and would like it considered for this page, feel free to email it to me in .jpeg format to <a href='mailto:richard@richardawaters.com' class='link1'>richard@richardawaters.com.</a></div>";
}

//Confirm reset button on contact page
function resetConfirm() {
	var r=confirm("Are you sure you want to clear every field?");
	if (r==true) {
		document.forms.contactForm1.reset();
	} else {
	}
}

//Don't accept double quotes in contact field
function checkIt2(evt) {
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    if (charCode == 34) {
		alert("Sorry, you can't use double quotes in this textbox, as it causes an unknown error. Please use single quotes instead.");
        return false
    }
    return true
}

//Show more on Competition page about previous winners
function showMore(name) {
		window.open("oldCompetition.php?name=" + name,"_blank","width=600,height=500,location=no,menubar=no,scrollbars=yes,status=no,titlebar=no,toolbar=no");
	}