
function dspimg(img, width, height)
{
	win = window.open('', 'image', 'width=750 height=1000 scrollbars=yes,left=50,top=50');
	win.location.reload( true );
	win.document.write('<body bgcolor="Black">');
	win.document.write('<br>');
	win.document.write('<center>');
	win.document.write('<a href="javascript:window.print()">Send To Printer</a>');
	win.document.write('<br>');
	win.document.write('<br>');
	win.document.write('<img src="/'+img+'">');
	win.document.write('<center>');
	win.document.close(); 
}

function dspphoto(img)
{
	win = window.open('', 'image', 'width=775,height=650,scrollbars=yes,left=50,top=50');
	win.document.write('<body bgcolor="Black">');
	win.document.write('<br>');
	win.document.write('<center>');
	win.document.write('<a href="javascript:window.close()"><font size=4 color="white"><b>Close Window</b></font></a>');
	win.document.write('<br><br>');
	win.document.write('<img src="/photos/'+img+'">');
	win.document.write('<center>');
	win.document.close();
}

function dsphtmlpage(page)
{
	win = window.open(page, 'image', 'width=775,height=700,scrollbars=yes,left=50,top=50');
}

function dspcal()
{
	win = window.open('/calendar.html', 'image', 'width=290 height=225 scrollbars=no,left=50,top=50');
}

function formatCurrency(num) 
{
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
		num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
		cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+
		num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + num + '.' + cents);
}

function goback(preurl)
{
	if (preurl == "") 
		document.location = "home.html";
	else
		location.href = "http://www.claytonsclub.com/"+preurl;
}

function writePics()
{
	document.write("<table width=100%>");
	for(var i = 1; i < totPics; i++)
	{
		document.write("<tr><td>");
		imgSrc = folder+"pic"+i+".jpg";
		document.write("<img border='2' width='360' border=0 name='test' src='"+imgSrc+"'><br>")
		
		i++;
		if (i < totPics)
		{
			document.write("</td><td>");
			imgSrc = folder+"pic"+i+".jpg";
			document.write("<img border='2' width='360' border=0 name='test' src='"+imgSrc+"'><br>")
		} 
		document.write("</td></tr>");
	}
	document.write("</table>");
}

function webHunt()
{
	win = window.open('/servlet/WebHunt', 'image', 'width=350,height=450,scrollbars=yes,left=50,top=50');
	win.document.close();
}

function chkpw()
{
	if (document.pwchk.password.value == 'ramsey') {
		location.href= "admin.html";
	} else
	{
		location.href="home.html";
	}
	return true;
}

function dspvideo(vid)
{
	win = window.open('', 'image', 'width=775,height=650,scrollbars=yes,left=50,top=50');
	win.document.write('<body bgcolor="Black">');
	win.document.write('<br>');
	win.document.write('<center>');
	win.document.write('<a href="javascript:window.close()"><font size=4 color="white"><b>Close Window</b></font></a>');
	win.document.write('<br><br>');
	win.document.write('<object id="WMPlayer1" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"> ');
	win.document.write('<param name="uiMode" value="full" /> ');
	win.document.write('<param name="autoStart" value="true" />');
	win.document.write('<param name="URL" value="/video/'+vid+'" />  ');
	win.document.write('Your browser does not support ActiveX controls or the Windows Media Player. ');
	win.document.write('</object>');
	win.document.write('</center>');
	win.document.close();
}

function processVerify() 
{
	var itemSelected = false;
	if (document.verify.cnt.value > 1)
	{
		for (var i = 0; i < document.verify.sel.length; i++) {
			if (document.verify.sel[i].checked)
			{
				itemSelected = true;
			}
		}
	} else
	{
		if (document.verify.sel.checked)
		{
			itemSelected = true;
		}
	}
	if (itemSelected)
	{
		document.verify.submit();	
	} else { 
		alert("No Selections!!");
		return false;
	}
}

function isValidDate(dateStr) {
// Date validation function courtesty of 
// Sandeep V. Tamhankar (stamhankar@hotmail.com) -->

// Checks for the following valid date formats:
// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY

var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/; // requires 4 digit year

var matchArray = dateStr.match(datePat); // is the format ok?
if (matchArray == null) {
alert(dateStr + " Date is not in a valid format.")
return false;
}
month = matchArray[1]; // parse date into variables
day = matchArray[3];
year = matchArray[4];
if (month < 1 || month > 12) { // check month range
alert("Month must be between 1 and 12.");
return false;
}
if (day < 1 || day > 31) {
alert("Day must be between 1 and 31.");
return false;
}
if ((month==4 || month==6 || month==9 || month==11) && day==31) {
alert("Month "+month+" doesn't have 31 days!")
return false;
}
if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day>29 || (day==29 && !isleap)) {
alert("February " + year + " doesn't have " + day + " days!");
return false;
   }
}
return true;
}