

var mailWin=null;

// Alert message for guest user
//function for the deletetion confermation
function GetCookie(name) {
				var arg=name+"=";
				var alen=arg.length;
				var clen=document.cookie.length;
				var i=0;
				while (i<clen) {
					var j=i+alen;
					if (document.cookie.substring(i,j) == arg) {
						return GetCookieVal(j);
						}
					i=document.cookie.indexOf(" ",i) + 1;
					if (i === 0) {break;}
				}
			}
			function GetCookieVal(offset) {
				var endstr=document.cookie.indexOf(";",offset);
				if (endstr == -1) {endstr=document.cookie.length;}
				return unescape(document.cookie.substring(offset,endstr));
			}
function deleteRecord()
{
var del;
	switch (GetCookie("UserLanguage")){   
		case "en-us":       
			//code here for english lang
			del = confirm("Are you sure you want to delete?");
			break;   
		case "fr":       
			//code here for lang
			del = confirm("Êtes vous sûr vous voulez supprimer");
			break;
      default: 
			del = confirm("Are you sure you want to delete?");
      }
	
	if(!del)
	{
		return false;
	}
}

function myAlert()
{
	document.forms[0].guestUser.value = "1";
	document.forms[0].submit();
	return false;
}  

function NoActionOnEnterPress(){
if(window.event.keyCode == 13 )
	window.event.returnValue = false;	
}


function isSelected(thefield)
{
	for (i = 0; i < thefield.length; i++)
	{
		if (thefield[i].checked)
		{
			return true;
		}
	}
	return false;
}

function giveAlert(level)
{
	
	alert("Please create your level " + level +
		" profile before you create your level " + (level + 1) + " profile");
}

function trims1(get2)
{
	get1 = new String(get2);
	for (var i = 0; get1.length; i++)
	{
		g = get1.charAt(i);
		if (g != " ")
			break;
		else
			continue;
	}
	take = get1.substring(i, get1.length);

	for (var j = take.length - 1; j > 0; j--)
	{
		z = take.charAt(j);
		if (z != " ")
			break;
		else
			continue;
	}
	make = take.substring(0, j + 1);
	return make;
}

function trims(inputString) {
		var retValue = inputString;
		var ch = retValue.substring(0, 1);
			
			while (ch == " ") { // Check for spaces at the beginning of the string
				retValue = retValue.substring(1, retValue.length);
				ch = retValue.substring(0, 1);
			}
			ch = retValue.substring(retValue.length-1, retValue.length);
			while (ch == " ") { // Check for spaces at the end of the string
				retValue = retValue.substring(0, retValue.length-1);
				ch = retValue.substring(retValue.length-1, retValue.length);
			}
   
		return retValue; // Return the trimmed string back to the user
	}


	
function showTagWindow(pageURL)
{
	window.open(pageURL, "tag");
}

// Used in view profile page of all the communities
function setAction(theform, action, profileId)
{
	if (action == 1)
	{
		theform.action = "../dating/memberProfile.aspx";	
		theform.viewProfileId.value = profileId;
	}
	else if (action == 2)
	{
		theform.action = "../interestshobbies/memberProfile.aspx";
		theform.viewProfileId.value = profileId;
	}
	else if (action == 3)
	{
		theform.action = "../sportsactivities/memberProfile.aspx";
		theform.viewProfileId.value = profileId;
	}
	theform.submit();
}

// Used in view profile page of all the communities
function showMessage(community)
{
	alert("This option is currently not available because the selected user does\n" +
		"not have a profile created for his '" + community + "' community\n" +
		"or the specified user has been blocked.");
	return false;
}

function saveSearch()
{	
	
	if (typeof document.forms[0].otherProfileId != "undefined")
	{
		document.forms[0].otherProfileId.value = ""
	}
	if (typeof document.forms[0].viewProfileId != "undefined")
	{
		document.forms[0].viewProfileId.value = ""
	}
		
	if (typeof document.forms[0].showSelectedProfile != "undefined")
	{
		document.forms[0].showSelectedProfile.value = ""
	}
	if (typeof document.forms[0].counterFlag != "undefined")
	{
		document.forms[0].counterFlag.value = ""
	}
	if (typeof document.forms[0].recievingProfileName != "undefined")
	{
		document.forms[0].recievingProfileName.value = ""
	}
	
	if (typeof document.forms[0].recievingProfileId != "undefined")
	{
		document.forms[0].recievingProfileId.value = ""
	}
	document.forms[0].SaveSearch.value = "1";
	document.forms[0].submit();
}

function CheckUncheck(checkAll, docForm)
{
	docForm.readMessageId.value = "";
	CheckUncheckAll(checkAll, docForm, checkAll.checked);
}

function setOperation(docForm, operation, folderName)
{
	var ml = docForm;
	var len = ml.elements.length;
	var totalMails = 0;

	messageIds = new String("");
	for (var i = 0; i < len; i++)
	{
		var e = ml.elements[i];
		controlName = new String(e.name);
		if (controlName.substring(0, 3) == "chk")
		{
			totalMails = totalMails + 1;
			if (e.checked)
			{
				messageIds += controlName.substring(3, controlName.length) + ",";
			}
		}
		if (controlName.indexOf("lstFolders", 1) >= 0 && operation == "move")
		{
			if (e.selectedIndex > 0)
			{
				docForm.FolderInToMove.value = e.options[e.selectedIndex].text;
				e.selectedIndex = 0;
			}
			else
				return false;
		}
	}
	if (totalMails == 0)
	{
		alert("There is no message to " + operation);
		return false;
	}
	else if (messageIds == "")
	{
		alert("Please select a message to " + operation)
		return false;
	}
	else
	{
		docForm.QualifyingMessages.value = messageIds;
		docForm.Operation.value = operation;
		docForm.submit();
	}
}

function CheckUncheckAll(checkAll, docForm, flag)
{
	var ml = docForm;
	var len = ml.elements.length;

	for (var i = 0; i < len; i++)
	{
		var e = ml.elements[i];
		controlName = new String(e.name);
		if (controlName.substring(0, 3) == "chk")
		{
			e.checked = flag;
		}
	}
	// Uncheck the select all checkbox
	checkAll.checked = flag;
}

function showMessage(message, docForm)
{
	messageId = new String(message);
	messageId = messageId.substring(messageId.lastIndexOf("!@#$") + 4, messageId.length);
	docForm.readMessageId.value = messageId;
	docForm.QualifyingMessages.value = "";
	docForm.submit();
}

function showMessage(message, docForm, messageType)
{
	messageId = new String(message);
	messageId = messageId.substring(messageId.lastIndexOf("!@#$") + 4, messageId.length);
	if (messageType == "tag")
	{
		docForm.showTagMessage.value = messageId;
		docForm.readMessageId.value = messageId;
	}
	else if (messageType == "draft")
	{
		docForm.showDraftMessage.value = messageId;
		docForm.readMessageId.value = messageId;
	}
	else
	{
		docForm.readMessageId.value = messageId;
		docForm.showTagMessage.value = "";
	}
	docForm.QualifyingMessages.value = "";
	docForm.submit();
}

function openSendMessageWindow(profileName,profileId)
{
	
	document.forms[0].recievingProfileId.value=profileId;
	document.forms[0].recievingProfileName.value=profileName;
	return true;
	
	
}

function openSendPageWindow(profileName)
{
	var t,l,features;
	l = (screen.availWidth-380) / 2;
	t = (screen.availHeight-330) / 2;
	features = ",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	
	window.open("sendPage.aspx?ProfileName=" + profileName, "PageWindow",
				"toolbar=no,width=380,height=330,status=yes,scrollbars=no,resize=no,menubar=no"+features);
	return false;
}

function isValidProfileName(name)
{
	
	var chr;
	
	// Only allowable charaters in profile name are letters, digits and hyphen.
	for (var i = 0; i < name.length; i++)
	{
		chr = name.charAt(i);
		
		if (chr == "'" || chr == '"' || chr == ">" || chr == "<"  || chr=="\\" || chr==",")
		{
			alert("The provided nick name contains '" + chr + "' invalid character.");
			return false;
		}
	}
	return true;
	/*
	var inValidChars=',"'
	var chr;
	for (var i = 0; i < name.length; i++)
	{
		chr = name.charAt(i);
		if (inValidChars.indexOf(chr)!=-1)
		{
			alert("The provided profile name contains '" + chr + "' invalid character.");
			return false;
		}
	}
	
	return true;
	*/
}

function isValidTitle(name)
{
	var inValidChars = "~!#@$%^&*()+}{[]'\"><,?;:.";

	for (var i = 0; i < inValidChars.length; i++)
	{
		if (name.indexOf(inValidChars.charAt(i), 0) > -1)
		{
			alert("The provided title name contains '" + inValidChars.charAt(i) + "' invalid character.");
			return false;
		}
	}
	return true;
}

function setValues(pageId, show)
{
	document.forms[0].showSite.value = show;
	document.forms[0].Pages.value = pageId;
	if (typeof document.forms[0].isEditMode != "undefined")
	{
		document.forms[0].isEditMode.value = 0;
	}
	document.forms[0].action = "edit_pages2.aspx";
	document.forms[0].submit();
}

function openSearch()
{
	document.forms[0].action = document.forms[0].communities.options[document.forms[0].communities.selectedIndex].value;
	document.forms[0].submit();
}

var winPhotoGallery = null;

function openImageUploadWindow(id)
{
	var today = new Date();
	var t,l,features;
	l = (screen.availWidth-600) / 2;
	t = (screen.availHeight-500) / 2;
	features = ",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	     	
	winPhotoGallery = window.open("../webPresence/image_gallery.aspx?Id=" + id + "&todayDateTime=" + today,
								"ImageGalleryWindow", "toolbar=0,width=600,height=500,resizable=0,scrollbars=yes,status=yes,menubar=0"+features);
}

function colseImageUploadWindow()
{
	if (winPhotoGallery != null)
	{
		if (!winPhotoGallery.closed)
		{
			winPhotoGallery.close();
		}
	}
}

function clearHiddenField(fieldName)
{
	document.forms[0].elements[fieldName].src = "layouts/images/nopic.gif";
	hiddenFieldId= new String(fieldName.substring(fieldName.indexOf("_") + 1, fieldName.length));
	document.forms[0].elements["caption" + hiddenFieldId].value = "";
	document.forms[0].elements["size" + hiddenFieldId].options.selectedIndex = 0;
	document.forms[0].elements["imageId_" + hiddenFieldId].value = "";
}

function webSiteMessage()
{
	alert("Please create your website before viewing it.");
	return false;
}

function openEditMode(editMode)
{
	document.forms[0].isEditMode.value = editMode;
	document.forms[0].action = "edit_pages2.aspx";
	if (typeof document.forms[0].showSite != "undefined")
		document.forms[0].showSite.value = '0';
	document.forms[0].submit();
}

function setImageStaus(profileName, communityId, imStatus, submitForm, path)
{
	if (submitForm == "1")
	{
		if (path != "")
			document.forms[0].action = path;
		document.forms[0].hiddenProfileName.value = profileName;
		document.forms[0].hiddenCommunityId.value = communityId;
		document.forms[0].hiddenImStatus.value = imStatus;
		document.forms[0].submit();
	}
	else
	{
		alert("This functionality is currently unavailable.\n\nPlease save changes to your community profile before using this functionality.");
		return false;
	}
}

function showImageStausMessage()
{
	
	location.href="profile_incomplete.aspx";
	return false;
}

function showIMMessageForProfile()
{
	alert("This functionality is currently unavailable.\n\nPlease create/edit your community profile before using this functionality.");
	return false;
}
function openHelpWindow(page)
{
	var helpwindow;
	     		
	helpwindow= window.open("/Help/"+page);
	return false;
}

function NoHelpAttached()
{
	alert("No help is available yet.");
	return false;
}
function openPrintWindow(WorOrderID,opt,Email,FName,FormCode)
{
	var chatWindow;

	//chatWindow = window.open("../../build.aspx?id=" + member, "winControlApplet", "width=100,height=100,directories=no,fullscreen=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
	if (opt=="Email")
	{
		var t,l,features;
		l = (screen.availWidth-760) / 2;
		t = (screen.availHeight-710) / 2;
		features = ",left="+l+",top="+t;
		features += ",screenX="+l+",screenY="+t;
		
		chatWindow = window.open("../Reports/TemplateA_SingleRecordWorkOrder.aspx?WorkOrderID=" + WorOrderID + "&opt="+ opt +"&Email="+Email +"&FName="+FName +"&FormCode="+FormCode, "_blank", "width=760,height=710,directories=no,fullscreen=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no"+features);
	}
	if(opt=="EmailWO")
	{
		var t,l,features;
		l = (screen.availWidth-760) / 2;
		t = (screen.availHeight-710) / 2;
		features = ",left="+l+",top="+t;
		features += ",screenX="+l+",screenY="+t;
	    
		chatWindow = window.open("../Reports/PrintWorkOrder.aspx?WorkOrderID=" + WorOrderID + "&opt="+ opt+"&Email="+Email +"&FName="+FName +"&FormCode="+FormCode, "_blank", "width=760,height=710,directories=no,fullscreen=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no"+features);
	}
	if(opt=="Print")
	{
		var t,l,features;
		l = (screen.availWidth-760) / 2;
		t = (screen.availHeight-710) / 2;
		features = ",left="+l+",top="+t;
		features += ",screenX="+l+",screenY="+t;
	    
		chatWindow = window.open("../Reports/PrintWorkOrder.aspx?WorkOrderID=" + WorOrderID + "&opt="+ opt+"&Email="+Email +"&FName="+FName +"&FormCode="+FormCode, "_blank", "width=760,height=710,directories=no,fullscreen=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no"+features);
	}
	if(opt=="Loaner")
	{
		var t,l,features;
		l = (screen.availWidth-760) / 2;
		t = (screen.availHeight-710) / 2;
		features = ",left="+l+",top="+t;
		features += ",screenX="+l+",screenY="+t;
	    
		chatWindow = window.open("../Reports/PrintWorkOrder.aspx?WorkOrderID=" + WorOrderID + "&opt="+ opt+"&Email="+Email +"&FName="+FName +"&FormCode="+FormCode, "_blank", "width=760,height=710,directories=no,fullscreen=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no"+features);
	}
	if(opt=="PrintLoanerRequest")
	{
		var t,l,features;
		l = (screen.availWidth-760) / 2;
		t = (screen.availHeight-710) / 2;
		features = ",left="+l+",top="+t;
		features += ",screenX="+l+",screenY="+t;
	    
		chatWindow = window.open("../Reports/PrintLoanerRequest.aspx?WorkOrderID=" + WorOrderID + "&opt="+ opt+"&Email="+Email +"&FName="+FName +"&FormCode="+FormCode, "_blank", "width=760,height=710,directories=no,fullscreen=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no"+features);
	}
	if(opt=="PackingList")
	{
		var t,l,features;
		l = (screen.availWidth-760) / 2;
		t = (screen.availHeight-710) / 2;
		features = ",left="+l+",top="+t;
		features += ",screenX="+l+",screenY="+t;
	    
		chatWindow = window.open("../Reports/PackingList.aspx?WorkOrderID=" + WorOrderID + "&opt="+ opt+"&Email="+Email +"&FName="+FName +"&FormCode="+FormCode, "_blank", "width=760,height=710,directories=no,fullscreen=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no"+features);
	}
	if(opt=="PrintPickList")
	{
		var t,l,features;
		l = (screen.availWidth-760) / 2;
		t = (screen.availHeight-710) / 2;
		features = ",left="+l+",top="+t;
		features += ",screenX="+l+",screenY="+t;
	    
		chatWindow = window.open("../Reports/PrintPickList.aspx?WorkOrderID=" + WorOrderID + "&opt="+ opt+"&Email="+Email +"&FName="+FName +"&FormCode="+FormCode, "_blank", "width=760,height=710,directories=no,fullscreen=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no"+features);
	}
	//chatWindow.blur();
	return false;
	//focusTO = setTimeout("setFocus()", 5000);
}

function openCheckWindow(WorOrderID,FormCode,ModelID)
{
	var chatWindow,t,l,features;
	l = (screen.availWidth-695) / 2;
	t = (screen.availHeight-710) / 2;
	features = ",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	
	chatWindow = window.open("../Reports/RptCheckSheetGroup.aspx?WorkOrderID=" + WorOrderID + "&FormCode="+ FormCode +"&ModelID="+ModelID , "_blank", "width=695,height=710,directories=no,fullscreen=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no"+features);
	return false;
}

function setFocus()
{
	window.focus();
}

function offlineMessage()
{
	alert("You cannot send message to member\nbecause his or her status is set to offline.");
}

function friendsOnlyMessage()
{
	alert("You cannot send message to member\nbecause you don't have access to profile 2 and 3.");
}

function blockMessage()
{
	alert("You have been blocked by the Member.");
}

function validateCaption(caption) 
{
	invalidChar = new String("~!@#$%^&*()+}{[]'\"><,?;:.");
	providedCaption = new String(trims(caption.value));
	for (var i = 0; i < invalidChar.length; i++)
	{
		if (providedCaption.indexOf(invalidChar.charAt(i), 0) > -1)
		{
			alert("The provided caption for the uploaded file contains this '" + invalidChar.charAt(i) + "' invalid character.");
			caption.value = "";
			return false;
		}
	}
}
function viewYourProfile(levelValue){
	document.forms[0].level.value = levelValue ;
	document.forms[0].destination.value = "VP" ;
	document.forms[0].submit();
}
function showMessageInfo(levelValue ){
	
	location.href="profile_incomplete.aspx"
	return false;
	/*document.forms[0].level.value = levelValue ;
	document.forms[0].destination.value = "PIC" ;
	document.forms[0].submit();*/
	
	//alert("You have to create your level "+level+" profile before viewing it.");
	//return ;
}
function clearSelections(theform)
{
	for(var i=0;i<theform.elements.length;i++)
	{
		// if it is a radio button, then make it unchecked....
		if(theform.elements[i].type=="radio")
		{
			theform.elements[i].checked=false;
		}
	}
	return false;
}
			
function openImageWin(imageUrl,userName)
{
	var t,l,features;
	l = (screen.availWidth-600) / 2;
	t = (screen.availHeight-500) / 2;
	features = ",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	
	aWindowLoad = window.open("../includes/photoGallery_enlarge.aspx?imageUrl="+imageUrl+"&userName="+userName,"openAppropriateWindow", "toolbar=0,width=600,height=500,resizable=0,scrollbars=yes,status=yes,menubar=0"+features);
}
function isValidNickName(nickName)
	{
		var inValidChars="'<>/\\"
		var chr;
		if(nickName.length<3)
		{
			alert("Nick name must be atleast 3 characters long.");
			return false;
		} 
		for (var i = 0; i < nickName.length; i++)
		{
			chr = nickName.charAt(i);
			if (inValidChars.indexOf(chr)!=-1)
			{
				alert("The provided nickname contains '" + chr + "' invalid character.");
				return false;
			}
		}
		
		return true;
		
	}

function openSendMailWindow(profileName, communityId,profileId,ownerProfileName)
{
	
	if(trims(ownerProfileName)=="")
	{
		location.href="profile_incomplete.aspx";
		return false;
	}
	
	var t,l,features;
	l = (screen.availWidth-565) / 2;
	t = (screen.availHeight-370) / 2;
	
	if (l < 0) {l = 0;}
	if (t < 0) {t = 0;}
	
	features = ",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	
	mailWin=window.open("../includes/sendMail.aspx?profileName=" + profileName + "&communityId=" + communityId+"&ProfileId="+profileId,
				"", "toolbar=no,width=565,height=370,status=yes,scrollbars=no,resize=no,menubar=no"+features);
	return false;
}

function doesContainHtmlTags(name,thevalue)
{
	
	if(thevalue.indexOf(">") >-1 )
	{
		alert("Your "+name+" contains invalid character '>'.");
		return true;
	}
	else if(thevalue.indexOf("<")>-1)
	{
		alert("Your "+name+" contains invalid character '<'.");
		return true;
	}
	return false;
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

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];}
}


/*
=================================================================================
	Function Name : openAddPartPopup
	Synopsis	  : Open SearchPart popup, so that user can select part
	
	
	Created On    : 21-Jan-2003
	Author		  : YAS
	TODO		  : Name of check box should come as parameter
=================================================================================
*/
function openAddPartPopup(workOrderId,repairCodeList,sourceForm,ModelGroupId)
	{

		var t,l,features;
		l = (screen.availWidth-820) / 2;
		t = (screen.availHeight-600) / 2;
		
		if (l < 0) {l = 0;}
		if (t < 0) {t = 0;}
		
		features = ",left="+l+",top="+t;
		features += ",screenX="+l+",screenY="+t;
	
		if (repairCodeList != "")
		{
			window.open("../Equipments/Parts/SearchParts.aspx?ModelGroupId="+ModelGroupId+"&workOrderId="+workOrderId+"&repairCodeList="+repairCodeList+"&src="+sourceForm,"SelectRepairs","height=600, width=820, toolbar=no, status=yes,resizable =0, scrollbars=1"+features);
		}
		else 
		{
	
		window.open("../Equipments/Parts/SearchParts.aspx?ModelGroupId="+ModelGroupId+"&workOrderId="+ workOrderId + "&src="+sourceForm,"SelectRepairs","height=600, width=820, toolbar=no, status=yes,resizable =0, scrollbars=1"+features);
		}
		
		return false;		
	}	

	/*
=================================================================================
	Function Name : isAnyCheckBoxSelected
	Synopsis	  : Return a boolean value indicating wether any check box is 
					checked or not......
	Created On    : 21-Jan-2003
	Author		  : YAS
	TODO		  : Name of check box should come as parameter
=================================================================================
*/
		
	function isAnyCheckBoxSelected(chkBoxName)
	{
		for(var i=0;i<document.forms[0].length;i++)
		{
			if(document.forms[0].elements[i].type=="checkbox")
			{
				if(document.forms[0].elements[i].name.indexOf(chkBoxName)>-1 && document.forms[0].elements[i].checked)
				{
					return true;	
				}						
			}
		}
	
		return false;
		
	}
	
	
	
				/*
	=================================================================================
		Function Name : confirmPartDeletion
		Synopsis	  : confirm from user of part deletion. If no checkbox is checked, then 
						give him error message
		Created On    : 21-Jan-2003
		Author		  : YAS
		TODO		  : Name of check box should come as parameter
	=================================================================================
	*/

	function confirmPartDeletion()
	{	
	
	
		if(!isAnyCheckBoxSelected("chkPart"))
		{
			alert("Please select part(s) which you want to remove");
			return false
		}
		return confirm("You have selected to remove part(s). This action is irreversible. Are you sure you want to continue?")
	}
	
	
		/*
	=================================================================================
		Function Name : confirmRepairDeletion
		Synopsis	  : confirm from user of repair deletion. If no checkbox is checked, then 
						give him error message
		Created On    : 13-Feb-2003
		Author		  : YAS
	
	=================================================================================
	*/

	function confirmRepairDeletion()
	{	
		var str
		if(!isAnyCheckBoxSelected("chkRepair"))
		{
			alert("Please select repair(s) which you want to remove");
			return false
		}
		str="You have selected to remove repairs(s). This action is irreversible.Corresponding parts of approved repairs\n"
		str=str + "would also be deleted. Are you sure you want to continue?"
		//return confirm("You have selected to remove repairs(s). This action is irreversible. Are you sure you want to continue?")
		return confirm(str)
	}	


/*
	=================================================================================
		Function Name : confirmDefectDeletion
		Synopsis	  : confirm from user of defect deletion. If no checkbox is checked, then 
						give him error message
		Created On    : 13-Feb-2003
		Author		  : YAS
	
	=================================================================================
	*/

	function confirmDefectDeletion()
	{	
	
		
		if(!isAnyCheckBoxSelected("chkDefect"))
		{
			alert("Please select defects(s) which you want to remove");
			return false
		}
		return confirm("You have selected to remove defect(s). This action is irreversible. Are you sure you want to continue?")
	}

/*
	=================================================================================
		Synopsis	  : To Open child window 
		Created On    : 17-July-2004
		Author		  : Shujaat Ali
	=================================================================================
	*/

function img_OnClick(URL,Title,Height,Width)
{
	var features;
	var winChild;
	l = (screen.availWidth-Width) / 2;
	t = (screen.availHeight-Height) / 2;
	
	features = ",left="+l+",top="+t;
    features += ",screenX="+l+",screenY="+t;
	
	winChild = window.open(URL ,Title,"height="+Height+", width="+Width+", toolbar=no, status=no,resizable =0, scrollbars=1"+features);
	return false;
}

function openLinkedWO(woid)
{
	var t,l,features;	
	l = (screen.availWidth-820) / 2;
	t = (screen.availHeight-600) / 2;
	
	features = ",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	window.open("viewWorkOrder.aspx?ChildWin=2&h_WorkOrderNumber=" + woid + "&h_Operation=EDIT","LinkWO","height=600, width=820, toolbar=no, status=no,resizable =0, scrollbars=1"+features);
	return false;
}
