function checkMore(id)
{
	/*for
	document.getElementById(id).checked=true;*/
}
function sh(id)
{
	
	innerPod = document.getElementById(parseInt(id) + 1);
	toggleButton = document.getElementById( parseInt(id) + 2 );
	titlePod = document.getElementById( parseInt(id) + 3 );
	
	if (innerPod.style.display == 'none')
	{
		// Show the content
		innerPod.style.display = 'block';
		
		toggleButton.src = "./layout/icons/expanded.gif";
		toggleButton.title = "Hide Pod Content";
		titlePod.style.marginBottom = '0px';
	}
		else 
	{
		// Hide the content
		innerPod.style.display = 'none';
		
		toggleButton.src="./layout/icons/collapsed.gif";
		toggleButton.title = "Show Pod Content";
		titlePod.style.marginBottom = '5px';
	}		
}


function checkAll(n)
	{
		for (i=1;i<=n;i++)
			{
				if (document.getElementById("all").checked==true) document.getElementById(i).checked=true;
															 else document.getElementById(i).checked=false;
			}
	}
	
// [ General Forms Checking Function 	] 
// [ Version 1.0			 		 	]
// Last Revision : fu5
// Revision Version : 2
// TO DO : 
// - Write short doc.
// ___________________________

function formCheck(form)
{
	// alert ('simulated error from ' + form);
	function highlight(what)
	{
		what.style.backgroundColor = "#FF9C00";
	}
	
	function unHighlight(what)
	{
		what.style.backgroundColor = "";
	}
	
	retval = true;
	
	for (i = 0; i < form.elements.length; i++)
	{
		itemType = form.elements[i].id.split("__", 1)[0];
		itemP    = form.elements[i];
		
		unHighlight(itemP)
		
		switch(itemType)
		{
			
			case "zip":
				if (itemP.value)
				{
					zipchk = itemP.value.split("-");
					if (zipchk.length > 2)
					{
						alert ("Invalid ZIP Code Detected. \nZIP codes have one dash at most");
						highlight(itemP);
						return false;
					}
					else
					{
						sum = 0;
						for (j in zipchk)
						{
							sum += zipchk[j].length;
							if (!Number(zipchk[j]) && (zipchk[j] != 0))
							{
								alert ("Invalid ZIP Code detected");
								highlight(itemP);
								return false;
							}
						}
						
						if (sum < 5) 
						{
							alert ("Invalid ZIP Code Detected. \nZIP must have at least 5 numbers");
							highlight(itemP);
							return false;
						}
					}
				}
				else
				{
					highlight(itemP);					
					retval = false;
				}
			break;
			
			case "email":
				//alert("E-mail Found : " + itemP.value);
				if (itemP.value)
				{
					mailchk = itemP.value.split("@");
					if (((mailchk.length != 2) && (mailchk.length != 0)) || (mailchk[1].split(".").length != 2))
					{
						alert ("Invalid e-mail format detected. \nE-mails should be : name@address.com (ie. johnsmith@yahoo.com)");
						highlight(itemP);					
						return false;
					}
				}
				else
				{
					highlight(itemP);					
					retval = false;
				}
			break;
			case "number":
				if (itemP.value)
				{
					if (!Number(itemP.value) && (itemP.value != 0))
					{
						alert ("Invalid numeric value detected. Please make sure that no invalid characters (such as $) were inputed");
						highlight(itemP);					
						return false;
					}
				}
				else
				{
					retval = false;
					highlight(itemP);					
				}
			break;
			case "text":
				if (!itemP.value)
				{
					retval = false;
					highlight(itemP);
				}
			break;
			case "password":
				if (!itemP.value)
				{
					retval = false;
					highlight(itemP);
				}
			break;
		}
		
//		alert(formAttr);
		
//		if (formAttr.length > 1) alert (formAttr);
		
/*		switch (formAttr[0])
		{
			case "email":
				alert("We got an email box");
			break;
		}
	}
	*/
	}
	if (retval)
		return true;
	else
	{
		alert("One or more required form fields were left empty. \nPlease make sure that all the required fields have values");
		return false;
	}
}
// ___________________________

function checkEmpty(errors)
	{
		if (document.signupForm.user.value.length<3)
			{
				alert(errors[0]);
				return false;
			}
			
		if ((document.signupForm.pass.value.length<4)||(document.signupForm.pass.value!=document.signupForm.pass2.value))
			{
				alert(errors[1]);
				return false;
			}
			
		if ((document.signupForm.email.value.length==0)||(document.signupForm.email.value!=document.signupForm.email2.value)||(document.signupForm.email.value.indexOf('@')==-1)||(document.signupForm.email.value.indexOf('.')==-1))
			{
				alert(errors[2]);
				return false;
			}
			
		if (document.signupForm.gender.value==0)
			{
				alert(errors[3]);
				return false;
			}

		if (document.signupForm.age.value==0)
			{
				alert(errors[4]);
				return false;
			}

		var extensions = /.jpg|.jpeg/;
		found = extensions.test(document.signupForm.photo.value.toLowerCase());
			
						
		if ((document.signupForm.photo.value.length==0)||(!found))
			{
				alert(errors[5]);
				return false;
			}			
		return true;
	}
function checkEP(errors)
	{
		if ((document.mf.newpass.value.length==0)||(document.mf.newpass2.value.length==0)||(document.mf.newpass.value!=document.mf.newpass2.value))
			{
				alert(errors[1]);
				return false;
			}
		return true;
	}

function checkEmpty2(fieldsToCheck)
{
	for (j = 0; j <= fieldsToCheck.length - 1; j++)
	{
		if (fieldsToCheck[j].value==0)
		{
			alert('One or more of the required fields were left empty');
			return false;
		}
	}
	return true;
}

function checkForm(fieldsToCheck)
{

	invalidChars = new Array('/', '?', '&', '"', "'", '*', '%', '$');

	for (j = 0; j <= fieldsToCheck.length - 1; j++)
	{
		if (fieldsToCheck[j].value==0)
		{
			alert('One or more of the required fields were left empty');
			return false;
		}

		whereToCheck = fieldsToCheck[j];
		
		for (i=0; i <= invalidChars.length - 1; i++)
		{
			if (whereToCheck.value.split(invalidChars[i]).length > 1)
			{
				alert('One or more of the required fields were contains invalid characters : ( ' + invalidChars[i] + ' )');
				return false;
			}
		}
	}
	return true;
}
function checkFormUpload()
	{

		var extensions = /.jpg|.jpeg/;		
		found = extensions.test(window.document.postPhoto.photo.value.toLowerCase());
		if (!found)
			{
				alert('Incorrect file type (only JPG files permitted)');
				return false;							
			}	
	}

function ShowHead(str)
{
document.writeln('                                <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="751" height="198" id="header" align="middle">');
document.writeln('                                        <param name="allowScriptAccess" value="sameDomain" />');
document.writeln('                                        <param name="movie" value="/layout/flash/header.swf?query=' + str + '" />');
document.writeln('                                        <param name="quality" value="high" />');
document.writeln('                                        <param name="bgcolor" value="#000000" />');
document.writeln('                                        <embed src="/layout/flash/header.swf?query=' + str + '" quality="high" bgcolor="#000000" width="751" height="198" name="header" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.writeln('                                </object>');

}