function swapImage(imgPath, w, h, alt){
	document.londonpic.src=imgPath;
	document.londonpic.width=w;
	document.londonpic.height=h;
	document.londonpic.alt=alt;
	imgCurrent = imgPath;
}

function countItComments(texter,allchars) {
	var maxCount = allchars;             // change the number 100 at left which is the maximum characters allowed
 	var words = document.commentform.comments;
 	var charsLeft = document.commentform.charsleft;
 	if (words.value.length > maxCount) { 
 		words.value = words.value.substring(0,maxCount); 
 		alert('You have reached the maximum \n' + maxCount + ' characters allowed!')
 	}
 	else {
 		texter.value = words.value.length;
 		charsLeft.value = allchars - words.value.length;
 		
 	}
 	if ((navigator.appName.indexOf("Netscape")!= -1) && (texter.value == maxCount)) { 
 		alert('You have reached the maximum \n' + maxCount + ' characters allowed!'); 
 		return; 
 	} 
}

function countItAd(texter,allchars) {
	var maxCount = allchars;             // change the number 100 at left which is the maximum characters allowed
 	var words = document.ad_form.advert;
 	var charsLeft = document.ad_form.charsleft;
 	if (words.value.length > maxCount) { 
 		words.value = words.value.substring(0,maxCount); 
 		alert('You have reached the maximum \n' + maxCount + ' characters allowed!')
 	}
 	else {
 		texter.value = words.value.length;
 		charsLeft.value = allchars - words.value.length;
 		
 	}
 	if ((navigator.appName.indexOf("Netscape")!= -1) && (texter.value == maxCount)) { 
 		alert('You have reached the maximum \n' + maxCount + ' characters allowed!'); 
 		return; 
 	} 
}

function popImageUpload(id){
	var urltoopen = 'image_upload_class.php?ad_id=' + id;
	window.open(urltoopen,'ImageUpload','location=no,menubar=no,width=350,height=250');
}
function closeRefresh(){
	opener.document.refreshit.submit();
	window.close();
}

function bookmarkPage(){
	var url = window.location;
	var ver = navigator.appName;
	var who = document.title;
	var num = parseInt(navigator.appVersion);
	if ((ver == "Microsoft Internet Explorer")&&(num >= 4)) {
		window.external.AddFavorite(url,who);
	}
	else {
		alert("Browser not supported, please use your browsers' own Add Bookmark button.");
	} 
}


function printPage(){
	window.print();
}

function popMap(pc){
	murl = "http://www.allinlondon.co.uk/mapping/map.php?pc=" + pc;
	window.location = murl;
}

function popUserDetails(uid, dowhat){
	uurl = "edit_user.php?uid=" + uid + "&amp;dowhat=" + dowhat;
	window.open(uurl,'usereditpage','width=300,height=300,location=no,menubar=no,status=no,resizable=no,scrollbars=no,toolbar=no');
}

function popRules (){
	window.open('rules.php','darules','width=300,height=300,location=no,menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no');
}

function popTubeNotice (){
	window.open('tubenoticeabout.php','tubenotice','width=250,height=240,location=no,menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no');
}

function popAskAFriend (uid, qid){
	aafurl = "askafriend.php?uid=" + uid + "&qid=" + qid;
	window.open(aafurl,'AskAFriend','width=400,height=220,location=no,menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no');
}

function popJobSendAFriend(jid){
	safurl = "sendafriend.php?jid=" + jid;
	window.open(safurl,'SendToAFriend','width=400,height=470,location=no,menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no');
}

function popAdSendAFriend(adid){
	safurl = "sendafriend.php?ad_id=" + adid;
	window.open(safurl,'SendToAFriend','width=400,height=470,location=no,menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no');
}

function popEmailForm(id,typer){
	safurl = "/custemailform.php?id="+id+"&type="+typer;
	window.open(safurl,'SendAnEmail','width=400,height=470,location=no,menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no');
}

function popNewsSendAFriend(newsid){
	safurl = "sendafriend.php?news_id=" + newsid;
	window.open(safurl,'SendToAFriend','width=400,height=470,location=no,menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no');
}

function popAdEmailSeller(adid){
	safurl = "sendseller.php?ad_id=" + adid;
	window.open(safurl,'SendEmailToSeller','width=400,height=470,location=no,menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no');
}


function popTickets (dest){
	window.open(dest,'ticketpage','width=780,location=yes,menubar=yes,status=yes,resizable=yes,scrollbars=yes,toolbar=yes');
}

function popCompPic(pc,w,h){
	var murl = "../images/friday4/4/" + pc +".jpg";
	var picture = "<img src=\"" + murl + "\" border=\"0\">";
	var content = "<html><head><title>Friday 4 - Question 4</title><style>body{margin:0}</style></head><body>"+picture+"</body></html>";
	var params = "width="+(w)+" Height="+(h);
	var picWin = window.open("",'picpage',params);
	picWin.document.write(content);
}

function NotAllowed(){
	window.alert("You have to tell us who you are before you can enter the competition");	
}