function validate_form_upload(item, doc)
{
	
	var $title;
	var $response;
	var $errors;
	var $file;

	if(doc=='Y')
	{
	$file=item.user_selected_file.value;
	}
	else
	{
		$file="Not required";
	}
	
	
	$title=item.title.value;

	$response="Errors:- ";
	$errors=0;

	if (isEmpty($file))
	{
		$response+="Document not selected";
		$errors+=1;
	}
	
	if (isEmpty($title))
	{
		if ($errors!=0)
		{
			$response+=", ";
		}

		$response+="Title not present";
		$errors+=1;
	}

	$response+=".";
	

	if ($errors==0)
	{
//		alert ("OK");
		return true;
	}
	else
	{
		alert ($response);
		return false;
	}

}

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}



function changeCat(thisid, thispos, lastid, lastpos)
{
	var $this_id;
	var $this_pos;
	var $last_id;
	var $last_pos;
	
	$this_id=thisid;
	$this_pos=thispos;
	$last_id=lastid;
	$last_pos=lastpos;
	
if ($this_pos==0)
{
	alert ("Can't be done check position numbers");
	return false;
}

if ($this_pos==$last_pos)
{
	alert("Same position numbers");
	return false;
}

	$currentURL= "process/category_updates.php?act=pos&id=" + thisid + "&pos=" + lastpos + "&id2=" + lastid + "&pos2=" + thispos;
	location.href = $currentURL;
}



function changeCatAct(thisid, value)
{
	$currentURL= "process/category_updates.php?act=act&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function changeCatStatus(thisid, value)
{
	$currentURL= "process/category_updates.php?act=status&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function changeNewsStatus(thisid, value)
{
	$currentURL= "process/news_updates.php?act=status&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function confirmNewsDelete(id, path){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this record?');

	if(okToDelete){
	$currentURL=  "process/news_updates.php?act=del&id=" + id;
		location.href = $currentURL;
	}
}

function changeAnnStatus(thisid, value)
{
	$currentURL= "process/ann_updates.php?act=status&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function confirmAnnDelete(id, path){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this record?');

	if(okToDelete){
	$currentURL=  "process/ann_updates.php?act=del&id=" + id;
		location.href = $currentURL;
	}
}

function changeSS(section, thispos, lastpos)
{
//	alert("move this section up");

	$currentURL= "process/page_updates.php?act=posa&section=" + section + "&pos=" + thispos + "&pos2=" + lastpos;
	location.href = $currentURL;

}

function changePos(thisid, thispos, lastid, lastpos)
{
//	alert("move this page up");
	
	var $this_id;
	var $this_pos;
	var $last_id;
	var $last_pos;
	
	$this_id=thisid;
	$this_pos=thispos;
	$last_id=lastid;
	$last_pos=lastpos;
	
if ($this_pos==0)
{
	alert ("Can't be done check position numbers");
	return false;
}

if ($this_pos==$last_pos)
{
	alert("Same position numbers");
	return false;
}

	$currentURL= "process/page_updates.php?act=pos&id=" + thisid + "&pos=" + lastpos + "&id2=" + lastid + "&pos2=" + thispos;
	location.href = $currentURL;
}

function changeStatus(thisid, value)
{
	$currentURL= "process/page_updates.php?act=status&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

	
function confirmPageDelete(id, path){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this record?');

	if(okToDelete){
	$currentURL=  "process/page_updates.php?act=del&id=" + id;
		location.href = $currentURL;
	}
}

function changeDCSt(thisid, value)
{

$currentURL= "process/download_category_updates.php?act=status&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function changeDC(thisid, thispos, lastid, lastpos)
{
//	alert("move this page uo");
	
	var $this_id;
	var $this_pos;
	var $last_id;
	var $last_pos;
	
	$this_id=thisid;
	$this_pos=thispos;
	$last_id=lastid;
	$last_pos=lastpos;
	
if ($this_pos==0)
{
	alert ("Can't be done check position numbers");
	return false;
}

if ($this_pos==$last_pos)
{
	alert("Same position numbers");
	return false;
}

	$currentURL= "process/download_category_updates.php?act=pos&id=" + thisid + "&pos=" + lastpos + "&id2=" + lastid + "&pos2=" + thispos;
	location.href = $currentURL;
}


function changeDStatus(thisid, value)
{

$currentURL= "process/download_updates.php?act=status&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function changeDFP(thisid, value)
{

$currentURL= "process/download_updates.php?act=fp&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function confirmDownDelete(id, path){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this record?');

	if(okToDelete){
	$currentURL=  "process/download_updates.php?act=del&id=" + id;
		location.href = $currentURL;
	}
}

function confirmDCDelete(id, path){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this record?');

	if(okToDelete){
	$currentURL=  "process/download_category_updates.php?act=del&id=" + id;
		location.href = $currentURL;
	}
}

function recordDownload(doc, inc){
	var $currentURL = inc;
	
	$currentURL=  "index.php?inc=" + inc + "&doc=" + doc;
	location.href = $currentURL;

}

function changeSCSt(thisid, value)
{

$currentURL= "process/staff_category_updates.php?act=status&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function changeSC(thisid, thispos, lastid, lastpos)
{
//	alert("move this page uo");
	
	var $this_id;
	var $this_pos;
	var $last_id;
	var $last_pos;
	
	$this_id=thisid;
	$this_pos=thispos;
	$last_id=lastid;
	$last_pos=lastpos;
	
if ($this_pos==0)
{
	alert ("Can't be done check position numbers");
	return false;
}

if ($this_pos==$last_pos)
{
	alert("Same position numbers");
	return false;
}

	$currentURL= "process/staff_category_updates.php?act=pos&id=" + thisid + "&pos=" + lastpos + "&id2=" + lastid + "&pos2=" + thispos;
	location.href = $currentURL;
}

function confirmSCDelete(id, path){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this record?');

	if(okToDelete){
	$currentURL=  "process/staff_category_updates.php?act=del&id=" + id;
		location.href = $currentURL;
	}
}




function changeStStatus(thisid, value)
{

$currentURL= "process/staff_updates.php?act=status&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function changeSt(thisid, thispos, lastid, lastpos)
{
//	alert("move this page uo");
	
	var $this_id;
	var $this_pos;
	var $last_id;
	var $last_pos;
	
	$this_id=thisid;
	$this_pos=thispos;
	$last_id=lastid;
	$last_pos=lastpos;
	
if ($this_pos==0)
{
	alert ("Can't be done check position numbers");
	return false;
}

if ($this_pos==$last_pos)
{
	alert("Same position numbers");
	return false;
}

	$currentURL= "process/staff_updates.php?act=pos&id=" + thisid + "&pos=" + lastpos + "&id2=" + lastid + "&pos2=" + thispos;
	location.href = $currentURL;
}

function confirmStDelete(id, path){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this record?');

	if(okToDelete){
	$currentURL=  "process/staff_updates.php?act=del&id=" + id;
		location.href = $currentURL;
	}
}






function changeGovStatus(thisid, value)
{

$currentURL= "process/gov_updates.php?act=status&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function changeGov(thisid, thispos, lastid, lastpos)
{
//	alert("move this page uo");
	
	var $this_id;
	var $this_pos;
	var $last_id;
	var $last_pos;
	
	$this_id=thisid;
	$this_pos=thispos;
	$last_id=lastid;
	$last_pos=lastpos;
	
if ($this_pos==0)
{
	alert ("Can't be done check position numbers");
	return false;
}

if ($this_pos==$last_pos)
{
	alert("Same position numbers");
	return false;
}

	$currentURL= "process/gov_updates.php?act=pos&id=" + thisid + "&pos=" + lastpos + "&id2=" + lastid + "&pos2=" + thispos;
	location.href = $currentURL;
}

function confirmGovDelete(id, path){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this record?');

	if(okToDelete){
	$currentURL=  "process/gov_updates.php?act=del&id=" + id;
		location.href = $currentURL;
	}
}

function changeClStatus(thisid, value)
{

$currentURL= "process/club_updates.php?act=status&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function confirmClDelete(id, path){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this record?');

	if(okToDelete){
	$currentURL=  "process/club_updates.php?act=del&id=" + id;
		location.href = $currentURL;
	}
}


function changeGalPos(thisid, thispos, lastid, lastpos, is)
{
//	alert("move this image up");
	
	var $this_id;
	var $this_pos;
	var $last_id;
	var $last_pos;
	
	$this_id=thisid;
	$this_pos=thispos;
	$last_id=lastid;
	$last_pos=lastpos;
	
if ($this_pos==0)
{
	alert ("Can't be done check position numbers");
	return false;
}

if ($this_pos==$last_pos)
{
	alert("Same position numbers");
	return false;
}

	$currentURL= "process/gal_updates.php?act=pos&id=" + thisid + "&pos=" + lastpos + "&id2=" + lastid + "&pos2=" + thispos + "&is=" + is;
	location.href = $currentURL;
}



function confirmGalDelete(id, path, is){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this record?');

	if(okToDelete){
	$currentURL=  "process/gal_updates.php?act=del&id=" + id +"&is=" + is;
		location.href = $currentURL;
	}
}

function confirmImDelete(id, path, filename){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this record?');

	if(okToDelete){
	$currentURL=  "process/im_updates.php?act=del&id=" + id + "&filename=" +filename;
		location.href = $currentURL;
	}
}

function confirmISDelete(id, path){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this record?');

	if(okToDelete){
	$currentURL=  "process/is_updates.php?act=del&id=" + id;
		location.href = $currentURL;
	}
}

function changeISStatus(thisid, value)
{

$currentURL= "process/is_updates.php?act=status&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function changeISHome(thisid, value)
{

$currentURL= "process/is_updates.php?act=home&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function confirmAdsDelete(id, path){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this record?');

	if(okToDelete){
	$currentURL=  "process/ads_updates.php?act=del&id=" + id;
		location.href = $currentURL;
	}
}

function changeAdsStatus(thisid, value)
{

$currentURL= "process/ads_updates.php?act=status&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function changeHPStatus(thisid, value)
{

$currentURL= "process/hp_extra_updates.php?act=status&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function changeHPPos(thisid, thispos, lastid, lastpos)
{
//	alert("move this page up");
	
	var $this_id;
	var $this_pos;
	var $last_id;
	var $last_pos;
	
	$this_id=thisid;
	$this_pos=thispos;
	$last_id=lastid;
	$last_pos=lastpos;
	
if ($this_pos==0)
{
	alert ("Can't be done check position numbers");
	return false;
}

if ($this_pos==$last_pos)
{
	alert("Same position numbers");
	return false;
}

	$currentURL= "process/hp_extra_updates.php?act=pos&id=" + thisid + "&pos=" + lastpos + "&id2=" + lastid + "&pos2=" + thispos;
	location.href = $currentURL;
}

function confirmHPDelete(id, path){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this record?');

	if(okToDelete){
	$currentURL=  "process/hp_extra_updates.php?act=del&id=" + id;
		location.href = $currentURL;
	}
}


function confirmUserDelete(id, path){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this record?');

	if(okToDelete){
	$currentURL=  "process/user_updates.php?act=del&id=" + id;
		location.href = $currentURL;
	}
}

function changeQuizStatus(thisid, value)
{
$currentURL= "process/quiz_updates.php?act=status&id=" + thisid + "&val=" + value;
	location.href = $currentURL;
}

function confirmQuizDelete(id, path){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this quiz and all related questions?');

	if(okToDelete){
	$currentURL=  "process/quiz_updates.php?act=del&id=" + id;
		location.href = $currentURL;
	}
}

function changeQuesStatus(thisid, value, qzid)
{
$currentURL= "process/question_updates.php?act=status&id=" + thisid + "&val=" + value + "&qz=" + qzid;
	location.href = $currentURL;
}

function confirmQuesDelete(id, path, qzid){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this question?');

	if(okToDelete){
	$currentURL=  "process/question_updates.php?act=del&id=" + id + "&qz=" + qzid;
		location.href = $currentURL;
	}
}

function changeQPStatus(thisid, value, qpid)
{
$currentURL= "process/qp_updates.php?act=status&id=" + thisid + "&val=" + value + "&qp=" + qpid;
	location.href = $currentURL;
}

function changeQPCurrent(thisid, value, qpid)
{
$currentURL= "process/qp_updates.php?act=current&id=" + thisid + "&val=" + value + "&qp=" + qpid;
	location.href = $currentURL;
}

function confirmQPDelete(id, path, qpid){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this question?');

	if(okToDelete){
	$currentURL=  "process/qp_updates.php?act=del&id=" + id + "&qp=" + qpid;
		location.href = $currentURL;
	}
}

function changeQRStatus(thisid, value, qpid)
{
$currentURL= "process/response_updates.php?act=status&id=" + thisid + "&val=" + value + "&qp=" + qpid;
	location.href = $currentURL;
}

function confirmQRDelete(id, path, qpid){
	var $currentURL = path;
	var okToDelete = confirm('Are you sure you want to delete this question?');

	if(okToDelete){
	$currentURL=  "process/response_updates.php?act=del&id=" + id + "&qp=" + qpid;
		location.href = $currentURL;
	}
}

function changeQRPos(thisid, thispos, lastid, lastpos, qp)
{
//	alert("move this page up");
	
	var $this_id;
	var $this_pos;
	var $last_id;
	var $last_pos;
	
	$this_id=thisid;
	$this_pos=thispos;
	$last_id=lastid;
	$last_pos=lastpos;
	
if ($this_pos==0)
{
	alert ("Can't be done check position numbers");
	return false;
}

if ($this_pos==$last_pos)
{
	alert("Same position numbers");
	return false;
}

	$currentURL= "process/response_updates.php?act=pos&id=" + thisid + "&pos=" + lastpos + "&id2=" + lastid + "&pos2=" + thispos + "&qp=" + qp;
	location.href = $currentURL;
}

function drawAlert(item) 
{
//alert("OK");
var atext = Array();	

atext[1]="1 - Page Title\n\nThis is used in various Administration Functions and in Index and Search pages.\n\nUse a simple title that explains, to some degree, the purpose of the page.";
atext[2]="2 - Website Section\n\nDefines which section of the website this page will appear under. \n\nSections are normally distinguished by colour variations.";
atext[3]="3 - Page Template/Layout\n\nYou may have a number of different page layouts defined for you site, select the required layout.";
atext[4]="4 - Menu Level\n\nDefines the level at which this page will appear in the menu structure.\n\nEach section should have one Landing Page?\nBelow this there can be anynumber of Main Menu Pages\nAnd below these there can be any number of Sub-Pages.\n\nSometime pages do not appear on the menu, these are defined as Non-Menu Pages.";
atext[5]="5 - Page Position\n\nDefines where a Sub_Page or Non-Menu Page appears in the menu structure.\n\n Enter the Main Page that this Page will be under. \n\nWhile Non-Menu Pages will not appear in the menu, this selection ensures the menu is expanded correctly so as to show related links.\n\nThis is not required for Section Landing pages or Main Menu Pages.";
atext[6]="6 - Page Heading\n\nThis apears at the top of the page, ususally, in large bold font.";
atext[7]="7 - Menu Label\n\n\This is the text that appears on the menu.";
atext[8]="8 - Full Content\n\nThis is the main content for this page. This uses a near WYSIWYG editior. \n\nSeparate notes have been provided for this.\n\n\WYSIWYG - What You See Is What You Get.";
atext[9]="9 - Modules\n\nSome modules may be available for you to load.";
atext[10]="10 - Module Parameter 1\n\nSome modules have required parameters. In most cases Parameter 1 is the id of the set to be displayed (e.g. the image set ID or the download set ID.";
atext[11]="11 - Module Parameter 2\n\nSome modules have a second required parameters.";
atext[12]="12 - Module Parameter 3\n\nSome modules may have third required parameters. Most don't.";
atext[13]="13 - Access level\n\nDefines the minimum level of access required to view this page.\n\nThis option can be set so only Registered Users, who have logged in can see the page.";
atext[14]="14 - Page Status\n\nDefines the current Page Status\n\nDraft Pages are visible to Administrator who are logged in.\nPublished Pages are visible to everyone with the required access level.\nWithdrawn are not shown at all.";
atext[15]="15 - New Page Flag\n\nControls the What's New module.\n\n Select Show and a current date to make the entry appear.\n\nUse the Calendar to ensure dates are entered in the correct format.";
atext[16]="16 - Page Lock\n\nSuper Administrator only has access to this, enables a page to be protected from incorrect changes.";
atext[17]="17 - Metadata\n\nIs used to help Search Engine's view the and  rate your page. Defaults, as defined in the System Settings, will apply if nothing is entered in: \nMeta Title - appears in Browser Title and Tabs.\nMeta Description - embeded in Source code.\nMeta Keywords - individual words and phrases that may help Search Engine Optimisation.";

atext[20]="20 - Image Set Title\n\nThis is used to aid management of images.\n\nUse a simple title that explains, to some degree, the purpose of the page.";
atext[21]="21 - Image Set Description\n\nNot important, an aid to image management.";
atext[22]="22 - Home Page Set\n\nHome Page Image Sets are used in a specific module normallly used on the home page. Images in such a set should all be the same size (height and width) as defined in the Add Image process..";
atext[23]="23 - Image Set Status\n\nDefines the status of the Image Set.\n\nSets where the status is disabled will no be included in some admin processes, the images will still be availble for use.";
atext[24]="24 - Image Set\n\nImages can be added to more than one set. To add one or more images to another set click the appropriate tick boxes and select 'Add Selected to New Set' at the bottom of the page.";
atext[25]="25 - Image Position\n\nSome modules display the images the the order selected, to move an image within a set select the approprate arrows.";
atext[26]="26 - Remove from Image Set\n\nTo remove an Image from a set select the Delete icon.\n\nThis action will not remove the image but will cause it to move to the Unallocated Image collection (from where it can be deleted.";

atext[27]="27 - Image Name\n\nThis name has been generated during the load process. This ensures the image name is unique.\n\n";
atext[28]="28 - Image Title\n\nNot currently in use.\n\n";
atext[29]="29 - Image Link\n\nNot currently in use.\n\n";
atext[30]="30 - Image Keywords\n\nNot currently in use.\n\n";
atext[31]="31 - Image Status\n\nNot used.\n\n";
atext[32]="32 - Delete Image\n\nFrom here you can delete the image. It will be removed from the database and physically deleted from the Internet Server.\n\nTake care, remember the image may be used in a number of places within the content of the site.";

atext[33]="33 - Direct Image Upload\n\nThis process by passes the normal image resize process. Therefore you need to be aware of it's dimensions. Images with a width greater than 600 px will cause unusual behaviour when any webpage using the image is loaded.";
atext[34]="34 - Select Image Set\n\nThis Image will be added to the selected set. It can be removed or added to others if required in a separate process.";
atext[35]="35 - Key Words\n\nNot currently in use.";

atext[36]="36 - Image\n\nBrowse your computer to find the image you want to load. During this process the image will be copied, resized, cropped (if necessary, renamed and saved.\n\nRemember photos taken from modern digital cameras can be very large, to save time and to ensure the picture can be loaded correctly it may be necessary to  pre-process a photo before attempting this process.";
atext[37]="37 - Image Size\n\nSelect one or more image sizes:\n\nHome Page Images will be cropped and resized to the agreed size (400 pixels wide by 300 deep)\n\nOthers will be resized to the selected width, the depth of the picture will be changed in proprtion:\n600 px will fill most of the available space.\n400px will fill two thirds of available space..\n300px will take up half.\n200px will fill one-third.\n120px approximately one quarter.";

atext[40]="40 - Download Category Title\n\n";
atext[41]="41 - Order\n\n";
atext[42]="42 - Access Level\n\n";
atext[43]="43 - Status\n\n";

atext[44]="44 - Download Document\n\nThis is the exact file path/name required to link to this document. Copy and paste into external link on web page.\n\nYou can use this to update the document. The exisiting file will be deleted and replaced with the new document. \n\nNOTE: If the document name changes any direct links created in website pages will need to be editied. ";
atext[45]="45 - Download Title\n\nUsed for Admin purposes.";
atext[46]="46 - Date Published\n\n Date document is published, select date using the calendar icon.";
atext[47]="47 - Download Category\n\nDetermines where documents are listed.";
atext[48]="48 - Description\n\nCurrently used for Admin purposes.";
atext[49]="49 - Document Status\n\nDetermines if a document is shown in public domain.";

alert(atext[item]);

//alert("OK");

}