function viewImage(gallary_id,photo_id)
{
	
	URL = "view_image.php?galleryid="+gallary_id+"&photoid="+photo_id;
	windowName = '';
	width = '550';
	height = '600';
	left = '0';
	//top = '0';
	resizable = true;
	menubar = false;
	scrollbars = true;
	toolbar = false;
	directories = false;
	
	var windowFeatures;
	windowFeatures = '';
	if (width != '')
		windowFeatures = windowFeatures+'width='+width+',';
	if (height != '')
		windowFeatures = windowFeatures+'height='+height+',';
	if (left != '')
		windowFeatures = windowFeatures+'left='+left+',';
	if (top != '')
		windowFeatures = windowFeatures+'top='+top+',';
	if (resizable)
		windowFeatures = windowFeatures+'resizable,';
	if (menubar)
		windowFeatures = windowFeatures+'menubar,';
	if (scrollbars)
		windowFeatures = windowFeatures+'scrollbars,';
	if (toolbar)
		windowFeatures = windowFeatures+'toolbar,';
	if (directories)
		windowFeatures = windowFeatures+'directories,';
	
	window.open(URL, windowName, windowFeatures);

}

function validatedata()
{
	
if  (checkBlank(frm.txtProductTitle,"Product Title")==false)
			return false;
}
function backpage()
{
	window.location="category_list.php";
}

function selectAllCheckbox(frmObj, chk_state)  //******************Function call on CHK BOX action All select 
{
	
	frmName = frmObj.name;

	totalElem = document.frmshipper.chk_all.length;
	for (i=0;i<totalElem;i++)
	{
		document.frmshipper.chk_all[i].checked = chk_state;

	}
	if(!totalElem)
	{
		document.frmshipper.chk_all.checked = chk_state;

	}
}                               /*---------------------------- END OF FUNCTION --------------------*/ 

function UnselectAllCheckbox(frmObj, chk_state)  //***********Function Call On CHK BOX Action Not Select All
{

  chk_checked = "false";
  if (document.frmshipper.chk_all.length)
   {
	 total = document.frmshipper.chk_all.length;

	  for (i=0;i<total;i++)
	  {
	    if (document.frmshipper.chk_all[i].checked)
		{
		  chk_checked = "true";
		}
		else
		{
		  chk_checked = "false";
		  document.frmshipper.chk_select_all.checked = false;
		  break;
		}
	 }
	
   }
 else
	 {
		if (document.frmshipper.chk_all.checked)
		{
		  chk_checked = "true";
		}
		else
		{
		  chk_checked = "false";
		  document.frmshipper.chk_select_all.checked = false;
		 
		}

	 }
	if(chk_checked == "true")
	{
		document.frmshipper.chk_select_all.checked = chk_state;
		
	}
}  /*---------------------------- END OF FUNCTION --------------------*/ 

function callActionPage(strAction)          //******************Function call on button action  
{

  if (strAction == "delete") 
  {
      /*-----Code to check if any of the checkbox is selected else the form will not be submitted-------*/
		chk_checked = "false";
		if (document.frmshipper.chk_all.length)
		{
			total = document.frmshipper.chk_all.length;

			for (i=0;i<total;i++)
			{
				if (document.frmshipper.chk_all[i].checked)
				{
					chk_checked = "true";
					break;
				}
			}
		}
		else
		{
			if (document.frmshipper.chk_all.checked)
					chk_checked = "true";
		}
		
		/*---------------End of code to check if any of the checkbox is selected-----------*/

		if (chk_checked == "true")
		{
			if (confirm("Are you sure you wish to delete this item?"))
			{
				
				document.frmshipper.act.value = "delete";
				document.frmshipper.action = "shipper.php";
				document.frmshipper.submit;
				return true;
			}
			else
			{
				return false;

			}
		}
		else if (chk_checked == "false")
		{
			alert("Please select the Item(s) to be deleted");
			return false;
		}
	}
}

////////////////  for validation of html control	 /////////////////
	
function checkpage(page)
{
	//alert(document.frmsearch.country2.value);
	
	document.frmshipper.page.value = page;
	document.frmshipper.hidden_id.value = document.frmshipper.hidden_id.value;
	document.frmshipper.hiddenaction.value = document.frmshipper.hiddenaction.value;
	document.frmshipper.hiddenaction.value =document.frmshipper.hiddenaction.value;
	document.frmshipper.hidden_id.value = document.frmshipper.hidden_id.value;
	
	document.frmshipper.username.value = document.frmshipper.username.value;
	document.frmshipper.password.value = document.frmshipper.password.value;
	document.frmshipper.companyname.value = document.frmshipper.companyname.value;
	document.frmshipper.contactname.value = document.frmshipper.contactname.value;
	document.frmshipper.address1.value = document.frmshipper.address1.value;
	document.frmshipper.address2.value = document.frmshipper.address2.value;
	document.frmshipper.city.value = document.frmshipper.city.value;
	document.frmshipper.txtcountry.value = document.frmshipper.txtcountry.value;

	document.frmshipper.phone.value = document.frmshipper.phone.value;
	document.frmshipper.email.value = document.frmshipper.email.value;
	document.frmshipper.web_site_url.value = document.frmshipper.web_site_url.value;
	document.frmshipper.hearaboutus.value = document.frmshipper.hearaboutus.value;
	document.frmshipper.dateofbirth.value = document.frmshipper.dateofbirth.value;

	document.frmshipper.action = "shipper.php";
	document.frmshipper.submit();
}



function mailvalidation()
{
	if(document.frmshiplist.yemail.value=="")
	{
		alert("Email shouldn't be Leave Blank");
		document.frmshiplist.yemail.focus();
		return false;
	}
	else
	{
		if(ValidateEmail(document.frmshiplist.yemail)==false)
		{
			document.frmshiplist.yemail.focus();
			return false;
		}
	}

	if(document.frmshiplist.yname.value=="")
	{
		alert("Name shouldn't be Leave Blank");
		document.frmshiplist.yname.focus();
		return false;
	}

	if(document.frmshiplist.address.value=="")
	{
		alert("Address shouldn't be Leave Blank");
		document.frmshiplist.address.focus();
		return false;
	}
	else
	{
		return true;
	}

}

function shipValidation()
{	//alert('ddjs');
	if(document.frmshipper.username.value =="")
	{
		alert("UserId shouldn't be Leave Blank");
		document.frmshipper.username.focus();
		return false;
	}
	if(document.frmshipper.password.value =="")
	{
		alert("Password shouldn't be Leave Blank");
		document.frmshipper.password.focus();
		return false;
	}
	if(document.frmshipper.conpassword.value =="")
	{
		alert("Confirm password shouldn't be Leave Blank");
		document.frmshipper.conpassword.focus();
		return false;
	}
	if(document.frmshipper.password.value!==document.frmshipper.conpassword.value)
	{
			alert("Please enter correct password");
			document.frmshipper.conpassword.focus();
			return false;
	}
	

	if(document.frmshipper.contactname.value =="")
	{
		alert("Contact Name shouldn't be Leave Blank");
		document.frmshipper.contactname.focus();
		return false;
	}
	if(document.frmshipper.address1.value =="")
	{
		alert("Address1 shouldn't be Leave Blank");
		document.frmshipper.address1.focus();
		return false;
	}
	if(document.frmshipper.city.value =="")
	{
		alert("City shouldn't be Leave Blank");
		document.frmshipper.city.focus();
		return false;
	}

if(checkSelect(frmshipper.txtstate,"State") == false)
{
	document.frmshipper.txtstate.focus();
				return false;
}

if(checkSelect(frmshipper.txtcountry,"Country") == false)
{
			document.frmshipper.txtcountry.focus();
			return false;
}
	
	
	if(document.frmshipper.zip.value =="")
	{
		alert("Zip shouldn't be Leave Blank");
		document.frmshipper.zip.focus();
		return false;
	}
	else
	{
			if(isAlphanumeric(document.frmshipper.zip.value)==false)
			{
				alert("Zip should be Alphanumeric value");
				document.frmshipper.zip.focus();
				return false;
			}
	}

	if(document.frmshipper.phone.value=="")
	{
		alert("Phone shouldn't be leave blank");
		document.frmshipper.phone.focus();
		return false;
	}
	else
	{
		if(isAlphanumeric(document.frmshipper.phone.value)==false)
		{
			alert("Phone should be Alphanumeric value");
			document.frmshipper.phone.focus();
			return false;
		}
	}
	
	
	if(document.frmshipper.email.value=="")
	{
		alert("Email shouldn't be Leave Blank");
		document.frmshipper.email.focus();
		return false;
	}
	else
	{
		if(ValidateEmail(document.frmshipper.email)==false)
		{
			document.frmshipper.email.focus();
			return false;
		}
	}

	if(document.frmshipper.web_site_url.value!=="")
	{
		if(checkURLNew(document.frmshipper.web_site_url.value)==false)
		{ 
				alert("Enter URL like \n http://www.sitename.com, .co, .net, .org");
				document.frmshipper.web_site_url.focus();
				return false;
		}
	}	
	if(document.frmshipper.dateofbirth.value =="")
	{
		alert("Date of birth shouldn't be Leave Blank");
		document.frmshipper.dateofbirth.focus();
		return false;
	}	

}
function shipValidation1()
{	//alert('ddjs');
	if(document.frmshipper.username.value =="")
	{
		alert("UserId shouldn't be Leave Blank");
		document.frmshipper.username.focus();
		return false;
	}
	if(document.frmshipper.password.value =="")
	{
		alert("Password shouldn't be Leave Blank");
		document.frmshipper.password.focus();
		return false;
	}
	if(document.frmshipper.conpassword.value =="")
	{
		alert("Confirm password shouldn't be Leave Blank");
		document.frmshipper.conpassword.focus();
		return false;
	}
	if(document.frmshipper.password.value!==document.frmshipper.conpassword.value)
	{
			alert("Please enter correct password");
			document.frmshipper.conpassword.focus();
			return false;
	}
	

	if(document.frmshipper.contactname.value =="")
	{
		alert("Contact Name shouldn't be Leave Blank");
		document.frmshipper.contactname.focus();
		return false;
	}
	if(document.frmshipper.address1.value =="")
	{
		alert("Address1 shouldn't be Leave Blank");
		document.frmshipper.address1.focus();
		return false;
	}
	if(document.frmshipper.city.value =="")
	{
		alert("City shouldn't be Leave Blank");
		document.frmshipper.city.focus();
		return false;
	}

if(checkSelect(frmshipper.txtstate,"State") == false)
{
	document.frmshipper.txtstate.focus();
				return false;
}

if(checkSelect(frmshipper.txtcountry,"Country") == false)
{
			document.frmshipper.txtcountry.focus();
			return false;
}
	
	
	if(document.frmshipper.zip.value =="")
	{
		alert("Zip shouldn't be Leave Blank");
		document.frmshipper.zip.focus();
		return false;
	}
	else
	{
			if(isAlphanumeric(document.frmshipper.zip.value)==false)
			{
				alert("Zip should be Alphanumeric value");
				document.frmshipper.zip.focus();
				return false;
			}
	}

	if(document.frmshipper.phone.value=="")
	{
		alert("Phone shouldn't be leave blank");
		document.frmshipper.phone.focus();
		return false;
	}
	else
	{
		if(isAlphanumeric(document.frmshipper.phone.value)==false)
		{
			alert("Phone should be Alphanumeric value");
			document.frmshipper.phone.focus();
			return false;
		}
	}
	
	
	if(document.frmshipper.email.value=="")
	{
		alert("Email shouldn't be Leave Blank");
		document.frmshipper.email.focus();
		return false;
	}
	else
	{
		if(ValidateEmail(document.frmshipper.email)==false)
		{
			document.frmshipper.email.focus();
			return false;
		}
	}

	if(document.frmshipper.web_site_url.value!=="")
	{
		if(checkURLNew(document.frmshipper.web_site_url.value)==false)
		{ 
				alert("Enter URL like \n http://www.sitename.com, .co, .net, .org");
				document.frmshipper.web_site_url.focus();
				return false;
		}
	}	
	if(document.frmshipper.dateofbirth.value =="")
	{
		alert("Date of birth shouldn't be Leave Blank");
		document.frmshipper.dateofbirth.focus();
		return false;
	}	
	
	return true;

}


function ExportData()
{
	document.frmshiplist.hidden_id.value =	document.frmshiplist.hidden_id.value;
	document.frmshiplist.hidden_status.value=document.frmshiplist.hidden_status.value;
	document.frmshiplist.hiddenaction.value =	document.frmshiplist.hiddenaction.value;
	document.frmshiplist.page.value =		document.frmshiplist.page.value;
	document.frmshiplist.sourcecity.value =	document.frmshiplist.sourcecity.value;
	document.frmshiplist.ostate.value	= 	document.frmshiplist.ostate.value;
	document.frmshiplist.destcity.value = 	document.frmshiplist.destcity.value;
	document.frmshiplist.dstate.value	= 	document.frmshiplist.dstate.value;
	document.frmshiplist.txtzip.value = 	document.frmshiplist.txtzip.value;
	document.frmshiplist.depdate.value =	document.frmshiplist.depdate.value;
	document.frmshiplist.arldate.value =	document.frmshiplist.arldate.value;
	document.frmshiplist.country1.value =	document.frmshiplist.country1.value;
	document.frmshiplist.country2.value =	document.frmshiplist.country2.value;
	
	if(document.frmshiplist.back.value)
	{
		document.frmshiplist.action="search_shipping_list.php";
		document.frmshiplist.submit();
		return false;
	}
	else
	{
		alert("your massage is bad");
	}	
}

function SearchThis()
{
	if(document.frmshipper.searchcat.value =='All')
	{
		document.frmshipper.search.value='Search';
	}
	if(((document.frmshipper.search.value)=='' || document.frmshipper.search.value=='Search') && (document.frmshipper.searchcat.value !='All'))
	{
		alert("Enter the content to search");
		document.frmshipper.search.focus();
		return false;
	}
	else if(document.frmshipper.searchcat.value=='')
	{
			alert("Select the option to search");
			document.frmshipper.searchcat.focus();
			return false;
	}
	else
		{
			document.frmshipper.action = "shipper.php";
			document.frmshipper.submit();
		}
}
function fun_addship_listship()
{
if(document.frmshipper.back.value)
	{
		document.frmshipper.action = "shipper.php";
		document.frmshipper.submit();
	}
}
