// JavaScript Document
function viewCategory(catId,parentId)
	{
	window.location.href = 'index2.php?view=category&catId=' + catId + '&parentId=' + parentId;
	}

function viewProduct(catId,parentId,productId)
	{
	window.location.href = 'index2.php?view=product&catId=' + catId + '&parentId=' + parentId + '&productId=' + productId;
	}

function updateContact(userId)
	{
	window.location.href = 'index2.php?view=updatecontact&userId=' + userId ;
	}


function orderDetails(orderId)
{
	window.location.href = 'index2.php?view=orderdetails&orderId=' + orderId ;
}

function wishListDetails(wishlistId)
{
	window.location.href = 'index2.php?view=wishlistdetails&wishlistId=' + wishlistId;
}

function addCartForm()
{
	document.ProductForm.action="cart.php?action=addCart";
	document.ProductForm.submit();
}

function addWishlistForm()
{
	document.ProductForm.action="cart.php?action=addWishlist";
	document.ProductForm.submit();
}

function deleteWishlistForm()
{
	document.ProductForm.action="cart.php?action=DeleteWishlist";
	document.ProductForm.submit();
}

function Show(div1,div2,div3)
{
	var theDiv1 = document.getElementById(div1);
	var theDiv2 = document.getElementById(div2);
	var theDiv3 = document.getElementById(div3);
	
	if (theDiv1.style.display == 'none') {
		theDiv1.style.display = 'block';	
		theDiv2.style.display = 'none';
		theDiv3.style.display = 'none';
	}
}


function MM_swapImage() 
	{ //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
   }
 

var tblId;

function tableOver(tblId)
{
	var o1 = document.getElementById(tblId);
	o1.className = "tablerollover ";
}

function tableOut(tblId)
{
	var o1 = document.getElementById(tblId);
	o1.className = "tablerollout ";
}


function checkRegistrationForm()
{
    if(RegistrationForm.username.value=="")
	{
		alert("You must enter the User Name");
		RegistrationForm.username.focus();
		return false;
	}
	
	if(RegistrationForm.password.value=="")
	{
		alert("You must enter the Password");
		RegistrationForm.password.focus();
		return false;
	}

	if(RegistrationForm.repassword.value=="")
	{
		alert("You must enter the Confirm Password");
		RegistrationForm.repassword.focus();
		return false;
	}

	if(RegistrationForm.name.value=="")
	{
		alert("You must enter the First Name");
		RegistrationForm.name.focus();
		return false;
	}

	

	if(RegistrationForm.email.value=="")
	{
		alert("You must enter the Email Address");
		RegistrationForm.email.focus();
		return false;
	}

	if(RegistrationForm.contact.value=="")
	{
		alert("You must enter the Contact No.");
		RegistrationForm.contact.focus();
		return false;
	}

	if(RegistrationForm.address.value=="")
	{
		alert("You must enter the Address");
		RegistrationForm.address.focus();
		return false;
	}

	if(RegistrationForm.postal.value=="")
	{
		alert("You must select the State");
		RegistrationForm.postal.focus();
		return false;
	}

	
	else
		return true;
}


function checkCouponForm()
{
    if(CouponForm.name.value=="" || CouponForm.name.value=="Name")
	{
		alert("You must enter your name");
		CouponForm.name.focus();
		return false;
	}
	
	if(CouponForm.email.value=="" || CouponForm.email.value=="Email")
	{
		alert("You must enter valid e-mail address");
		CouponForm.email.focus();
		return false;
	}

	else
		return true;
}


function checkContactForm()
{
    if(ContactForm.subject.value=="")
	{
		alert("You must select any subject");
		ContactForm.subject.focus();
		return false;
	}
	
	if(ContactForm.name.value=="")
	{
		alert("You must enter your name");
		ContactForm.name.focus();
		return false;
	}

	if(ContactForm.email.value=="")
	{
		alert("You must enter email address");
		ContactForm.email.focus();
		return false;
	}

	if(ContactForm.message.value=="")
	{
		alert("You must enter message");
		ContactForm.message.focus();
		return false;
	}

	else

	return true;
}


function checkProductForm()
{
    if(ProductForm.qty.value=="")
	{
		alert("You must enter product qty");
		ProductForm.qty.focus();
		return false;
	}
	
	else
		return true;
}

function checkContactInformationForm()
{
    if(ContactInformationForm.firstname.value=="")
	{
		alert("You must enter your first name");
		ContactInformationForm.firstname.focus();
		return false;
	}
	
	if(ContactInformationForm.lastname.value=="")
	{
		alert("You must enter your last name");
		ContactInformationForm.lastname.focus();
		return false;
	}
	
	if(ContactInformationForm.phone.value=="")
	{
		alert("You must enter phone number");
		ContactInformationForm.phone.focus();
		return false;
	}

	if(ContactInformationForm.email.value=="")
	{
		alert("You must enter email address");
		ContactInformationForm.email.focus();
		return false;
	}

	return true;
}


function checkShippingInformationForm()
{
    if(ShippingInformationForm.name.value=="")
	{
		alert("You must enter ship to name");
		ShippingInformationForm.name.focus();
		return false;
	}
	
	if(ShippingInformationForm.address.value=="")
	{
		alert("You must enter address");
		ShippingInformationForm.address.focus();
		return false;
	}
	
	if(ShippingInformationForm.city.value=="")
	{
		alert("You must enter city");
		ShippingInformationForm.city.focus();
		return false;
	}

	if(ShippingInformationForm.state.value=="")
	{
		alert("You must enter state");
		ShippingInformationForm.state.focus();
		return false;
	}

	if(ShippingInformationForm.zip.value=="")
	{
		alert("You must enter zip or postal code");
		ShippingInformationForm.zip.focus();
		return false;
	}

	if(ShippingInformationForm.country.value=="")
	{
		alert("You must enter country");
		ShippingInformationForm.country.focus();
		return false;
	}

	if(ShippingInformationForm.stype.value=="")
	{
		alert("You must enter shipping type");
		ShippingInformationForm.stype.focus();
		return false;
	}

	return true;
}


function checkforumcomment()
{
    if(forumcomment.comment.value=="")
	{
		alert("You Must Enter Your Comment");
		forumcomment.comment.focus();
		return false;
	}
	
	else
		return true;
}
