HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ns3133907 6.8.0-86-generic #87-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 22 18:03:36 UTC 2025 x86_64
User: cssnetorguk (1024)
PHP: 8.2.28
Disabled: NONE
Upload Files
File: /home/mykensington.co.uk/public_html/common/script/function.js
function noEmptyValuesAllowed(f,tof){
	if(tof == 'simple'){
		if(f.kyd.value == '' && (f.psc.value == '' || f.psc_dis.selectedIndex == 0) ){
			alert('You have not entered any search criteria');
			return false;
		}
	}
	else {
		if(f.kyd.value == '' && f.psc.value == '' && f.c1.selectedIndex == 0 && f.mnp.value == '' && f.mxp.value == '' && f.elements['do'].selectedIndex == 0 && f.trd.selectedIndex == 0 && f.ow.selectedIndex == 0 && f.iss.selectedIndex == 0){
				alert('You have not entered any search criteria');
				return false;
		}
		//else{ return true;}
		//
		
	}
	return true;
}




function copyPickedAddress(fm,strSelectedQAS){
	// copies a pipe-delimited QAS address into the address form fields
	if (strSelectedQAS != '')
		{
			var arrAddressLines = strSelectedQAS.split('|');
			fm.elements['address|home|line_1'].value = arrAddressLines[0];
			fm.elements['address|home|line_2'].value = arrAddressLines[1];
			fm.elements['address|home|line_3'].value = arrAddressLines[2];
			fm.elements['address|home|city'].value = arrAddressLines[3];
			fm.elements['address|home|province'].value = arrAddressLines[4];
			fm.elements['address|home|postal_code'].value = arrAddressLines[5];
		};
	
	
	}

	function displayIt(TR,totalRows) {
		
		//alert(totalRows);
			for (I = 1; I != totalRows; I++)	
				{
					document.getElementById('TRD'+I).style.display='none';
					document.getElementById('TRC'+I).style.display='block';
				};
					
		if (TR != 0)			
			{
			document.getElementById('TRD'+TR).style.display='block';
			document.getElementById('TRC'+TR).style.display='none';
			};
	}


function paymentUploadActions(frm) {

	// fill issue number or issue start date
	var strIssNr = frm.issnr.value;
	if (strIssNr.indexOf('/') != -1)
		// value contains a slash, so it's a date
		{
			frm.ccissmonth.value = strIssNr.substring(0,strIssNr.indexOf('/'));
			frm.ccissyear.value = strIssNr.substring(strIssNr.indexOf('/')+1,1000);
			frm.ccissnr.value = '';			
		}
	else
		{
			frm.ccissmonth.value = '';
			frm.ccissyear.value = '';
			frm.ccissnr.value = strIssNr;			
		};
		

	document.getElementById('uploadFormTbl').style.display = 'none';
	document.getElementById('uploadingMsg').style.display = 'block';					
	};
	
function WinOpenContact(filename) { 
window.open(filename,'contactFaq','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=517,height=500');
};


function ifl(strUrl){
	window.open( '/f.asp?i=' + escape(strUrl));
	};
function ifl2(strUrl){
	window.open( strUrl);
	};

function fix_ad_side(frm){
	//var tmp_side = frm.elements['temp_side'].options.value
	//frm.ad_side.value = tmp_side;
	//alert("ad_side=" + frm.ad_side.value)
	
};



function checkLoginLength(f){
	if(f.login_name.value.length < 4){
		alert("Login incorrect: at least 4 letters and/or numbers")
		return false;
	}
}
function setClassNum(frm){
	// sets the classnumber and side values (hiddens)
	// if a category doesn't have A/B subcats, then sends empty value for side
	// temp cat id is of the form 2882|2 where the number after the pipe is the number
	// of subcats
	
	strCatId = frm.cat_id_temp.options[frm.cat_id_temp.selectedIndex].value;
	
	if (strCatId.indexOf('/1') != -1 || strCatId.indexOf('/true') != -1)
		{ frm.trade_only.value = '1'; };

	if (strCatId.indexOf('|2') != -1)
		{ // category has two subcats, so do send the 'side' value
			frm.side.value = frm.side_temp.value;
		};
		
	if (strCatId.indexOf('|') != -1)
		{ strCatId = strCatId.substring(0,strCatId.indexOf('|'))
		};
		
		
	frm.cat_id.value = strCatId;
	
	};


function fill_pagesize_dropdown(tmp_num){

  // var v_options= tmp_num;
   //for(i=1;i<= v_options;i++){
       //  oOption = document.createElement("OPTION");
		// oOption.text = "page  "+i;
		// oOption.value = i;
       //  document.all.page_size_dd.add(oOption,i)
  // }
}

function jumpToPage(f,tmpPagecount){
	//intValue = f.elements['page_size_dd'].options[f.elements['page_size_dd'].selectedIndex].value
	
	intValue = f.page_size_dd.value;
	
	if(isNaN(intValue)){
		alert("only numeric values, please");
		return false;
	}
	if( intValue > tmpPagecount){
		intValue = tmpPagecount;
				
	}

	document.rsc_srch.action.value='search';
	document.rsc_srch.page_number.value=intValue; 
	document.rsc_srch.submit();
}

function setClipStatus(fPaging, fClipping){
	strClipChanges = '';
	
	for (lngI = 0; lngI < fClipping.elements.length; lngI++)
		{ strName =  fClipping.elements[lngI].name
		
			if (strName.substring(0,4) == 'cbc_')
				{
					// ad id
					adId = 1 * strName.substring(4,4000);
					//alert(adId);
					if (fClipping.elements[lngI].checked && fClipping.elements['cs_' + adId].value == 'false')
						{
							strClipChanges = strClipChanges + 'CL' + adId;
						};
						
					if (!fClipping.elements[lngI].checked && fClipping.elements['cs_' + adId].value == 'true')
						{
							strClipChanges = strClipChanges + 'CU' + adId;
						};
					
				}
		};
		
	fPaging.cc.value  = strClipChanges;
	//alert( strClipChanges)

	
	};					

function clip(lngAdId){
	with (document.forms['clipUnclip'])
		{
			elements['ad_id'].value = lngAdId;
			elements['action'].value = 'savad';
			submit();
		}
	};

function unclip(lngAdId){
	with (document.forms['clipUnclip'])
		{
			elements['ad_id'].value = lngAdId;
			elements['action'].value = 'delsavad';
			submit();
		}
	};
	
function s2aff(lngAdId){
	with (document.forms['s2affForm'])
		{
			elements['id'].value = lngAdId;
			elements['action'].value = 's2aff';
			submit();
		}
	};	
	
function setAlerts(lngSavedSearchId, lngInterval, lngNewFlag)
	{
	// sets the message interval for the specified saved search
	// and the 'send only when new' flag (true or false)
	
	with (document.forms['updSaveSrch_' + lngSavedSearchId])
		{	interval_days.value = lngInterval;
			new_only.value = lngNewFlag;
			submit();
		};
	};
	
function checkLogin(f){
//alert();
}


var arrAtpOverride = new Array(100);


function rebuildDOB(f){
	var strYear  = f.year.value;
	var strMonth = f.month.value;
	var strDay   = f.day.value;

	if (strYear.length < 1)
		{
		strYear = '----';
		};
		
	if(strYear.length == 2){
		strYear = "19" + strYear;
	}
	strYear = '0000' + strYear;
	strYear = strYear.substring(strYear.length-4,strYear.length)
	strDay = '00' + strDay;
	strDay = strDay.substring(strDay.length-2,strDay.length)
	strMonth = '00' + strMonth;
	strMonth = strMonth.substring(strMonth.length-2,strMonth.length)
	//alert(strYear);
	var strDOB = strYear  +"-"+ strMonth +"-"+ strDay ;
	if (strDOB == '0000-00-00')
		{ strDOB = '' };
		
	f.elements['profile|DOB'].value = strDOB;
	
	//return false;
}


	
function setNewAdsOnly(frm,lngEarlyBirdInterval)
	{
			frm.search_date.value = 'start_date';
			// search only new ads
			frm.start_date.value = 'dyn' + (lngEarlyBirdInterval-1);
			frm.end_date.value = '0';
			frm.page_number.value = '1';
	};

function sp(frm){
	// BF 324: accept currency formatting
	
	with (frm.elements['search_element|loot_in|price|lt|and|int|'])
		{ value = currencyEscape(value)
		};	
	with (frm.elements['search_element|loot_in|price|gt|and|int|'])
		{ value = currencyEscape(value)
		};	
	};
	
function ei(frm){
	// escape 'free; input fields
	
	with (frm.elements['search_element|loot_in|search_text|contains|and|nvarchar|'])
		{ value = xmlEscape(xmlCleanup(value))
		};	
	};
	
function currencyEscape(strValue){
	// ignore everything that can be considered currency formatting
		// ignore everything after decimal point
			strValue = strValue.replace(/,/g, "");
			strValue = strValue.replace(/£/g, "");
			return strValue;
	};
	
function xmlEscape(strValue){
	// escape everything that might interfere with XML
			strValue = strValue.replace(/&/g, "&amp;");
			//strValue = strValue.replace(/"/g, "'");
			strValue = strValue.replace(/</g, "&lt;");
			strValue = strValue.replace(/>/g, "&gt;");
			return strValue;
	};
	
function xmlCleanup(strValue){
	// kill everything that might interfere with XML
			strValue = strValue.replace(/</g, "");
			strValue = strValue.replace(/>/g, "");
			strValue = strValue.replace(/&/g, "");
			return strValue;
	};
	
function setSimpleSearchname(frm)
	// creates the value of search_name when posting something from the advanced search form	
	{
		strSearchName = '';
		
		// channel -----------------------
		
		strValue = frm.elements['atp'].value;
		if (strValue == '')
			{ strValue = 'www' };
		strSearchName += '<atp>' + strValue + '</atp>';
			
		// keyword -----------------------
		
		strValue = frm.elements['search_element|loot_in|search_text|contains|and|nvarchar|'].value
		if (strValue != '')
			{   
				strSearchName += '<keyword>' + strValue + '</keyword>';
			};
			
		
		// class -----------------------	
			
		strValue = frm.elements['search_categories'].selectedIndex;
		
		if (strValue > 0)
			{
				
				strValue = frm.elements['search_categories'].options[strValue].text;
			
				if (strValue != '')
				{   if (strValue.indexOf('(') > 1)
						{ strValue = strValue.substring(0,strValue.indexOf('(')-1)
						};

					while (strValue.charCodeAt(0) == 160 || strValue.charCodeAt(0) == 32)
						{ strValue = strValue.substring(1,4000) };
						
					if (frm.action.value == 'presearch')
						{ 
							strSearchName += '<channel_name>' + strValue + '</channel_name>';
						}
					else
						{
							strSearchName += '<class_name>' + strValue + '</class_name>';
						};					
				};
			};
			
		
		// type (start date/earlybird) -----------------------	
		
		strValue = frm.elements['type_of_ads'].value
		strSearchName += '<type_of_ads>' + strValue + '</type_of_ads>';
		
		frm.search_name.value = strSearchName;	
}




function setHompageSearchName(f){
	strSearchName = '';
		strValue = f.elements['search_element|loot_in|search_text|contains|and|nvarchar|'].value
		if (strValue != ''){   	
			strSearchName += '<keyword>' + strValue + '</keyword>';
		};
		
		strValue = f.elements['search_categories'].selectedIndex;
		
		if (strValue > 0)
			{
				
				strValue = f.elements['search_categories'].options[strValue].text;
			
				if (strValue != '')
				{   if (strValue.indexOf('(') > 1)
						{ strValue = strValue.substring(0,strValue.indexOf('(')-1)
						};

					while (strValue.charCodeAt(0) == 160 || strValue.charCodeAt(0) == 32)
						{ strValue = strValue.substring(1,4000) };
						
					if (f.action.value == 'presearch')
						{ 
							strSearchName += '<channel_name>' + strValue + '</channel_name>';
						}
					else
						{
							strSearchName += '<class_name>' + strValue + '</class_name>';
						};					
				};
				strValue = f.elements['type_of_ads'].value
				strSearchName += '<type_of_ads>' + strValue + '</type_of_ads>';
			};
		//alert(strSearchName);
		f.search_name.value = strSearchName;
}
	
function setAdvSearchName(frm)
	// creates the value of search_name when posting something from the advanced search form	
	{
		strSearchName = '';
		
		// keyword -----------------------
		
		strValue = frm.elements['search_element|loot_in|search_text|contains|and|nvarchar|'].value
		
		
		if (strValue != '')
			{   
			
				strSearchName += '<keyword>' + strValue + '</keyword>';
			};
			
		
		// class -----------------------	
			
		//strValue = frm.elements['search_categories'].selectedIndex;
		
		if (strValue > 0)
			{
				
				strValue = frm.elements['search_categories'].options[strValue].text;
			
				if (strValue != '')
				{   if (strValue.indexOf('(') > 1)
						{ strValue = strValue.substring(0,strValue.indexOf('(')-1)
						};

					while (strValue.charCodeAt(0) == 160 || strValue.charCodeAt(0) == 32)
						{ strValue = strValue.substring(1,4000) };
						
					if (frm.action.value == 'presearch')
						{ 
							strSearchName += '<channel_name>' + strValue + '</channel_name>';
						}
					else
						{
							strSearchName += '<class_name>' + strValue + '</class_name>';
						};					
				};
			};
			
		
		// type (start date/earlybird) -----------------------	
		
		//strValue = frm.elements['type_of_ads'].value
		//strSearchName += '<type_of_ads>' + strValue + '</type_of_ads>';
		
		
		// min price -----------------------	
		strValue = frm.elements['search_element|loot_in|price|gt|and|int|'].value
		if (strValue != '')
			{   
				strSearchName += '<min_price>' + strValue + '</min_price>';
			};
		
		// max price -----------------------	
		strValue = frm.elements['search_element|loot_in|price|lt|and|int|'].value
		if (strValue != '')
			{   
				strSearchName += '<max_price>' + strValue + '</max_price>';
			};
		
		
		// postcode -----------------------	
		strValue = frm.elements['postcode'].value
		if (strValue != '')
			{   
				strSearchName += '<postcode>' + strValue + '</postcode>';
			};
		
		// distance -----------------------	
		strValue = frm.elements['distance'].options[frm.elements['distance'].selectedIndex].value
		if (strValue != '')
			{   
				strSearchName += '<distance>' + strValue + '</distance>';
			};
		
		
		// region ------------------	
		//strValue = frm.elements['search_issues'].selectedIndex
		//if (strValue != 0)
			//{   
			//	strValue = frm.elements['search_issues'].options[strValue].text;
			//	strSearchName += '<region>' + strValue + '</region>';
			//};
		
		
		// current atp ------------------	
		//strValue = frm.elements['atp'].value;
			//{
				//strSearchName += '<atp>' + strValue + '</atp>';
			//};
		
		
		frm.search_name.value = strSearchName;	
		//alert(strSearchName)
		
	};
	

function daysOld(lngYear,lngMonth,lngDay,dateNowYear,dateNowMonth,dateNowday){

	lngMonth -= 1; //begint te tellen bij 0, dus 1 eraf halen!
	

	var dateNow = new Date(dateNowYear,dateNowMonth-1,dateNowday)

	var dateAd= new Date(lngYear, lngMonth, lngDay)

	var one_day=1000*60*60*24

			

	var difference = Math.floor(  (dateNow.getTime()-dateAd.getTime())/(one_day)   );
			
			
	difference = Math.abs(difference) ;
		if (difference < 1)
			{ difference = 'NEW TODAY'; }	
		else
		if (difference == 1)
			{ difference = 'One day old'; }	
		else
			{ difference = difference + ' days old' };

		return difference;
}


function setAtpOverride(frm,lngIndex){
	frm.atp_override.value = arrAtpOverride[lngIndex];
	frm.atp.value = arrAtpOverride[lngIndex];
	};

function searchOrPresearch(frm,lngIndex){
	if (lngIndex > 0)
		{ 
		  strSelectedCatId = frm.search_categories.options[frm.search_categories.selectedIndex].value;
		  if (strSelectedCatId.indexOf('p') == -1)
			{ frm.action.value = 'search' }
		  else
			{
				frm.action.value = 'presearch'
				frm.search_categories.options[frm.search_categories.selectedIndex].value = strSelectedCatId.substring(1,5000);
			};
			
		};
	};




function dow(intYear, intMonth, intDay)
	{
	var dt = new Date(intYear,intMonth,intDay);
	var intMonth = dt.getMonth();
	switch (intMonth)
		{
		case 0:
			return('January');
		break
		case 1:
			return('February');
		break
		case 2:
			return('March');
		break
		case 3:
			return('April');
		break
		case 4:
			return('May');
		break
		case 5:
			return('June');
		break
		case 6:
			return('July')
		break;
		case 7:
			return('August');
		break
		case 8:
			return('September');
		break
		case 9:
			return('October');
		break
		case 10:
			return('November');
		break
		case 11:
			return('December');
		break
		};
	};
	
	function WinOpen222(filename) { 
		w2 = window.open(filename,'preview','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=517,height=470');
		w2.focus();
	};

	function faqWindow(filename) { 
		w2 = window.open('/content/' + filename,'faq','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=524,height=560');
		w2.focus();
	};
	
	
	function WinOpen2(filename) { 
	//alert(filename);
	w2 = window.open(filename,'preview','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=517,height=500');
	w2.focus();
	};
	
	function WinOpenPrintPreview(filename) { 
	//alert(filename);
	w2 = window.open(filename,'preview','toolbar=1,location=0,directories=0,status=0,menubar=1,scrollbars=yes,resizable=no,width=800');
	w2.focus();
	};
	
	function WinOpenMichelin(filename) { 
	//alert(filename);
	w2 = window.open(filename,'preview','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=485,height=670');
	w2.focus();
	};

	function WinOpen3(filename) { 
	w3 = window.open(filename,'preview3','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=360,height=530');
	w3.focus();
	};
 
	function topWindow(Win){
		popup=window.open(Win,"",'toolbar=1,location=1,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no');
		popup.focus();
	};
	
	function submitIt(){
		document.csfuser.page_number.value='1';
		document.csfuser.submit();
	};

	function faq(strCategory)
		{// I don't think this is used anymore
			WinOpen3('/rs6/homepage.asp?action=q&t=/anm_content/faqs/' + strCategory + '/' + strCategory + '_faq_index');
		};
		
	function placeadhelp(strFileId)
		{ // I don't think this is used anymore
			WinOpen3('/rs6/homepage.asp?action=q&t=/anm_content/placead_help/' + strFileId );
		};

	function secornot(frmSec,frmNonsec)
		{ //submit one of the two forms
			strValue = getRBValue(frmSec.elements['server']);
			if (strValue == 'standard')
				{
					frmNonsec.elements['package'].value = getRBValue(frmSec.elements['package']);
					frmNonsec.submit();
				}
			else
				{			
					frmSec.submit();
				};
		}
		
		
	function getRBValue(elmRB){
		// gets the selected value of a radio button, returns '' is nothing is selected
		var strVal = '';
		for (lngI = 0;lngI <  elmRB.length; lngI++)	
			{ if (elmRB[lngI].checked)
				{ strVal = elmRB[lngI].value };
			};
		return strVal;
		};

// functions -- search results page 

function setOrder(strOrdering){	
   var frm = document.forms['pgfrm'];
	frm.ord.value = strOrdering;
	frm.pn.value = '1';
	window.setTimeout('document.pgfrm.submit()',200);
	}
	
function setPageNum(strPageNum){	
   var frm = document.forms['pgfrm'];
	frm.pn.value = strPageNum;
	frm.submit();
	}
	
function setSavedSearch(){	
   var frm = document.forms['pgfrm'];
	frm.action.value = "savsrch";
	frm.pn.value = 1;
	frm.submit();
	}


function setSearchLevel1(lngCatId){
	/* 
		drilldown to a classification, 
		fill in class id in c1
		reset page number, ordering
		submit
	*/
	
	with (document.forms['pgfrm'])
		{	
			ord.value = '';
			pn.value = '1';
			c1.value = lngCatId;
			xp1.value = lngCatId;
			xp2.value = 0;
			xp3.value = 0;
			xp4.value = 0;
			submit();
		};
	};
	
function setSearchLevel2(lngCatId){
	/* 
		drilldown to a classification, 
		fill in class id in c1
		reset page number, ordering
		submit
	*/
	
	with (document.forms['pgfrm'])
		{	
			ord.value = '';
			pn.value = '1';
			c1.value = lngCatId;
			xp2.value = lngCatId;
			xp3.value = 0;
			xp4.value = 0;
			submit();
		};
	};

function setSearchLevel3(lngCatId){
	/* 
		drilldown to a classification, 
		fill in class id in c1
		reset page number, ordering
		submit
	*/
	
	with (document.forms['pgfrm'])
		{	
			ord.value = '';
			pn.value = '1';
			c1.value = lngCatId;
			xp4.value = 0;
			submit();
		};
	};

function setSearchLevel4(lngCatId){
	/* 
		drilldown to a car make, 
		fill in class id in c1
		reset page number, ordering
		submit
	*/
	
	with (document.forms['pgfrm'])
		{	
			ord.value = '';
			pn.value = '1';
			c1.value = lngCatId;
			submit();
		};
	};

function setExpandedLevel1(lngI){
	with (document.forms['pgfrm'])
		{	
			xpr.value = 1;
			submit();
		};
	};
	
function setExpandedLevel2(lngI){
	with (document.forms['pgfrm'])
		{	
			xp2.value = lngI;
			submit();
		};
	};

function setExpandedLevel3(lngI){
	with (document.forms['pgfrm'])
		{	
			xp3.value = lngI;
			submit();
		};
	};

function setExpandedLevel4(lngI){
	with (document.forms['pgfrm'])
		{	
			xp4.value = lngI;
			submit();
		};
	};


function viewAdFromSearch(lngAdId)
{
	with (document.forms['pgfrm'])
	{	
			action.value = 'view_ad_ext'
			ad_id.value = lngAdId;
			submit();
	};
};
	
// end functions -- search results page