File: /home/mycamden.co.uk/public_html/common/script/function.js
function showAlertMessage(intSelValue){
strText = "Looking for a new BandMate or a new Band? Advertise for FREE on our online Musician's \nNoticeboard AND in the BandMates section of the Loot paper, by calling freephone: 0800 063 0065\n"
strText = strText + "(London and South East) or 0800 063 0066 (NW: Manchester, Liverpool & North Wales)."
strText = strText + "\n\nOr to find out more about BandMates, our essential new service for musicians, pick-up a copy\nof the Loot paper, or call: 08717 120 178 (London and South East) or 08717 120 179 (North West region)."
if(intSelValue == '101') {
alert(strText);
document.forms['adClass'].cat_info.value="";
//alert(document.forms['adClass'].cat_info.value);
}
}
function showMotoringText(f) {
strText = f.elements['1stlevel'].options[f.elements['1stlevel'].selectedIndex].text
strText = strText.toLowerCase();
if(strText == 'motoring'){
changeObjectVisibility("motoring","block");
}else {
changeObjectVisibility("motoring","none");
}
}
function showMiddleRightclo(f){
strText = f.elements['1stlevel'].options[f.elements['1stlevel'].selectedIndex].text
strText = strText.toLowerCase();
if(strText == 'adult'){
changeObjectVisibility("nomiddleRightCollumnA","block");
changeObjectVisibility("middleRightCollumn","none");
changeObjectVisibility("nomiddleRightCollumnD","none");
changeObjectVisibility("nomiddleRightCollumnJ","none");
f.cat_info.value= ""
}else if(strText == 'dating'){
changeObjectVisibility("middleRightCollumn","none");
changeObjectVisibility("nomiddleRightCollumnA","none");
changeObjectVisibility("nomiddleRightCollumnD","block");
changeObjectVisibility("nomiddleRightCollumnJ","none");
f.cat_info.value= ""
}else if(strText == 'jobs'){
changeObjectVisibility("middleRightCollumn","none");
changeObjectVisibility("nomiddleRightCollumnA","none");
changeObjectVisibility("nomiddleRightCollumnJ","block");
changeObjectVisibility("nomiddleRightCollumnD","none");
f.cat_info.value= ""
}else{
changeObjectVisibility("middleRightCollumn","block");
changeObjectVisibility("nomiddleRightCollumnA","none");
changeObjectVisibility("nomiddleRightCollumnD","none");
changeObjectVisibility("nomiddleRightCollumnJ","none");
}
}
function fixOwDropdown(f){
var ow
ow = f.elements['3rdlevel'].options[f.elements['3rdlevel'].selectedIndex].value;
if (ow.indexOf('A') != -1) {
changeObjectVisibility("owdropdown","none");
document.getElementById('owText').innerHTML = "Offered";
changeObjectVisibility("owNOdropdown","block");
}else if(ow.indexOf('A') == -1) {
changeObjectVisibility("owdropdown","block");
changeObjectVisibility("owNOdropdown","none");
}
if(ow.indexOf('B') != -1){
changeObjectVisibility("owdropdown","none");
document.getElementById('owText').innerHTML = "Wanted";
changeObjectVisibility("owNOdropdown","block");
}else if(ow.indexOf('B') == -1) {
changeObjectVisibility("owdropdown","block");
changeObjectVisibility("owNOdropdown","none");
}
}
function addOfferedWantedToLootID(f){
if(f.cat_info.value.indexOf('B') == -1 && f.cat_info.value.indexOf('A') == -1) {
if(f.side.options[f.side.selectedIndex].value == 1){
f.cat_info.value= f.cat_info.value + "A"
}
if(f.side.options[f.side.selectedIndex].value == 2){
f.cat_info.value = f.cat_info.value + "B"
}
}
//alert(f.cat_info.value);
}
function chkNummeric(frm,fieldname,fvalue){
if(fvalue.length > 0){
var regex = new RegExp(/[0-9]/);
if (regex.test(fvalue)){
alert(fvalue + " only letters allowed!");
frm.elements[fieldname].value='';
return false;
}
else
return true;
}
}
function resetFillMakeModeldiv(f){
changeObjectVisibility("tmpHeading","block");
changeObjectVisibility("makemodeltitle","none");
}
function fillMakeModeldiv(f,strModel){
for(i=0; i<f.cat_sub.options.length; i++){
if(f.cat_sub.options[i].text == strModel){
f.cat_sub.selectedIndex = i;
strTmp = f.cat_group.options[f.cat_group.selectedIndex].text + ' ' + f.cat_sub.options[f.cat_sub.selectedIndex].text;
f.tmpMakeModel.value = strTmp;
f.heading.value = strTmp;
f.make.value= f.cat_group.options[f.cat_group.selectedIndex].text
document.prvForm.heading.value = strTmp;
document.getElementById('makemodeltitle').innerHTML = strTmp;
prv();
}
}
}
function fillTmpMake(f){
f.make.value= f.cat_group.options[f.cat_group.selectedIndex].text
}
function fillTmpModel(f){
if(f.cat_group.options[f.cat_group.selectedIndex].text == 'Any' && (f.cat_sub.options[f.cat_sub.selectedIndex].text =='Any' || f.cat_sub.options[f.cat_sub.selectedIndex].text =='Please choose a make')){
changeObjectVisibility("tmpHeading","block");
changeObjectVisibility("makemodeltitle","none");
}else{
changeObjectVisibility("tmpHeading","none");
changeObjectVisibility("makemodeltitle","block");
strTmp = f.cat_group.options[f.cat_group.selectedIndex].text + ' ' + f.cat_sub.options[f.cat_sub.selectedIndex].text;
//f.heading.value = f.heading.value.replace(f.tmpMakeModel.value,strTmp);
//if (f.heading.value.indexOf(strTmp) == -1)
//{
// f.heading.value = strTmp + ' ' + f.heading.value;
//}
f.tmpMakeModel.value = strTmp;
f.heading.value = strTmp;
f.make.value= f.cat_group.options[f.cat_group.selectedIndex].text
document.prvForm.heading.value = strTmp;
document.getElementById('makemodeltitle').innerHTML = strTmp;
prv();
}
}
function escapeCR(f){
f.display_text.value = escape(f.display_text.value) //encode in input type hidden string's carriage returns
for(i=0; i<f.display_text.value.length; i++){
f.display_text.value=f.display_text.value.replace("%0A"," ")
f.display_text.value=f.display_text.value.replace("%0D"," ")
}
f.display_text.value=unescape(f.display_text.value)
f.description.value = escape(f.description.value) //encode textarea string's carriage returns
for(i=0; i<f.description.value.length; i++){
f.description.value=f.description.value.replace("%0A"," ")
f.description.value=f.description.value.replace("%0D"," ")
}
f.description.value=unescape(f.description.value)
}
function chbPrvPhoneEmail(f){
if(!(f.tshowph.checked) && !(f.tshowem.checked) && f.mobile.value==''){
alert("Must include 'UK Landline Number', 'Alternative number' or 'Email address' ");
return false;
}
if(f.tmpshowpc.checked){
f.showpc.value = 1;
}
//alert(f.showpc.value);
return true;
}
function removeKyd(f){
if(f.kyd.value.toLowerCase()=='enter keyword'){
f.kyd.value = ''
}
}
function removeDefaultKeyword(kyd)
{
if(kyd.value.toLowerCase()=='enter keyword'){
kyd.value = ''
}
};
function checkPostcode(f) {
//alert(f.psc.value);
strPsc = f.psc.value;
if(strPsc.length > 0){
var regex = new RegExp(/^[A-Z]{1,2}[0-9R][0-9A-Z]?( [0-9][ABDEFGHJLNPQRSTUWXYZ]{2})?$/i);
if (!regex.test(strPsc)){
alert(strPsc + " Postcode not correct");
return false;
}
else
//alert(strPsc+ " postcode OK");
return true;
}
}
function checkMinMax(f){
//alert(f.mxp.value)
//alert(f.mnp.value)
if (parseInt(f.mxp.value) < parseInt(f.mnp.value)){
alert("min price is greater than max price, please change");
//alert('min = ' + f.mnp.value)
//alert('max = ' + f.mxp.value)
return false;
}
else
return true;
}
function checkTextvalue(f){
var regex = new RegExp(/[^\ ][^\ ].*/);
if (!regex.test(f.kyd.value)){
alert(" There must be two or more characters in the text box");
f.kyd.value = 'Enter keyword'
return false;
}
else
return true;
}
function addUkloc(f){
if (f.psc && f.ukloc)
{
if(f.psc.value.length > 0 && f.psc_dis.selectedIndex == 0 && f.sdc.value == 0 ){
f.psc_dis.selectedIndex = 2
}
if(f.psc.value.length > 0){
f.ukloc.value=1;
}
};
//alert(f.ukloc.value + " + " + f.psc_dis.selectedIndex);
}
function setSelectDis(f){
if(f.psc_dis.selectedIndex == 0){
f.sdc.value = '1'
}
else
{
f.sdc.value = '0'
}
};
function fillSubTap(f){
strvalue = f.elements['c1'].options.value
switch(strvalue){
case '11078':
f.subtap.value= 'cars_lvl2';
break;
case '11079':
f.subtap.value= 'mb_lvl2';
break;
case '11080':
f.subtap.value= 'vans_lvl2';
break;
case '11077':
f.subtap.value= 'am_lvl2';
break;
case '11072':
f.subtap.value= 'rent_lvl2';
break;
case '11075':
f.subtap.value= 'buy_lvl2';
break;
case '11076':
f.subtap.value= 'share_lvl2';
break;
case '11074':
f.subtap.value= 'ap_lvl2';
break;
case '11084':
f.subtap.value= 'ld_lvl2';
break;
default : f.subtap.value= 'lvl2';
}
//alert(f.subtap.value);
}
function addmakeModel(f)
{
if (f.make)
{
if (f.cat_group.options[f.cat_group.selectedIndex].text == 'Any')
{ f.make.value = "";}
else
{ f.make.value = f.cat_group.options[f.cat_group.selectedIndex].text };
if (f.model.value = f.cat_sub.options[f.cat_sub.selectedIndex].text == 'Any' || f.cat_sub.options[f.cat_sub.selectedIndex].text == 'Please choose a make')
{ f.model.value = "" }
else
{f.model.value = f.cat_sub.options[f.cat_sub.selectedIndex].text };
}
}
function fsim(atp,catid){
document.sform.atp.value = atp;
if (document.sform.c1.value == '3812')
{document.sform.c1.value = catid }
if (document.sform.c1.value == '')
{document.sform.c1.value = catid }
document.sform.submit();
}
function fsim3(atp,catid){
document.sform.atp.value = atp;
document.sform.c1.value = catid;
document.sform.submit();
}
function fsim2(subtap,atp,catid){
document.sform.subtap.value = subtap;
document.sform.atp.value = atp;
if (document.sform.c1.value == '3812')
{document.sform.c1.value = catid }
if (document.sform.c1.value == '')
{document.sform.c1.value = catid }
document.sform.submit();
}
function submitsrchfrm(kyword,subtap,atp,catid,ps){
document.sform.kyd.value = kyword
document.sform.subtap.value = subtap
document.sform.atp.value = atp
document.sform.c1.value = catid
document.sform.ps.value = ps
document.sform.submit();
//alert(document.sform.c1.value);
}
function fillAtp(f) {
optvalue = f.elements['c1'].options.value
//alert(f.elements['c1'].options.value);
switch(optvalue){
case '3812': //www
f.atp.value= 'www';
break;
case '3813': //noticeboard
f.atp.value= 'whatson';
break;
case '3814':
f.atp.value= 'whatson';
break;
case '3827':
f.atp.value= 'whatson';
break;
case '3832':
f.atp.value= 'whatson';
break;
case '3836': //music
f.atp.value= 'music';
break;
case '3837':
f.atp.value= 'music';
break;
case '3840':
f.atp.value= 'music';
break;
case '3853':
f.atp.value= 'music';
break;
case '3866':
f.atp.value= 'music';
break;
case '3909': //travel
f.atp.value= 'travel';
break;
case '3910':
f.atp.value= 'travel';
break;
case '3915':
f.atp.value= 'travel';
break;
case '3943':
f.atp.value= 'travel';
break;
case '3955':
f.atp.value= 'travel';
break;
case '3959': //property 11074, 11072, 11075, 11076,
f.atp.value= 'property';
break;
case '3960':
f.atp.value= 'property';
break;
case '11074':
f.atp.value= 'property';
break;
case '11072':
f.atp.value= 'property';
break;
case '11075':
f.atp.value= 'property';
break;
case '11076':
f.atp.value= 'property';
break;
case '4045':
f.atp.value= 'property';
break;
case '4057':
f.atp.value= 'property';
break;
case '4130':
f.atp.value= 'property';
break;
case '4363': //motoring '11077','11078','11079','11080'
f.atp.value= 'motoring';
break;
case '11077':
f.atp.value= 'motoring';
break;
case '11078':
f.atp.value= 'motoring';
break;
case '11079':
f.atp.value= 'motoring';
break;
case '11080':
f.atp.value= 'motoring';
break;
case '4364':
f.atp.value= 'motoring';
break;
case '4374':
f.atp.value= 'motoring';
break;
case '4399':
f.atp.value= 'motoring';
break;
case '4417':
f.atp.value= 'motoring';
break;
case '4427':
f.atp.value= 'motoring';
break;
case '4437':
f.atp.value= 'motoring';
break;
case '4137': //home & family
f.atp.value= 'homegarden';
break;
case '4138':
f.atp.value= 'homegarden';
break;
case '4142':
f.atp.value= 'homegarden';
break;
case '4149':
f.atp.value= 'homegarden';
break;
case '4159':
f.atp.value= 'homegarden';
break;
case '4169':
f.atp.value= 'homegarden';
break;
case '4176':
f.atp.value= 'homegarden';
break;
case '4189':
f.atp.value= 'homegarden';
break;
case '4196':
f.atp.value= 'homegarden';
break;
case '4203':
f.atp.value= 'homegarden';
break;
case '4234':
f.atp.value= 'homegarden';
break;
case '4236':
f.atp.value= 'homegarden';
break;
case '4243':
f.atp.value= 'homegarden';
break;
case '4256':
f.atp.value= 'homegarden';
break;
case '4266':
f.atp.value= 'homegarden';
break;
case '4276':
f.atp.value= 'homegarden';
break;
case '4276':
f.atp.value= 'homegarden';
break;
case '4292': // Electrical
f.atp.value= 'electrical';
break;
case '4293':
f.atp.value= 'electrical';
break;
case '4309':
f.atp.value= 'electrical';
break;
case '4316':
f.atp.value= 'electrical';
break;
case '4347':
f.atp.value= 'electrical';
break;
case '4441': //Business & Loans
f.atp.value= 'business';
break;
case '4442':
f.atp.value= 'business';
break;
case '4473':
f.atp.value= 'business';
break;
case '4489':
f.atp.value= 'business';
break;
case '4496':
f.atp.value= 'business';
break;
case '4500':
f.atp.value= 'business';
break;
case '4507': //jobs
f.atp.value= 'jobs';
break;
case '4508':
f.atp.value= 'jobs';
break;
case '4510':
f.atp.value= 'jobs';
break;
case '4523':
f.atp.value= 'jobs';
break;
case '4533':
f.atp.value= 'jobs';
break;
case '4543':
f.atp.value= 'jobs';
break;
case '4550':
f.atp.value= 'jobs';
break;
case '4557': //hobbies
f.atp.value= 'hobbies';
break;
case '4558':
f.atp.value= 'hobbies';
break;
case '4598':
f.atp.value= 'hobbies';
break;
case '4608':
f.atp.value= 'hobbies';
break;
case '4618':
f.atp.value= 'hobbies';
break;
case '4631':
f.atp.value= 'hobbies';
break;
case '4647':
f.atp.value= 'hobbies';
break;
case '4675':
f.atp.value= 'hobbies';
break;
case '4682': //dating
f.atp.value= 'dating';
break;
case '4683':
f.atp.value= 'dating';
break;
case '4691':
f.atp.value= 'dating';
break;
case '10621':
f.atp.value= 'dating';
break;
case '4730': //adult
f.atp.value= 'adult';
break;
case '4731':
f.atp.value= 'adult';
break;
case '4732':
f.atp.value= 'adult';
break;
case '4733':
f.atp.value= 'adult';
break;
case '4137':
f.atp.value= 'homegarden';
break;
case '4292':
f.atp.value= 'electrical';
break;
case '11074':
f.atp.value= 'property';
break;
case '11072':
f.atp.value= 'property';
break;
case '11075':
f.atp.value= 'property';
break;
case '11076':
f.atp.value= 'property';
break;
case '11074':
f.atp.value= 'property';
break;
case '11077':
f.atp.value= 'motoring';
break;
case '11078':
f.atp.value= 'motoring';
break;
case '11079':
f.atp.value= 'motoring';
break;
case '11080':
f.atp.value= 'motoring';
break;
case '11077':
f.atp.value= 'motoring';
break;
case '11082':
f.atp.value= 'music';
break;
case '11083':
f.atp.value= 'hobbies';
break;
case '11084':
f.atp.value= 'dating';
break;
case '11085':
f.atp.value= 'whatson';
break;
case '11086':
f.atp.value= 'travel';
break;
case '11087':
f.atp.value= 'business';
break;
case '11088':
f.atp.value= 'jobs';
break;
case '11089':
f.atp.value= 'adult';
break;
}
//alert("atp = " + f.atp.value);
return true;
}
function displayDateMyPlacedAds(day){
switch (day){
case 1:
sup="st";
break;
case 21:
sup="st";
break;
case 31:
sup="st";
break;
case 2:
sup="nd";
break;
case 22:
sup="nd";
break;
case 3:
sup="rd";
break;
case 23:
sup="rd";
break;
default:
sup="th";
}
return sup
};
function displayDate(){
var nu = new Date()
var months = new Array(12)
months[0] = 'Jan';
months[1] = 'Feb';
months[2] = 'March';
months[3] = 'April';
months[4] = 'may';
months[5] = 'June';
months[6] = 'July';
months[7] = 'Aug';
months[8] = 'Sept';
months[9] = 'Oct';
months[10] = 'Nov';
months[11] = 'Dec';
day=nu.getDate( );
switch (day){
case 1:
sup="st";
break;
case 21:
sup="st";
break;
case 31:
sup="st";
break;
case 2:
sup="nd";
break;
case 22:
sup="nd";
break;
case 3:
sup="rd";
break;
case 23:
sup="rd";
break;
default:
sup="th";
}
strDate = "";
strDate = strDate + '';
strDate = strDate + nu.getDate() + sup;
strDate = strDate + ' ';
strDate = strDate + months[nu.getMonth()];
strDate = strDate + ' ';
intYear = nu.getYear();
if (intYear < 1900){intYear += 1900};
strDate = strDate + intYear;
return strDate
};
//function setPostcodeDis(f) {
//alert(f.psc_dis.selectedIndex);
//if(f.psc.value.length > 0 && f.psc_dis.selectedIndex == 0){
//f.psc_dis.selectedIndex = 2;
//}
//}
function rsxdow() {
var nu = new Date()
DaysofWeek = new Array(7)
DaysofWeek[0]="Sunday"
DaysofWeek[1]="Monday"
DaysofWeek[2]="Tuesday"
DaysofWeek[3]="Wednesday"
DaysofWeek[4]="Thursday"
DaysofWeek[5]="Friday"
DaysofWeek[6]="Saturday"
var strDay = "";
strDay = DaysofWeek[nu.getDay()];
return strDay;
}
function rsxtime() {
var thetime = new Date( );
var thehour = thetime.getHours( );
var themin = thetime.getMinutes( );
pod = "";
if(themin < 10){
themin = "0" + themin;
}
if(thehour < 12){
pod = "am"
}
if(thehour >= 12){
pod = "pm"
}
var strTime = " " + thehour + ":" + themin + " " + pod;
return strTime;
}
function noEmptyValuesAllowed(f,tof){
Kyd = trim(f.kyd.value)
if(tof == 'simple'){
psc = trim(f.psc.value);
if(f.psc.value.length < 5 && f.psc.value.length >0 && f.psc_dis.selectedIndex == 0){
f.psc_dis.selectedIndex = 2;
}
if(f.psc.value.length > 4 && f.psc_dis.selectedIndex == 0){
f.psc_dis.selectedIndex = 1;
}
if(Kyd == '' && (f.psc.value == '' || f.psc_dis.selectedIndex == 0) ){
alert('You have not entered any search criteria');
return false;
}
}
else {
if(f.psc.value.length < 5 && f.psc.value.length >0 && f.psc_dis.selectedIndex == 0){
f.psc_dis.selectedIndex = 2;
}
if(f.psc.value.length > 4 && f.psc_dis.selectedIndex == 0){
f.psc_dis.selectedIndex = 1;
}
//alert("psc_dis = " + f.psc_dis.options[f.psc_disselectedIndex].value);
lngFilled = 0;
if(Kyd != ''){lngFilled++};
if(f.psc.value != ''){lngFilled++};
if(f.c1.selectedIndex != 0){lngFilled++};
if(f.mnp.value != ''){lngFilled++};
if(f.mxp.value != ''){lngFilled++};
if(f.elements['do'].selectedIndex != 0){lngFilled++};
if(f.trd.selectedIndex != 0){lngFilled++};
if(f.ow.selectedIndex != 0){lngFilled++};
if (lngFilled == 0){
alert('You have not entered any search criteria');
return false;
}
if (lngFilled == 1){
alert('You must select at least two search criteria');
return false;
}
}
return true;
}
function trim(s) {
while (s.substring(0,1) == ' ') {
s = s.substring(1,s.length);
}
while (s.substring(s.length-1,s.length) == ' ') {
s = s.substring(0,s.length-1);
}
return s;
}
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) {
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, "&");
//strValue = strValue.replace(/"/g, "'");
strValue = strValue.replace(/</g, "<");
strValue = strValue.replace(/>/g, ">");
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){
//alert(strOrdering);
var frm = document.forms['sform'];
frm.ord.value = strOrdering;
frm.action.value = 'fsrlt';
frm.ad_id.value= '';
frm.pn.value = '1';
//alert( frm.c1.value);
addmakeModel(frm);
window.setTimeout('document.sform.submit()',200);
}
function setPageNum(strPageNum){
var frm = document.forms['sform'];
frm.pn.value = strPageNum;
addmakeModel(frm);
frm.action.value = 'fsrlt';
frm.ad_id.value= '';
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)
{
window.location.href='/rs6/cl.asp?action=view_ad&ad_id=' + lngAdId
};
// end functions -- search results page
function regDetailsCcDetails(f)
{
f.ccnoc.value = document.forms['regDetails'].first_name.value;
f.ccnoc.value = f.ccnoc.value + " " + document.forms['regDetails'].last_name.value;
f.ccadrline_1.value = document.forms['regDetails'].line_1.value;
f.ccadrline_2.value = document.forms['regDetails'].line_2.value;
f.ccadrline_3.value = document.forms['regDetails'].line_3.value;
f.ccadrtown.value = document.forms['regDetails'].city.value;
f.ccadrcnty.value = document.forms['regDetails'].county.value;
f.ccadrpc.value = document.forms['regDetails'].postal_code.value;
};
// ------------ start div switching regform ---
function UK(action) {
//alert(action);
if(action =='yes'){
// show all UK fields and hide Non UK objects
hideAll();
var ukfield= new Array(2);
ukfield[0]="county";
ukfield[1]="UKactiveTab";
var i=0;
for (i=0; i<2; i++) {
switchDiv(ukfield[i])
}
document.forms['userEdit'].ukornot.value='UK';
document.forms['userEdit'].elements['address|home|country_code'].value='GBR';
}
if(action =='no'){
// show all NON uk fields and hide UK objects
hideAll();
var nukfield= new Array(2);
nukfield[0]="country";
nukfield[1]="nonUKactiveTab";
var i=0;
for (i=0; i<2; i++) {
switchDiv(nukfield[i])
}
document.forms['userEdit'].ukornot.value='NONUK';
}
//alert(document.forms['userEdit'].ukornot.value);
}
function switchDiv(div_id)
{
var style_sheet = getStyleObject(div_id);
if (style_sheet)
{
//hideAll();
changeObjectVisibility(div_id, "block");
}
else
{
//alert("sorry, this only works in browsers that do Dynamic HTML");
}
}
function getStyleObject(objectId) {
// checkW3C DOM, then MSIE 4, then NN 4.
//
if(document.getElementById && document.getElementById(objectId)) {
return document.getElementById(objectId).style;
}
else if (document.all && document.all(objectId)) {
return document.all(objectId).style;
}
else if (document.layers && document.layers[objectId]) {
return document.layers[objectId];
} else {
return false;
}
}
function changeObjectVisibility(objectId, newVisibility) {
// first get the object's stylesheet
var styleObject = getStyleObject(objectId);
// then if we find a stylesheet, set its visibility
// as requested
//
if (styleObject) {
styleObject.display = newVisibility;
//alert(newVisibility);
return true;
} else {
return false;
}
}
function hideAll()
{
changeObjectVisibility("country","none");
changeObjectVisibility("county","none");
//changeObjectVisibility("nukll","none");
//changeObjectVisibility("ukll","none");
changeObjectVisibility("nonUKactiveTab","none");
changeObjectVisibility("UKactiveTab","none");
}
// ------------ end div switching regform ---
function checkTC(f){
if(document.forms['userEdit'].ukornot.value == 'UK'){
document.forms['userEdit'].elements['address|home|postal_code'].value = document.forms['userEdit'].ukpc.value;
}else if(document.forms['userEdit'].ukornot.value == 'NONUK'){
document.forms['userEdit'].elements['address|home|postal_code'].value = document.forms['userEdit'].otherpc.value;
//alert(document.forms['userEdit'].elements['address|home|postal_code'].value);
}
if(f.temp_term_cond.checked)
{
return true;
}
else
alert("Please, first accept the terms and conditions")
return false;
};
function checkBoxValidate2(cb,f){
var gr = document.getElementById('offernone');
var gn = document.getElementById('offerSP1');
var gl = document.getElementById('offerSP2');
if(gr.checked && cb == gr)
{
gl.checked = false;
gn.checked = false;
}
if(gn.checked && cb == gn)
{
gl.checked = false;
gr.checked = false;
}
if(gl.checked && cb == gl)
{
gn.checked = false;
gr.checked = false;
}
if(!(gn.checked) && !(gl.checked))
{
gr.checked = true;
//gr.checked = false;
}
}
function checkBoxValidate(cb,gp){
var gn = gp.ad_sp_ofr
var len = 3
var countOn = 0;
gn[0].checked = false;
for (j=0; j < len ; j++ )
{
if(j == (cb))
{
if(gn[j].checked == true)
{
gn[j].checked = true
countOn++;
}
else
{
gn[j].checked = false
}
}
else
{
if(gn[j].checked==true)
{
gn[j].checked = false
}
}
}
if (countOn ==0)
{
gn[0].checked = true;
}
}
// Check that min & max are the right way round in the dating buzz search box
function checkAge (formElement) {
var mAgeMin = formElement.form.mAgeMin.selectedIndex;
var mAgeMax = formElement.form.mAgeMax.selectedIndex;
if (mAgeMax < mAgeMin) {
formElement.form.mAgeMin.options[mAgeMax].selected = true;
formElement.form.mAgeMax.options[mAgeMin].selected = true;
}
return true;
}
wwidx = 0;
function changeText(f,blnAll, blnIgnore)
{
var blnMatch
rgx = new RegExp('\\b' + f.wrongWord.value + '\\b');
if(blnIgnore == true)
{
f.ignored.value = f.wrongWord.value + ';' + f.ignored.value
blnMatch = true
}
else
{
match = rgx.exec(f.ignored.value);
if (match == null)
{
match = rgx.exec(f.heading.value);
if (match != null)
{
f.heading.value = f.heading.value.replace(rgx, f.changeTo.value);
}
else
{
f.description.value = f.description.value.replace(rgx, f.changeTo.value);
}
if (blnAll)
{
match = rgx.exec(f.description.value);
while (match != null)
{
f.description.value = f.description.value.replace(rgx, f.changeTo.value);
match = rgx.exec(f.description.value);
}
match = rgx.exec(f.heading.value);
while (match != null)
{
f.heading.value = f.heading.value.replace(rgx, f.changeTo.value);
match = rgx.exec(f.heading.value);
}
}
// check if word occurs another time
match = rgx.exec(f.description.value);
if (match == null)
{
match = rgx.exec(f.heading.value);
};
if (match == null)
{
blnMatch = true
}
}
}
if (blnMatch == true)
{
f.changeTo.value = "";
// volgende woord inladen
wwidx ++;
if (arrWrongWords[wwidx])
{
f.wrongWord.value = arrWrongWords[wwidx];
idx = 1;
f.suggestions.options.length = 0;
while(arrchangeTo[wwidx][idx])
{
opt = new Option(arrchangeTo[wwidx][idx],arrchangeTo[wwidx][idx]);
f.suggestions.options.add(opt);
idx++;
}
}
else
{
f.wrongWord.value = "";
f.action.value = 'b2';
f.submit();
}
};
}
function onSuggestionChange(f)
{
var i = f.suggestions.selectedIndex;
f.changeTo.value = f.suggestions.options[i].text;
}
// Check that min & max are the right way round in the dating buzz search box
function checkAge (formElement) {
var mAgeMin = formElement.form.mAgeMin.selectedIndex;
var mAgeMax = formElement.form.mAgeMax.selectedIndex;
if (mAgeMax < mAgeMin) {
formElement.form.mAgeMin.options[mAgeMax].selected = true;
formElement.form.mAgeMax.options[mAgeMin].selected = true;
}
return true;
}
function copyUKtoGBR(f){
if(document.forms['userEdit'].ukornot.value =='UK'){
document.forms['userEdit'].elements['address|home|country_code'].value='GBR';
}
//alert(document.forms['userEdit'].elements['address|home|country_code'].value);
}
function IgnoreAlert()
{
alert("Please correct your ad as suggested. Clicking the 'Ignore' button may delay its publication while we check the text.")
}