var remail=/^([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+\.+[a-zA-Z0-9-]+|[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+\.+[a-zA-Z0-9-]+\.+[a-zA-Z0-9-]+)$/;
var checkIfAlphabet=/[a-zA-Z]/;
var checkifSymbol = /[^_a-zA-Z0-9]/;

function checkImageFormat(fileName) {
	var imageSrc = new String();
	imageSrc = fileName.value;
	imageFormat = imageSrc.slice(imageSrc.length-4);
	if(imageFormat != ".gif" && imageFormat != ".GIF"  && imageFormat != ".jpg"  && imageFormat != ".JPG" && imageFormat != ".jpeg" && imageFormat != ".JPEG") {
		return true;
	} else {
		return false;
	}
}
function ValidateEmail(str) {

	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	if (str.indexOf(at)==-1){
	   alert("Invalid E-mail ID");
	   return false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Invalid E-mail ID");
	   return false;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    alert("Invalid E-mail ID");
	    return false;
	}

	 if (str.indexOf(at,(lat+1))!=-1){
	    alert("Invalid E-mail ID");
	    return false;
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    alert("Invalid E-mail ID");
	    return false;
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	    alert("Invalid E-mail ID");
	    return false;
	 }

	 if (str.indexOf(" ")!=-1){
	    alert("Invalid E-mail ID");
	    return false;
	 }

	 return true;
}

function checkEmail(fieldvalue) 
{
	if(remail.test(fieldvalue))
	{
		return false;
	} 
	else 
	{
		return true;
	}
}

function checkNumber(fieldvalue) 
{
	if(isNaN(fieldvalue)) 
	{
		return true;
	} 
	else 
	{
		return false;
	}
}

function checkIfSelected(formNm) 
{
	for (i=0;i<formNm.elements.length;i++) 
	{
		if(formNm.elements[i].type =="select-multiple")
		{
			if(formNm.elements[i].value == "") 
			{
				return true;
			}
			else 
			{
				return false;
			}
		}
	}
}

function checkIfIsChar(fieldvalue) 
{
	if(checkIfAlphabet.test(fieldvalue.charAt(0))) 
	{
		return false;
	} 
	else 
	{
		return true;
	}
}

function checkSpace(fieldvalue) 
{
	for(counter = 0;counter < fieldvalue.length;counter++) 
	{
		if(fieldvalue.charAt(counter) == " ") 
		{
			error = 1;
			break;
		} 
		else 
		{
			error = 0;
		}
	}
	if(error == 1) 
	{
		return true;
	} 
	else 
	{
		return false;
	}
}

function checkSymbol(fieldvalue) 
{
	for(counter = 0;counter < fieldvalue.length;counter++) 
	{
		if(checkifSymbol.test(fieldvalue.charAt(counter))) 
		{
			error = 1;
			break;
		} 
		else 
		{
			error = 0;
		}
	}
	
	if(error == 1) 
	{
		return true;
	} 
	else 
	{
		return false;
	}
}

function checkIfFirstLetterIsSymbol(fieldvalue) 
{
	if(checkifSymbol.test(fieldvalue.charAt(0))) 
	{
		error = 1;
	} 
	else 
	{
		error = 0;
	}

	if(error == 1) 
	{
		return true;
	} 
	else 
	{
		return false;
	}
}

function checkLength(fieldvalue) 
{
	if(fieldvalue.length < 6 ) 
	{
		return true;
	}
	else 
	{
		return false;
	}
}

function checkBlank(fieldvalue) 
{
	for(counter=0;counter < fieldvalue.length;counter++) 
	{
		if(fieldvalue.charAt(counter) == " ") 
		{
			continue;
		} 
		else 
		{
			break;
			return false;
		}
	}
	
	if(fieldvalue.length == counter) 
	{
		return true;
	}
}

function checkValidDate(formNm) 
{
  var err=0;
  var psj=0;
  b = formNm.cmb_Month.value;
  d = formNm.cmb_Day.value;
  f = formNm.cmb_Year.options[formNm.cmb_Year.selectedIndex].value;
  f = f.substring(2,4)
  if (b<1 || b>12) err = 1
  if (d<1 || d>31) err = 1
  if (f<0 || f>99) err = 1

  if (b==4 || b==6 || b==9 || b==11)
	{
    if (d==31) err=1
  }

  if (b==2)
	{
    var g=parseInt(f/4)
    if (isNaN(g))
		{
      err=1
    }

    if (d>29) err=1
    if (d==29 && ((f/4)!=parseInt(f/4))) err=1
  }

  if (err==1)
	{
  	 return true;
  }
  else
	{
     return false;
  }
}

function submitRegistrationForm(formNm) {
	if(formNm.txt_SignInName.value == "")
	{
		alert("Please enter your sign-in name");
		formNm.txt_SignInName.focus();
    return false;

	} 
  else if(checkSpace(formNm.txt_SignInName.value)) 
	{
		alert("Blank spaces are not allowed");
		formNm.txt_SignInName.focus();
    return false;
	} 
	else if(checkIfIsChar(formNm.txt_SignInName.value)) 
	{
		alert("The first character of the sign-in name should be a character");
		formNm.txt_SignInName.focus();
    return false;
	} 
	else if (checkSymbol(formNm.txt_SignInName.value))
	{
		alert("Only letters,numbers,or underscores are allowed");
		formNm.txt_SignInName.focus();
    return false;
	}
	else if(formNm.txt_Password.value == "") 
	{
		alert("Please enter your password");
		formNm.txt_Password.focus();
    return false;
	} 
	else if(checkBlank(formNm.txt_Password.value)) 
	{
		alert("Please enter your password");
		formNm.txt_Password.focus();
    return false;
	} 
	else if(checkLength(formNm.txt_Password.value)) 
	{
		alert("Password should be atleast 6 characters long");
		formNm.txt_Password.focus();
    return false;
	} 
	else if(checkSpace(formNm.txt_Password.value)) 
	{
		alert("Blank spaces are not allowed between the password");
		formNm.txt_Password.focus();
    return false;
	} 
	else if(checkSymbol(formNm.txt_Password.value)) 
	{
		alert("Only letters,numbers,or underscores are allowed");
		formNm.txt_Password.focus();
    return false;
	}
	 else if(formNm.txt_Password.value != formNm.txt_ReConfirmPassword.value)
	 {
		alert("Your passwords did not match.");
		formNm.txt_Password.focus();
    return false;
	}
	else if(formNm.txt_Company.value == "") 
	{
		alert("Please enter the name of your Company");
		formNm.txt_Company.focus();
    return false;
	}
	else if(checkBlank(formNm.txt_Company.value))
	{
		alert("Please enter the name of your Company");
		formNm.txt_Company.focus();
    return false;
	}
 /* else if(formNm.txt_Email.value == "")
	{
		alert("Please enter your email");
		formNm.txt_Email.focus();
    return false;
	}
	else if(checkBlank(formNm.txt_Email.value))
	{
		alert("Please enter your email");
		formNm.txt_Email.focus();
    return false;
	}
	else if(checkEmail(formNm.txt_Email.value))
	{
		alert("Invalid email address");
		formNm.txt_Email.focus();
    return false;
	}*/
	else if ((ValidateEmail(document.regform.txt_Email.value)==false))
	{
		document.regform.txt_Email.focus();
		return false;
	}
	
	else if(formNm.txt_AcName.value == "")
	{
		alert("Please enter your accountant name");
		formNm.txt_AcName.focus();
    return false;

	} 
   else if ((ValidateEmail(document.regform.txt_AcEmail.value)==false))
	{
		//alert("Invalid accountant email address");
		document.regform.txt_AcEmail.focus();
		return false;
	}
	else if(formNm.txtar_CompanyAddress.value == "")
	{
		alert("Please enter the address of your Company");
		formNm.txtar_CompanyAddress.focus();
    return false;
	}
	else if(checkBlank(formNm.txtar_CompanyAddress.value))
	{
		alert("Please enter the address of your Company");
		formNm.txtar_CompanyAddress.focus();
		return false;
	}

    /*Added by SANJAY*/
	else if(formNm.txt_City.value == "")
	{
		alert("Please enter the city of your Company");
		formNm.txt_City.focus();
    return false;
	}
	else if(checkBlank(formNm.txt_City.value))
	{
		alert("Please enter the city of your Company");
		formNm.txt_City.focus();
		return false;
	}
	
	else if(formNm.txt_State.value == "")
	{
		alert("Please enter the state of your Company");
		formNm.txt_State.focus();
    return false;
	}
	else if(checkBlank(formNm.txt_State.value))
	{
		alert("Please enter the state of your Company");
		formNm.txt_State.focus();
		return false;
	}
	
	else if(formNm.txt_Zip.value == "")
	{
		alert("Please enter the ZIP/PIN of your Company");
		formNm.txt_Zip.focus();
    return false;
	}
	else if(checkBlank(formNm.txt_Zip.value))
	{
		alert("Please enter the ZIP/PIN of your Company");
		formNm.txt_Zip.focus();
		return false;
	}
	/*End of SANJAY Addition*/

	else if(formNm.txt_Telephone.value == "") 
	{
		alert("Please enter the telephone number of your Company");
		formNm.txt_Telephone.focus();
    return false;
	} 
	else if(checkBlank(formNm.txt_Telephone.value)) 
	{
		alert("Please enter the telephone number of your Company");
		formNm.txt_Telephone.focus();
    return false;
	} 
	else if(formNm.txt_ContactPerson.value == "")
	{
		alert("Please enter the contact persons name");
		formNm.txt_ContactPerson.focus();
    return false;
	}
	else if(checkBlank(formNm.txt_ContactPerson.value))
	{
		alert("Please enter the contact persons name");
		formNm.txt_ContactPerson.focus();
    return false;
	}
	else if(formNm.how_heard.value == "Please select") 
	{
		alert("Please select 'How did you hear about us?' option.");
		formNm.how_heard.focus();
    return false;
	}
 else
	{
    return true;
	}
}



function submitLoginForm(formNm,Action,ActionType) {
	if(formNm.txt_SignInName.value == "") {
		alert("Please enter your sign-in name");
		formNm.txt_SignInName.focus();
	} else if(checkBlank(formNm.txt_SignInName.value)) {
		alert("Please enter your sign-in name");
		formNm.txt_SignInName.focus();
	} else if(formNm.txt_Password.value == "") {
		alert("Please enter your password");
		formNm.txt_Password.focus();
	} else if(checkBlank(formNm.txt_Password.value)) {
		alert("Please enter your password");
		formNm.txt_Password.focus();
	} else {
		formNm.action = Action;
		formNm.hid_ActionType.value = ActionType;
		formNm.submit();
	}
}

function submitCustFrm(formNm,Action,ActionType,id)	{
	if (ActionType == "view_customer")	{
		
		window.open("viewcustdetails.php?id="+id,'ViewCustDetails',"scrollbars=yes,menubar=no,width=550,height=400");

	}	else if (ActionType == "delete_customer")	{
		if (confirm("Are you sure you want to delete this record ? "))	{
			formNm.action = Action;
			formNm.customerId.value = id;
			formNm.hid_ActionType.value = ActionType;
			formNm.submit();
		}
	}	else	{
		formNm.action = Action;
		formNm.customerId.value = id;
		formNm.hid_ActionType.value = ActionType;
		formNm.submit();
	}
}


function submitForgotPasswordForm(formNm,Action,ActionType) {
	if(formNm.txt_SignInName.value == "") {
		alert("Please enter your sign-in name");
		formNm.txt_SignInName.focus();
	} else if(checkBlank(formNm.txt_SignInName.value)) {
		alert("Please enter your sign-in name");
		formNm.txt_SignInName.focus();

	} else {
		formNm.action = Action;
		formNm.hid_ActionType.value = ActionType;
		formNm.submit();
	}
}

function submitForm(formNm,Action,ActionType) {
	formNm.action = Action;
	formNm.hid_ActionType.value = ActionType;
	formNm.submit();	
}


function submitForm3(formNm,Action,Request) {
	formNm.action = Action;
	formNm.request.value = Request;
	formNm.submit();
}

function submitForm2(formNm,Action,ActionType) {
	formNm.hid_ActionType.value = ActionType;
	formNm.action = Action;
	formNm.submit();	
}

function submitNewOrderMail(formNm,Action,ActionType) {
	formNm.hid_ActionType.value = ActionType;
	formNm.action = Action;
	formNm.submit();	
}

function submitForm4(formNm,Action,ActionType,Request,OrderId,DesignId,AddDesignFlag) {
	if(ActionType == "deleteRevisedOrder" && confirm("Are you sure you want to delete this design")) {
		formNm.action = Action;
		formNm.hid_ActionType.value = ActionType;
		formNm.hid_AddDesignFlag.value = AddDesignFlag;
		formNm.orderId.value = OrderId;
		formNm.designId.value = DesignId;
		formNm.request.value = Request;
		formNm.submit();
	} else if(ActionType != "deleteRevisedOrder") {
		formNm.action = Action;
		formNm.hid_ActionType.value = ActionType;
		formNm.hid_AddDesignFlag.value = AddDesignFlag;
		formNm.orderId.value = OrderId;
		formNm.designId.value = DesignId;
		formNm.request.value = Request;
		formNm.submit();
	}
}

function submitForm6(formNm,Action,ActionType,Request,DesignId,AddDesignFlag) {
	if((ActionType == "deleteOrder" && confirm("Are you sure you want to delete this design")) || (ActionType == "deleteQuote" && confirm("Are you sure you want to delete this design"))) {
		formNm.action = Action;
		formNm.hid_ActionType.value = ActionType;
		formNm.hid_AddDesignFlag.value = AddDesignFlag;
		formNm.designId.value = DesignId;
		formNm.request.value = Request;
		formNm.submit();
	} else if(ActionType != "deleteOrder" && ActionType != "deleteQuote") {
		formNm.action = Action;
		formNm.hid_ActionType.value = ActionType;
		formNm.hid_AddDesignFlag.value = AddDesignFlag;
		formNm.designId.value = DesignId;
		formNm.request.value = Request;
		formNm.submit();
	}
}

function submitForm5(formNm,Action,OrderId) {
	formNm.action = Action;
	formNm.orderId.value = OrderId;
	formNm.submit();
}

function submitReorderForm(formNm,Action){
	formNm.action = Action;
	formNm.orderId.value = formNm.txt_order.value 
	formNm.submit();
}

function submitForm7(formNm,Action,QuoteId) {
	formNm.action = Action;
	formNm.quoteId.value = QuoteId;
	formNm.submit();
}

function submitOrdersDetails(formNm,Action,ActionType,orderId,parentId,customerId) {
	formNm.action = Action;
	formNm.hid_ActionType.value = ActionType;
	formNm.orderId.value = orderId;
	formNm.parentId.value = parentId;
	formNm.customerId.value = customerId;
	formNm.submit();
}

function submitOrderMail(formNm,orderId,ActionType,Action) {
	formNm.action = Action;
	formNm.hid_ActionType.value = ActionType;
	formNm.orderId.value = orderId;
	formNm.submit();
}

function sendQuoteMail(formNm,Action,ActionType,quoteId,customerId) {
	formNm.action = Action;
	formNm.hid_ActionType.value = ActionType;
	formNm.quoteId.value = quoteId;
	formNm.customerId.value = customerId;
	formNm.submit();	
}

function submitQuotesDetails(formNm,Action,ActionType,quoteId,parentId) {
	formNm.action = Action;
	formNm.hid_ActionType.value = ActionType;
	formNm.quoteId.value = quoteId;
	formNm.submit();
}

function submitQuotesWithCustomerDetails(formNm,Action,ActionType,quoteId,customerId) {
	formNm.action = Action;
	formNm.hid_ActionType.value = ActionType;
	formNm.quoteId.value = quoteId;
	formNm.customerId.value = customerId;
	formNm.submit();
}

function submitOrderMessageForm(formNm,Action,ActionType,orderId,parentId,customerId,request) {
	formNm.action = Action;
	formNm.hid_ActionType.value = ActionType;
	formNm.orderId.value = orderId;
	formNm.request.value = request;
	formNm.parentId.value = parentId;
	formNm.customerId.value = customerId;
	formNm.submit();
}

function submitQuoteMessageForm(formNm,Action,ActionType,quoteId,customerId,request) {
	formNm.action = Action;
	formNm.hid_ActionType.value = ActionType;
	formNm.quoteId.value = quoteId;
	formNm.request.value = request;
	formNm.customerId.value = customerId;
	formNm.submit();
}

function submitMessageDetailsForm(formNm,ActionType,Action,Id,CustId) {
	if(ActionType == "deleteMessage") {
		if(confirm("Are you sure you want to delete this message")) {
			formNm.action = Action;
			formNm.hid_ActionType.value = ActionType;
			formNm.CustId.value = CustId;
			formNm.Id.value = Id;
			
			formNm.submit();
		}
	} else {
		formNm.action = Action;
		formNm.hid_ActionType.value = ActionType;
		formNm.CustId.value = CustId;
		formNm.Id.value = Id;
		
		formNm.submit();
	}
}

function submitMessageDetailsForm3(formNm,ActionType,Action,Id,CustId) {
	
	if(ActionType == "deleteClientMessage") {
		if(confirm("Are you sure you want to delete this message")) {
			formNm.action = Action;
			formNm.hid_ActionType.value = ActionType;
			formNm.Id.value = Id;
			formNm.CustId.value = CustId;
			formNm.submit();
		}
	} else {
		formNm.action = Action;
		formNm.hid_ActionType.value = ActionType;
		formNm.Id.value = Id;
		formNm.CustId.value = CustId;
		formNm.submit();
	}
}



function submitMessageDetailsForm2(formNm,ActionType,Action,CustId) {
	
		formNm.action = Action;
		formNm.hid_ActionType.value = ActionType;

		formNm.CustId.value = CustId;
		formNm.submit();
	
}
function submitMessageForm(formNm) 
{
	if(formNm.txt_Title.value == "") 
	{
		alert("Please enter title for message");
		formNm.txt_Title.focus();
	} 
	else if(checkBlank(formNm.txt_Title.value)) 
	{
		alert("Please enter title for message");
		formNm.txt_Title.focus();
	} 
	else if(formNm.txtar_Message.value == "") 
	{
		alert("Please enter your message");
		formNm.txtar_Message.focus();
	} 
	else 
	{
		formNm.submit();
	}
}

function submitMessageListForm(formNm,Action,messageId) {
	formNm.action = Action;
	formNm.messageId.value = messageId;
	formNm.submit();
}

function submitUploadForm(formNm,Action,ActionType,orderId,designId) {
	formNm.action = Action;
	formNm.hid_ActionType.value = ActionType;
	formNm.orderId.value = orderId;
	formNm.designId.value = designId;
	formNm.submit();
}

function submitUploadForm(formNm,Action,ActionType,orderId,designId) {
	formNm.action = Action;
	formNm.hid_ActionType.value = ActionType;
	formNm.orderId.value = orderId;
	formNm.designId.value = designId;
	formNm.submit();
}

function submitUpdateForm(formNm)
{
  if(formNm.txtar_Edit.value=='')
   {
    alert("Please Enter Your Comments");
    formNm.txtar_Edit.focus();
    return false
   }
   else
   {
    return true;
   }
}

function deleteOrderForm(formNm,Action,ActionType,orderId) {
	if(confirm("Are you sure you want to delete this order")) {
		formNm.action = Action;
		formNm.hid_ActionType.value = ActionType;
		formNm.orderId.value = orderId;
		formNm.submit();
	}
}

function deleteQuoteForm(formNm,Action,ActionType,quoteId) {
	if(confirm("Are you sure you want to delete this quote")) {
		formNm.action = Action;
		formNm.hid_ActionType.value = ActionType;
		formNm.quoteId.value = quoteId;
		formNm.submit();
	}
}

function openWindow(pathName,windowName,widthNumber,heightNumber) {
	window.open(pathName,windowName,"toolbar=no,scrollbars=yes,width="+widthNumber+",height="+heightNumber+",menubar=no,status=no,resizable=no,left=200px,top=100px");
}

function submitShowList(formNm,Action,ActionType) {
	formNm.action = Action;
	formNm.hid_ActionType.value = ActionType;
	formNm.submit();	
}

function submitGenerateReport(formNm,Action,ActionType) {
	formNm.action = Action;
	formNm.hid_ActionType.value = ActionType;
	formNm.submit();
}

function submitDesignForm(frm)
{
	if (frm.cmb_FormatTypeArtwork.options[frm.cmb_FormatTypeArtwork.selectedIndex].value=="No")
	{
			alert("Please Select Artwork File Format.");
			return false;
	}
	else if(frm.txt_DesignName.value =="")
	{
		alert("Please enter Design Name");
		frm.txt_DesignName.focus();
    return false;
	}
	else if(frm.cmb_FabricType.options[frm.cmb_FabricType.selectedIndex].value == "Other"  && frm.txt_FabricOther.value =="")
	{
		alert("Please enter other fabric type");
		frm.txt_FabricOther.focus();
    return false;
	}
	else if(frm.cmb_FabricType.options[frm.cmb_FabricType.selectedIndex].value != "Other" && frm.txt_FabricOther.value !="")
	{
		alert("Either select the other option from Fabric/Garment list box or remove the value written in the other Fabric/Garment text field");
		frm.cmb_FabricType.focus();
    return false;
	}
	else if(frm.cmb_Color.options[frm.cmb_Color.selectedIndex].value == "Other"  && frm.txt_OtherColor.value =="")
	{
		alert("Please enter what type of other color you want us to use");
		frm.txt_OtherColor.focus();
    return false;
	} 
	else if(frm.cmb_Color.options[frm.cmb_Color.selectedIndex].value != "Other" && frm.txt_OtherColor.value !="")
	{
		alert("Either select the other option from the Color list box or remove the value written in the other Color text field");
		frm.cmb_Color.focus();
    return false;
	} 
	else if(frm.uploaded.value == "" && frm.uploaded1.value == "")
	{
		alert("Please Browse which file to upload ");
		frm.uploaded.focus();
    return false;
	}
	else
	{
    return true;
	}
}
function submitDesignFormAWS(frm)
{
	if (frm.cmb_FormatTypeArtwork.options[frm.cmb_FormatTypeArtwork.selectedIndex].value=="No")
	{
			alert("Please Select Artwork File Format.");
			return false;
	}
	else if(frm.txt_DesignName.value =="")
	{
		alert("Please enter Design Name");
		frm.txt_DesignName.focus();
    return false;
	}
	else if(frm.cmb_FabricType.options[frm.cmb_FabricType.selectedIndex].value == "Other"  && frm.txt_FabricOther.value =="")
	{
		alert("Please enter other fabric type");
		frm.txt_FabricOther.focus();
    return false;
	}
	else if(frm.cmb_FabricType.options[frm.cmb_FabricType.selectedIndex].value != "Other" && frm.txt_FabricOther.value !="")
	{
		alert("Either select the other option from Fabric/Garment list box or remove the value written in the other Fabric/Garment text field");
		frm.cmb_FabricType.focus();
    return false;
	}
	else if(frm.cmb_Color.options[frm.cmb_Color.selectedIndex].value == "Other"  && frm.txt_OtherColor.value =="")
	{
		alert("Please enter what type of other color you want us to use");
		frm.txt_OtherColor.focus();
    return false;
	} 
	else if(frm.cmb_Color.options[frm.cmb_Color.selectedIndex].value != "Other" && frm.txt_OtherColor.value !="")
	{
		alert("Either select the other option from the Color list box or remove the value written in the other Color text field");
		frm.cmb_Color.focus();
    return false;
	} 
	else if(frm.uploaded.value == "" && frm.uploaded1.value == "")
	{
		alert("Please Browse which file to upload ");
		frm.uploaded.focus();
    return false;
	}
	else
	{
    return true;
	}
}

function submitPrintableForm(pathName,windowName,widthNumber,heightNumber) {
	window.open(pathName,windowName,"toolbar=no,scrollbars=yes,width="+widthNumber+",height="+heightNumber+",menubar=no,status=no,resizable=no,left=200px,top=100px");
}

function printWindow() {
	if(document.all) {
		document.all["printPage"].style.visibility = "hidden";
	} else if(document.layers) {
		document.layers["printPage"].visibility = "hide";
	}
	window.print();
	window.close();
}

function manageDesignForm(ActionType,DesignID)
{
  if(ActionType=='edit')
  {
     document.editform.ActionType.value=ActionType;
     document.editform.DesignID.value=DesignID;
     document.editform.submit();
  }
  else if(ActionType=='delete')
  {
    if(confirm("Are you sure you want to delete this design?"))
    {
     document.editform.ActionType.value=ActionType;
     document.editform.DesignID.value=DesignID;
     document.editform.submit();
    }

  }

}

function submitContactForm(formNm) 
{
	if(formNm.txt_SignInName.value == "")
	{
		alert("Please enter your name");
		formNm.txt_SignInName.focus();
    return false;
	} 
 
	else if(formNm.txt_Email.value == "")
	{
		alert("Please enter your email");
		formNm.txt_Email.focus();
    return false;
	}
	else if(checkBlank(formNm.txt_Email.value))
	{
		alert("Please enter your email");
		formNm.txt_Email.focus();
    return false;
	}
	else if(checkEmail(formNm.txt_Email.value))
	{
		alert("Invalid email address");
		formNm.txt_Email.focus();
	    return false;
	}	
	else if(formNm.txt_Telephone.value == "") 
	{
		alert("Please enter the telephone number");
		formNm.txt_Telephone.focus();
    return false;
	} 
	else if(checkBlank(formNm.txt_Telephone.value)) 
	{
		alert("Please enter the telephone number");
		formNm.txt_Telephone.focus();
    return false;
	} 
	else if(formNm.txtar_Message.value == "") 
	{
		alert("Please enter the message");
		formNm.txtar_Message.focus();
    return false;
	} 
	else if(checkBlank(formNm.txtar_Message.value)) 
	{
		alert("Please enter the message");
		formNm.txtar_Message.focus();
    return false;
	} 
	
 else
	{
    return true;
	}
}

