function MM_openBrWindow(theURL,winName,features) 
{ 
  window.open(theURL,winName,features);
}


function changephoto(pic,w,h)
{
   	document.large.src=pic;
   	document.large.width=w;
   	document.large.width=h;
}

function changeicon(photoid,pic)
{
	document.getElementById(photoid).src = "images/"+pic;
   	//document.photoicon.src = "images/"+pic;
}

function checkcatalogue()
{
	if (document.catalogueform.catname.value == "")
	{
		alert("Please input catalogue name!");
		return false;
	}
	else
		return true;
	
}

function checkproduct()
{
	if (document.productform.pcode.value == "")
	{
		alert("Please input product code!");
		return false;
	}
	else if (document.productform.pname.value == "")
	{
		alert("Please input product name!");
		return false;
	}
	else if (document.productform.pprice.value == "")
	{
		alert("Please input product price!");
		return false;
	}
	else
		return true;
	
}

function checklogin(code)
{
	if (code == 1)
	{
		if (document.registration.loginid.value == "")
		{
			alert("Please input LoginID!");
			return false;
		}
		else if (document.registration.newpassword.value == "")
		{
			alert("Please input Password!");
			return false;
		}
		else if (document.registration.repassword.value == "")
		{
			alert("Please input Confirm Password!");
			return false;
		}
		else if (document.registration.repassword.value != document.registration.newpassword.value)
		{
			alert("Invalid Re-enter New Password. Please check it and input again");
			return false;
		}
	}
	else if (code == 2)
	{
		if (document.registration.oldpassword.value == "")
		{
			alert("Please input Old Password!");
			return false;
		}
		else if (document.registration.newpassword.value == "")
		{
			alert("Please input Password!");
			return false;
		}
		else if (document.registration.repassword.value == "")
		{
			alert("Please input Confirm Password!");
			return false;
		}
		else if (document.registration.repassword.value != document.registration.newpassword.value)
		{
			alert("Invalid Re-enter New Password. Please check it and input again");
			return false;
		}
	}
	if (code != 2)
	{
		if (document.registration.firstname.value == "")
		{
			alert("Please input First Name!");
			return false;
		}
		else if (document.registration.email.value == "")
		{
			alert("Please input Email!");
			return false;
		}
		else if (document.registration.address.value == "")
		{
			alert("Please input Address!");
			return false;
		}
	}
	return true;
	
}