<!--

var logoPath = "http://www.pendragonplc.com/usedcarphotos/logos/";
var photoPath = "http://www.pendragonplc.com/usedcarphotos/garages/";
	
function MenuPopout(item)
{
	document.getElementById("Menu" + item + "Popout").style.visibility = "visible";
	document.getElementById("PopoutNav" + item).style.visibility = "visible";
}

function MenuPopin(item)
{
	document.getElementById("Menu" + item + "Popout").style.visibility = "hidden";
	document.getElementById("PopoutNav" + item).style.visibility = "hidden";
}

function NavOver(item)
{
	item.children[0].style.color = "#FFFF00";
}

function NavOut(item)
{
	item.children[0].style.color = "";
}

function Navigate(item)
{
	item.children[0].click();
}

function FillLocationDetails(id)
{
	if(id == 0)
	{
		ClearDetails();
		return;
	}
	
	var locationObject = FindLocation(id);

	SetDisplayedLocation(locationObject);
	SetBrand(locationObject);
	SetRegion(locationObject);
	SetImages(locationObject);
	SetContactDetails(locationObject);
	SetReference(locationObject);
}

function SetDisplayedLocation(locationObject)
{
	var docFrm = document.forms[0];
	
	docFrm.DisplayedLocation.value = locationObject.Location;
}

function ClearDetails()
{
	var docFrm = document.forms[0];
	
	docFrm.Brands.selectedIndex = 0;
	docFrm.Regions.selectedIndex = 0;
	docFrm.LogoImage.src = "../Images/NoImage.gif";
	docFrm.PhotoImage.src = "../Images/NoImage.gif";
	
	docFrm.ContactAddress1.value = "";
	docFrm.ContactAddress2.value = "";
	docFrm.ContactAddress3.value = "";
	docFrm.ContactAddress4.value = "";
	docFrm.ContactPostCode.value = "";
	docFrm.ContactEmail.value = "";
	docFrm.ContactTelephone.value = "";
}

function SetImages(locationObject)
{
	var docFrm = document.forms[0];
	var logoImage = docFrm.LogoImage;
	var photoImage = docFrm.PhotoImage;
	var noImage = "../Images/NoImage.gif";

	
	logoImage.src = locationObject.Logo != "" ? logoPath + locationObject.Logo : logoPath + "pendragon.jpg";
	photoImage.src = locationObject.Photo != "" ? photoPath + locationObject.Photo : noImage;
}

function SetPhoto()
{
	var docFrm = document.forms[0];
	var locations = docFrm.Locations;
	var photoImage = docFrm.PhotoImage;
	var noImage = "../Images/NoImage.gif";
	
	if(locations.value < 1)
	{
		photoImage.src = noImage;
		return;
	}
	
	var locationObject = FindLocation(locations.value);
	photoImage.src = locationObject.Photo != "" ? photoPath + locationObject.Photo : noImage;
}

function SetLogo()
{
	var docFrm = document.forms[0];
	var brands = docFrm.Brands;
	var logoImage = docFrm.LogoImage;
	
	if(brands.value < 1)
	{
		logoImage.src = logoPath + "pendragon.jpg";
		return;
	}
	
	var locationObject = FindLocationByBrand(brands.value);
	logoImage.src = locationObject.Logo != "" ? logoPath + locationObject.Logo : logoPath + "pendragon.jpg";
}

function SetBrand(locationObject)
{
	var brands = document.forms[0].Brands;
	
	if(brands.value == locationObject.CompanyId) return;
	
	for(var i=0; i < brands.children.length; i++)
	{
		if(brands.children[i].value == locationObject.CompanyId)
		{
			brands.selectedIndex = i;
			return;
		}
	}
	brands.selectedIndex = 0;
}

function SetRegion(locationObject)
{
	var regions = document.forms[0].Regions;
	
	if(regions.value == locationObject.RegionId) return;
	
	for(var i=0; i < regions.children.length; i++)
	{
		if(regions.children[i].value == locationObject.RegionId)
		{
			regions.selectedIndex = i;
			return;
		}
	}
	regions.selectedIndex = 0;
}

function SetReference(locationObject)
{
	var d = new Date();
	var docFrm = document.forms[0];

	var s = locationObject.Location.substring(0,10);	
	// Remove spaces from References
	s = s.replace(/\s/g, '');
	//alert(s);
	s = s.substring(0,3);
	//alert(s);

	var ref = s.toUpperCase() + "/" + locationObject.LocationId + "/" + d.getMilliseconds();

	
	docFrm.ReferenceId.value = ref;
}

function SetContactDetails(locationObject)
{
	var docFrm = document.forms[0];
	docFrm.ContactAddress1.value = locationObject.Address1 != "" ? locationObject.Address1 : "";
	docFrm.ContactAddress2.value = locationObject.Address2 != "" ? locationObject.Address2 : "";
	docFrm.ContactAddress3.value = locationObject.Address3 != "" ? locationObject.Address3 : "";
	docFrm.ContactAddress4.value = locationObject.Address4 != "" ? locationObject.Address4 : "";
	docFrm.ContactPostCode.value = locationObject.PostCode != "" ? locationObject.PostCode : "";
	docFrm.ContactEmail.value = locationObject.Email != "" ? locationObject.Email : "";
	docFrm.ContactTelephone.value = locationObject.Telephone != "" ? locationObject.Telephone : "";
}

function FindLocation(id)
{
	for(var i=0; i < la.length; i++)
		if(la[i].LocationId == id)
			return la[i];
}

function FindLocationByBrand(id)
{
	for(var i=0; i < la.length; i++)
		if(la[i].CompanyId == id)
			return la[i];
}

function ChangeContentTable(tableNumber)
{
	Content1.style.display = "none";
	Content2.style.display = "none";
	Content3.style.display = "none";
	
	eval("Content" + tableNumber).style.display = "block";
	
}

function SwitchTab(tabNumber)
{
	var docFrm = document.forms[0];
	switch(tabNumber)
	{
		case "1":
			docFrm.Tab1.src = "../Images/1Tab.gif";
			docFrm.Tab2.src = "../Images/2Tab_in_1out.gif";
			docFrm.Tab3.src = "../Images/3Tab_in.gif";
			break;
		case "2":
			docFrm.Tab1.src = "../Images/1Tab_in_2out.gif";
			docFrm.Tab2.src = "../Images/2Tab.gif";
			docFrm.Tab3.src = "../Images/3Tab_in.gif";
			break;
		case "3":
			docFrm.Tab1.src = "../Images/1Tab_in_3out.gif";
			docFrm.Tab2.src = "../Images/2Tab_in_3out.gif";
			docFrm.Tab3.src = "../Images/3Tab.gif";
			break;
	}	
	
	ChangeContentTable(tabNumber);		
}

function SaveJob()
{
	if(ValidateForm())
		document.forms[0].submit();
}

function ValidateForm()
{
	var docFrm = document.forms[0];
	var errors = "The Form requires these fields to be populated:              \n";
	var isValid = true;

	if(docFrm.ReferenceId.value.length == 0)
	{	
		errors += "\n\t *  A reference id is required.";
		isValid = false;
	}

	if(docFrm.Locations.value == 0)
	{
		errors += "\n\t *  A location is required.";
		isValid = false;
	}

	if(docFrm.Regions.value == 0)
	{
		errors += "\n\t *  A region is required.";
		isValid = false;
	}
	
	if(docFrm.DisplayedLocation.value.length == 0)
	{
		errors += "\n\t *  A displayed location is required.";
		isValid = false;
	}

	if(docFrm.Brands.value == 0)
	{
		errors += "\n\t *  A brand is required.";
		isValid = false;
	}

	if(docFrm.Heading1.value.length == 0)
	{
		errors += "\n\t *  A job title is required.";
		isValid = false;	
	}

	if(docFrm.Paragraph1.value.length == 0)
	{
		errors += "\n\t *  A job summary is required.";
		isValid = false;	
	}

	if(docFrm.Categories.selectedIndex == -1)
	{
		errors += "\n\t *  A category is required.";
		isValid = false;	
	}

	if(docFrm.PositionTypes.value == 0)
	{
		errors += "\n\t *  A position type is required.";
		isValid = false;
	}

	if(docFrm.PublishDate.value.length == 0)
	{
		errors += "\n\t *  A publish date is required.";
		isValid = false;	
	}

	if(docFrm.ExpiryDate.value.length == 0)
	{
		errors += "\n\t *  A expiry date is required.";
		isValid = false;	
	}

	if(docFrm.Salary.value.length == 0)
	{
		errors += "\n\t *  A salary is required.";
		isValid = false;	
	}

	if(docFrm.ContactName.value.length == 0)
	{
		errors += "\n\t *  A contact name is required.";
		isValid = false;	
	}

	if(docFrm.ContactTelephone.value.length == 0)
	{
		errors += "\n\t *  A contact telephone is required.";
		isValid = false;	
	}

	if(docFrm.ContactEmail.value.length == 0)
	{
		errors += "\n\t *  A contact email is required.";
		isValid = false;	
	}

	if(docFrm.ContactAddress1.value.length == 0)
	{
		errors += "\n\t *  A contact address 1 is required.";
		isValid = false;	
	}

	if(docFrm.ContactAddress2.value.length == 0)
	{
		errors += "\n\t *  A contact address 2 is required.";
		isValid = false;	
	}

	if(docFrm.ContactAddress3.value.length == 0)
	{
		errors += "\n\t *  A contact address 3 is required.";
		isValid = false;	
	}

	if(docFrm.ContactPostCode.value.length == 0)
	{
		errors += "\n\t *  A contact post code is required.";
		isValid = false;	
	}

	if(!isValid)
	{
		alert(errors);
		return false;
	}
	else
		return true;
	
	
}

function DeleteJob(jobId)
{
	if(!confirm("Are you sure you want to delete this job?"))return;
	
	var docFrm = document.forms[0];
	docFrm.JobIdToDelete.value = jobId;
	docFrm.submit();
}

// ********************************************************************************
// category admin

function CatInit()
{
	var docFrm = document.forms[0];
	
	if(docFrm.CategoryList.options.length > 0)
	{
		if(arguments.length > 0)
			docFrm.CategoryList.selectedIndex = docFrm.CategoryList.length-1;
		else
			docFrm.CategoryList.selectedIndex = 0;

		SelectCategory();
		ToggleButtons("show");
	}
	else
		ToggleButtons("hide");

	docFrm.CategoryName.value = "";
	docFrm.CategoryName.focus();	
}

function ChangeCategoryActive(categoryId, status)
{
	for(var i=0; i < categories.length; i++)
	{
		if(categories[i][0] == categoryId)
		{
			categories[i][1] = status;
			break;
		}
	}
}

function AddToCategoryArray(categoryId, status)
{
	categories.push(new Array(categoryId, status));
}

function RemoveFromCategoryArray(categoryId)
{
	for(var i=0; i < categories.length; i++)
	{
		if(categories[i][0] == categoryId)
		{
			categories.splice(i, 1);
			break;
		}
	}
}

function IsCategoryActive(categoryId)
{
	for(var i=0; i < categories.length; i++)
	{
		if(categories[i][0] == categoryId)
			return categories[i][1] == 1 ? true : false;
	}

	return false;
}

function RemoveCategory()
{
	var docFrm = document.forms[0];
	
	if(!confirm("Warning!!!  This will remove any jobs within this category.\n\nDo you want to continue?"))
		return;

	var callObject = WebServiceBehaviour.createCallOptions();
	callObject.funcName = "RemoveCategory";
	callObject.async = false;
	callObject.params = new Array();
	callObject.params.categoryId = docFrm.CategoryList.value;
	callId = WebServiceBehaviour.WebService.callService(callObject);
	
	if(callId.error) 
	{
		ShowError(callId);
		return;
	}

	RemoveFromCategoryArray(docFrm.CategoryList.value);
	docFrm.CategoryList.remove(docFrm.CategoryList.selectedIndex);
	CatInit();
}

function AddCategory()
{
	var doc = document;
	var docFrm = doc.forms[0];
	if(docFrm.CategoryName.value.length == 0) return;
	

	var callObject = WebServiceBehaviour.createCallOptions();
	callObject.funcName = "InsertCategory";
	callObject.async = false;
	callObject.params = new Array();
	callObject.params.categoryName = docFrm.CategoryName.value;
	callId = WebServiceBehaviour.WebService.callService(callObject);
	
	if(callId.error) 
	{
		ShowError(callId);
		return;
	}

	var opt = doc.createElement("OPTION")
	docFrm.CategoryList.add(opt);

	opt.innerText = docFrm.CategoryName.value;
	opt.value = callId.value;
	AddToCategoryArray(callId.value, "1");
	CatInit('last');
}

function EditCategory()
{
	var docFrm = document.forms[0];
	if(docFrm.CategoryNameEdit.value.length == 0) return;	

	var status = (docFrm.ActiveChk.checked == true) ? "1" : 0;
	
	var callObject = WebServiceBehaviour.createCallOptions();
	callObject.funcName = "EditCategory";
	callObject.async = false;
	callObject.params = new Array();
	callObject.params.categoryId = docFrm.CategoryList.value;
	callObject.params.categoryName = docFrm.CategoryNameEdit.value;
	callObject.params.active = status;
	callId = WebServiceBehaviour.WebService.callService(callObject);
	
	if(callId.error) 
	{
		ShowError(callId);
		return;
	}

	docFrm.CategoryList.options[docFrm.CategoryList.selectedIndex].text = docFrm.CategoryNameEdit.value;
	ChangeCategoryActive(docFrm.CategoryList.value, status);
	docFrm.SaveButton.disabled = true;
}

function SelectCategory()
{
	var docFrm = document.forms[0];
	docFrm.CategoryNameEdit.detachEvent("onpropertychange", EnableSaveButton);
	docFrm.ActiveChk.detachEvent("onpropertychange", EnableSaveButton);
	docFrm.SaveButton.disabled = true;
	docFrm.RemoveButton.disabled = false;
	docFrm.CategoryNameEdit.value = docFrm.CategoryList.options[docFrm.CategoryList.selectedIndex].text;
	docFrm.ActiveChk.checked = IsCategoryActive(docFrm.CategoryList.value);
	docFrm.CategoryNameEdit.attachEvent("onpropertychange", EnableSaveButton);
	docFrm.ActiveChk.attachEvent("onpropertychange", EnableSaveButton);
}
// ********************* End Category Admin

// ********************************************************************************
// source admin

function SourceInit()
{
	var docFrm = document.forms[0];
	
	if(docFrm.SourceList.options.length > 0)
	{
		if(arguments.length > 0)
			docFrm.SourceList.selectedIndex = docFrm.SourceList.length-1;
		else
			docFrm.SourceList.selectedIndex = 0;

		SelectSource();
		ToggleButtons("show");
	}
	else
		ToggleButtons("hide");

	docFrm.SourceName.value = "";
	docFrm.SourceName.focus();	
}

function ChangeSourceActive(sourceId, status)
{
	for(var i=0; i < sources.length; i++)
	{
		if(sources[i][0] == sourceId)
		{
			sources[i][1] = status;
			break;
		}
	}
}

function AddToSourceArray(sourceId, status)
{
	sources.push(new Array(sourceId, status));
}

function RemoveFromSourceArray(sourceId)
{
	for(var i=0; i < sources.length; i++)
	{
		if(sources[i][0] == sourceId)
		{
			sources.splice(i, 1);
			break;
		}
	}
}

function IsSourceActive(sourceId)
{
	for(var i=0; i < sources.length; i++)
	{
		if(sources[i][0] == sourceId)
			return sources[i][1] == 1 ? true : false;
	}

	return false;
}

function RemoveSource()
{
	var docFrm = document.forms[0];
	
	if(!confirm("Warning!!!  Are you sure you want to delete this source?"))
		return;

	var callObject = WebServiceBehaviour.createCallOptions();
	callObject.funcName = "RemoveSource";
	callObject.async = false;
	callObject.params = new Array();
	callObject.params.sourceId = docFrm.SourceList.value;
	callId = WebServiceBehaviour.WebService.callService(callObject);
	
	if(callId.error) 
	{
		ShowError(callId);
		return;
	}

	RemoveFromSourceArray(docFrm.SourceList.value);
	docFrm.SourceList.remove(docFrm.SourceList.selectedIndex);
	SourceInit();
}

function AddSource()
{
	var doc = document;
	var docFrm = doc.forms[0];
	if(docFrm.SourceName.value.length == 0) return;
	

	var callObject = WebServiceBehaviour.createCallOptions();
	callObject.funcName = "InsertSource";
	callObject.async = false;
	callObject.params = new Array();
	callObject.params.sourceName = docFrm.SourceName.value;
	callId = WebServiceBehaviour.WebService.callService(callObject);
	
	if(callId.error) 
	{
		ShowError(callId);
		return;
	}

	var opt = doc.createElement("OPTION")
	docFrm.SourceList.add(opt);

	opt.innerText = docFrm.SourceName.value;
	opt.value = callId.value;
	AddToSourceArray(callId.value, "1");
	SourceInit('last');
}

function EditSource()
{
	var docFrm = document.forms[0];
	if(docFrm.SourceNameEdit.value.length == 0) return;	

	var status = (docFrm.ActiveChk.checked == true) ? "1" : 0;
	
	var callObject = WebServiceBehaviour.createCallOptions();
	callObject.funcName = "EditSource";
	callObject.async = false;
	callObject.params = new Array();
	callObject.params.sourceId = docFrm.SourceList.value;
	callObject.params.sourceName = docFrm.SourceNameEdit.value;
	callObject.params.active = status;
	callId = WebServiceBehaviour.WebService.callService(callObject);
	
	if(callId.error) 
	{
		ShowError(callId);
		return;
	}

	docFrm.SourceList.options[docFrm.SourceList.selectedIndex].text = docFrm.SourceNameEdit.value;
	ChangeSourceActive(docFrm.SourceList.value, status);
	docFrm.SaveButton.disabled = true;
}

function SelectSource()
{
	var docFrm = document.forms[0];
	docFrm.SourceNameEdit.detachEvent("onpropertychange", EnableSaveButton);
	docFrm.ActiveChk.detachEvent("onpropertychange", EnableSaveButton);
	docFrm.SaveButton.disabled = true;
	docFrm.RemoveButton.disabled = false;
	docFrm.SourceNameEdit.value = docFrm.SourceList.options[docFrm.SourceList.selectedIndex].text;
	docFrm.ActiveChk.checked = IsSourceActive(docFrm.SourceList.value);
	docFrm.SourceNameEdit.attachEvent("onpropertychange", EnableSaveButton);
	docFrm.ActiveChk.attachEvent("onpropertychange", EnableSaveButton);
}
// ********************* End Source Admin

// Generic Admin functions
function ToggleButtons(status)
{
	var docFrm = document.forms[0];
	
	if(status == "hide")
	{
		EditDiv.style.visibility = "hidden";
		docFrm.SaveButton.style.visibility = "hidden";
		docFrm.RemoveButton.style.visibility = "hidden";
	}
	else
	{
		EditDiv.style.visibility = "visible";
		docFrm.SaveButton.style.visibility = "visible";
		docFrm.RemoveButton.style.visibility = "visible";
	}
}

function EnableSaveButton()
{
	var docFrm = document.forms[0];
	
	if(window.event.propertyName == "value" || window.event.propertyName == "checked")
		docFrm.SaveButton.disabled = false;
}


function ShowError(result)
{
	var xfaultcode   = result.errorDetail.code;
	var xfaultstring = result.errorDetail.string;
	var xfaultsoap   = result.errorDetail.raw;
	alert(xfaultcode+"\r\n"+xfaultstring+"\r\n"+xfaultsoap);
}

function HandleError()
{
	return false;
}
// End functons
function Vacancies(words)
{
	var docFrm = document.forms[0];
	var searchwords = document.createElement("<input type='hidden' value='"+ words +"' name='Keywords' />")
	var jobIds = document.createElement("<input type='hidden' value='' name='SelectedJobs' />")
	docFrm.appendChild(searchwords);
	docFrm.appendChild(jobIds);
	docFrm.action = "SearchResults.aspx";
	docFrm.submit();
}

function ChangeExpiryDate(addedDays)
{
	document.forms[0].ExpiryDate.value = CalculateDate(window.event.dateValue, addedDays);
}

function CalculateDate(inDate, addedDays)
{
	var day = inDate.substring(0, 2);
	var month = inDate.substring(3, 5);
	var year = inDate.substring(6, 12);

	var date = new Date(year + "/" + month + "/" + day)

	date.setDate(date.getDate() + addedDays);

	day = new String(date.getDate());
	month = new String(date.getMonth()+1);
	year = new String(date.getYear());

	day = (day.length == 1) ? "0" + day : day;
	month = (month.length == 1) ? "0" + month : month;

	var returnDate = day + "/" + month + "/" + year;

	return returnDate;
}

// TEMPLATE SCRIPTS FROM HERE ON...



function SaveTemplate()
{
	if(ValidateTemplateForm())
		document.forms[0].submit();
}

function ValidateTemplateForm()
{
	var docFrm = document.forms[0];
	var errors = "The Form requires these fields to be populated:              \n";
	var isValid = true;

	if(docFrm.JobTemplates.selectedIndex == 0)
	{
		errors += "\n\t * Please select whether to create a New Template or alter an existing template..";
		isValid = false;	
	}

	if(docFrm.Heading1.value.length == 0)
	{
		errors += "\n\t *  A job title is required.";
		isValid = false;	
	}

	if(docFrm.Paragraph1.value.length == 0)
	{
		errors += "\n\t *  A job summary is required.";
		isValid = false;	
	}

	if(docFrm.Categories.selectedIndex == -1)
	{
		errors += "\n\t *  A category is required.";
		isValid = false;	
	}

	if(docFrm.PositionTypes.value == 0)
	{
		errors += "\n\t *  A position type is required.";
		isValid = false;
	}


	if(docFrm.Salary.value.length == 0)
	{
		errors += "\n\t *  A salary is required.";
		isValid = false;	
	}


	if(!isValid)
	{
		alert(errors);
		return false;
	}
	else
		return true;
	
}

function DeleteTemplate()
{
if (document.forms[0].JobTemplates.options[document.forms[0].JobTemplates.selectedIndex].value > 0)
{
	if(!confirm("Are you sure you want to delete this Template?"))return;
		var docFrm = document.forms[0];
		var TemplateIDToDelete = document.forms[0].JobTemplates.options[document.forms[0].JobTemplates.selectedIndex].value;
		docFrm.TemplateIdToDelete.value = TemplateIDToDelete;
		docFrm.submit();
} else {
alert("No template has been selected to Delete");
}
}

function FillTemplateDetails()
	{
 	  if (document.forms[0].JobTemplates.options[document.forms[0].JobTemplates.selectedIndex].value != 0 && document.forms[0].JobTemplates.options[document.forms[0].JobTemplates.selectedIndex].value != 1)
 		{
 	     var TempRow = document.forms[0].JobTemplates.options[document.forms[0].JobTemplates.selectedIndex].index - 2;
		//Set Text Boxes
		document.forms[0].Heading1.value = templateDetails[TempRow][1];
		document.forms[0].Paragraph1.value = templateDetails[TempRow][2];
		document.forms[0].Heading2.value = templateDetails[TempRow][3];
		document.forms[0].Paragraph2.value = templateDetails[TempRow][4];
		document.forms[0].Heading3.value = templateDetails[TempRow][5];
		document.forms[0].Paragraph3.value = templateDetails[TempRow][6];
		document.forms[0].Salary.value = templateDetails[TempRow][8];
		document.forms[0].Keywords.value = templateDetails[TempRow][10];
		document.forms[0].PositionTypes.selectedIndex = templateDetails[TempRow][7];
		catArray = templateDetails[TempRow][9].split(":");
		
		var chooseRow = 0;
		while (chooseRow < document.forms[0].Categories.options.length)
		{
			document.forms[0].Categories[chooseRow].selected = false;
			chooseRow++;
		 }
		    
		var rowno=0;
		while (rowno < catArray.length)
		{
		  //alert(catArray[rowno]);
		  var catno=0; 

		  while (catno < document.forms[0].Categories.options.length)
		    {
				if (trim(document.forms[0].Categories.options[catno].text) == trim(catArray[rowno]))
				{
				  document.forms[0].Categories[catno].selected = true;
				} 
				catno++;
		    }		    
		  rowno++;	  
		}		
	  }
	}

function ClearTemplateDetails()
	{
	  	document.forms[0].Heading1.value = "";
		document.forms[0].Paragraph1.value = "";
		document.forms[0].Heading2.value = "";
		document.forms[0].Paragraph2.value = "";
		document.forms[0].Heading3.value = "";
		document.forms[0].Paragraph3.value = "";
		document.forms[0].Salary.value  = "";
		document.forms[0].Keywords.value = "";
		document.forms[0].PositionTypes.selectedIndex = 0;
		
		  var catno=0; 
		  while (catno < document.forms[0].Categories.options.length)
		    {
				document.forms[0].Categories[catno].selected = false;
				catno++;
		    }
	}





function FillRecruitmentDetails()
{
	if (RecruitmentCodeHidden != "")
		{
		SetPhoto();
		SetLogo();
		FillLocationDetails(document.forms[0].Locations.options[document.forms[0].Locations.selectedIndex].value);
		}
}

  function trim(str)
	{
	return str.replace(/^\s*|\s*$/g,"");
	}

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function AddJobwithRecruitmentCode()
  {
var RCValue = document.forms[0].RecruitmentCodes.options[document.forms[0].RecruitmentCodes.selectedIndex].value;
	if (RCValue != 0)
	{
	document.location = "jobdetails.aspx?rr="+RCValue;
	} else
	{
		document.forms[0].JobTemplates.selectedIndex = 0;
	}
  }

function showPopUp()
{
  window.open('popup.asp','_blank','width=300,height=425,top=50,left=50,location=no,menubar=no,scrollbars=no,resizeable=no');
}


-->