
	function openForumComposerWindow(command,topicid,postid) {
		var url = _HTTP_HOST + "forum/EditMessage.asp?command=" + command;
		if ( typeof(topicid) != "undefined" ) {
			url += "&topicid=" + topicid;
		}
		if(typeof(postid)!="undefined"){
			url+="&postid="+postid;
		}
		var win=window.open(url,"winforumcomposer","width=620,height=500,top=100,left=100");
		return false;
	}
	function openGroupsComposerWindow(command,groupid,topicid,postid) {
		var url = _HTTP_HOST + "groups/EditMessage.asp?command=" + command;
		if(typeof(groupid)!="undefined"){url+="&groupid="+groupid;}
		if(typeof(topicid)!="undefined"){url+="&topicid="+topicid;}
		if(typeof(postid)!="undefined"){url+="&postid="+postid;}
		var win=window.open(url,"wingroupscomposer","width=620,height=500,top=100,left=100");
		return false;
	}
	function fp() {
		window.open('/my/profile/fp.htm','fp','width=400,height=250,left=300,top=300,scrollbars=no,resizable=no,status=no,toolbar=no,location=no');
		return false;
	}
	function openNotAMemberPopupWindow() {
		var url = "/groups/notamember.asp";
		var win = window.open(url,"wnotamember","width=200,height=230,top=100,left=100");
		return false;
	}	
	function openNewsletterPopupWindow( ) {
		var url = _HTTP_HOST + "newsletterpopup.asp";
		var win = window.open(url,"winnewsletterpopup","width=200,height=230,top=100,left=100");
		return false;
	}
	function getQmpeopleUserUrl(id) {
		var thelink="";
		var mode="FILENAME";		
		switch(id) {
			case "1000000" :
				id="community";
				break;
			case "1000001" : 
				id="helpdesk";
				break;
			case "1000002" : 
				id = "info";
				break;
		}		
		switch(mode) {
			case "PARAMETER": 
				thelink = _HTTP_HOST + "users/?nickname=" + id;
				break;
			case "FILENAME": 
				if(isNaN(id)){ // se è stato passato un nickname
					thelink=_HTTP_HOST+"users/"+id;
				} else { // se è stato passato un qmpid
					thelink=_HTTP_HOST+"users/?nickname="+id;
				}
				break;
		}
		return thelink;
	}	
	
	function openQmpeopleWindow(nickname) {
		var url = _HTTP_HOST + "users/";
		if(typeof(nickname)!="undefined"){
			url=getQmpeopleUserUrl(nickname);
		}
		var win=window.open(url,"winqmpeople","width=800,height=600,left=50,top=50,resizable=yes,scrollbars=yes,location=yes,menubar=yes,status=yes,toolbar=yes");
		win.focus();
		return false;
	}

	function changeToQmpeople(id){
		var opener=window.opener;
		if(opener!=null){
			opener.location.replace(getQmpeopleUserUrl(id));
		}
		return false;
	}

	function openMessageComposerWindow2(nickname,type){
		var url, win;
		url = _HTTP_HOST + "my/messages/MessageComposer.asp";
		if ( typeof(nickname) != "undefined" ) {
			url += "?recipient=" + nickname;
		}
		if ( typeof(type) != "undefined" ) {
			url += "&type=" + type;
		}
		win = window.open(url,"winmessage","width=600,height=430,top=100,left=100");
		win.focus( );
		return false;
	}
function openVideoCommentComposerWindow(){var win;win=window.open(_HTTP_HOST+"video/commentcomposer.asp","winmessage","width=600,height=430,top=100,left=100");win.focus( );return false;}
function openLocatorWindow(nickname){var url;url=_HTTP_HOST+"users/locator.asp";if(typeof(nickname)!="undefined"){url+="?nickname="+nickname;}win=window.open(url,"winmessage","width=600,height=430,top=100,left=100");win.focus();return false;}
function openOnlineUsersWindow(){var url = "/online/default.asp";var win=window.open(url,"winonlineusers","width=230,height=500,top=0,left=0");return false;}
function openNewEntryWindow(){var url = "/new/default.asp";var win=window.open(url,"winnewentry","width=230,height=500,top=0,left=0,scrollbars=no,resizable=no");return false;}
function openSurveySubmitWindow(){var url = "/polls/default.asp";var win=window.open(url,"winsurveysubmit","width=450,height=400,top=200,left=200");return false;}
function openDailyMindSubmitWindow(){var url = _HTTP_HOST + "dailyminds/default.asp";var win=window.open(url,"windailymindsubmit","width=400,height=400,top=100,left=100");	return false;}
function openTopQmpUserBannerSubmitWindow(){var url = _HTTP_HOST + "arena/submitbanner.asp";var win=window.open(url,"wintopqmpuserbannersubmit","width=600,height=450,top=50,left=50");return false;}	
function openJokesSubmitWindow(){var url = _HTTP_HOST + "jokes/default.asp";var win=window.open(url,"winjokessubmit","width=400,height=400,top=100,left=100");return false;}
function openFooterWindow(windir){var url = _HTTP_HOST + windir + "/default.asp";var win=window.open(url,"winfooter","width=500,height=450");win.focus( );return false;}
function openUpdateErrorWindow(){var url = _HTTP_HOST + "updateerror.asp";var win=window.open(url,"winupdateerror","width=400,height=250,top=100,left=100");win.focus( );return false;}
function changeSearchGender(gender) {
		getElement(window.document,"current_gender").value = gender;

		if (gender == "M") {
			getElement(window.document,"male").style.backgroundColor="#ffa500";
			//getElement(window.document,"male").onmouseover = "";
			//getElement(window.document,"male").onmouseout = "";

			getElement(window.document,"female").style.backgroundColor="#ffd700";
			//getElement(window.document,"female").onmouseover = "this.style.backgroundColor=#ffa500";
			//getElement(window.document,"female").onmouseout = "this.style.backgroundColor=\"#ffd700\"";

			getElement(window.document,"both").style.backgroundColor="#ffd700";
			//getElement(window.document,"both").onmouseover = "this.style.backgroundColor='#ffa500'";
			//getElement(window.document,"both").onmouseout = "this.style.backgroundColor='#ffd700'";
		}

		if (gender == "F") {
			getElement(window.document,"male").style.backgroundColor="#ffd700";
			getElement(window.document,"female").style.backgroundColor="#ffa500";
			getElement(window.document,"both").style.backgroundColor="#ffd700";
		}

		if (gender == "B") {
			getElement(window.document,"male").style.backgroundColor="#ffd700";
			getElement(window.document,"female").style.backgroundColor="#ffd700";
			getElement(window.document,"both").style.backgroundColor="#ffa500";
		}

		return false;
	}

	function changeChatGender(gender) {
		getElement(window.document,"current_gender").value = gender;

		if (gender == "M") {
			getElement(window.document,"male").style.backgroundColor="#ffa500";
			getElement(window.document,"female").style.backgroundColor="#ffff99";
			getElement(window.document,"both").style.backgroundColor="#ffff99";
		}
		if (gender == "F") {
			getElement(window.document,"male").style.backgroundColor="#ffff99";
			getElement(window.document,"female").style.backgroundColor="#ffa500";
			getElement(window.document,"both").style.backgroundColor="#ffff99";
		}
		if (gender == "A") {
			getElement(window.document,"male").style.backgroundColor="#ffff99";
			getElement(window.document,"female").style.backgroundColor="#ffff99";
			getElement(window.document,"both").style.backgroundColor="#ffa500";
		}
		return false;
	}
	
	function openRegistrationWindow(){var url=_HTTP_HOST+"signup/default.asp";
		window.document.location.href = url;
		return false;
	}
	
	function centeredWin(w,h) {
		return "left="+((screen.width/2)-w/2)+",top="+((screen.height/2)-h/2)+",width="+w+",height="+h;
	}

	function openAddPhotoWindow(notify) {
		if (notify == undefined) {
			notify="0";
		}
		var url="/photofunctions/profileaddphoto.asp?n=" + notify;
		var win=window.open(url,"wAP",centeredWin(450,400));
		return false;
	}

	function openAddPayDonationWindow(notifyid) {
		var url="/helpme/paydonation.asp?nid=" + notifyid;
		var win = window.open(url,"wAPD",centeredWin(450,400));
		return false;
	}

	function openAddVideoWindow( ) {
		var url="/my/profile/addvideo.asp";
		var win = window.open(url,"wAV",centeredWin(450,400));
		return false;
	}

	function openAddDonationWindow( ) {
		var url="/helpme/adddonation.asp";
		var win=window.open(url,"wAD",centeredWin(450,400));
		return false;
	}

	function openAddLinkWindow( ) {
		var url="/my/profile/addlink.asp";
		var win = window.open(url,"wAL",centeredWin(450,400));
		return false;
	}

	function openOneTimeAdvPopupWindow(){var url=_HTTP_HOST + "adv/advonetimepopup.asp";var win = window.open(url,"winAdvOneTimePopup","left=200,top=150,width=350,height=300,resizable=no");win.focus();return false;}

	function profilePhotoSendPhoto( ) {
		var filepath = window.document.formsendphoto.photo_file.value;
		var fileextension = "";
		if (filepath != "") {
			fileextension = right(filepath,4);
			
			if (fileextension.toLowerCase( ) == ".jpg") {
				window.document.formsendphoto.submit( );
				return false;
			}
			fileextension = right(filepath,5);
			
			if (fileextension.toLowerCase( ) == ".jpeg") {
				window.document.formsendphoto.submit( );
				return false;
			}
			window.alert(VIDEOINVALIDCODETEXT);
		}
		return false;
	}

	function sendVideo() {
		var upt=document.getElementById('upls2').value;
		var title=document.getElementById('video_title').value;
		var descr=document.getElementById('video_description').value;
		if(upt=='0' || upt=='-1' || title == ""){
			window.alert(QMPADDVIDEOCOMPLETEALLFIELDS);
		} else {
			window.document.formsendvideo.submit();
		}
		return false;
	}

	function sendLink() {
		var d = window.parent.document;
		var url = d.getElementById('purl').value;
		var title = d.getElementById('ptitle').value;
		var descr = d.getElementById('pdescr').value;
		var preview = d.getElementById('ppreview').value;
		if(url=="") {
			window.alert(QMPADDLINKREQUIREDFIELDS);
		} else {
			d.formsendlink.submit( );
		}
		return false;
	}

function myQmpeopleOpenWindow(){var url=_HTTP_HOST+"users/myqmpeople.asp";var win=window.open(url,"winmyqmpeople","width=500,height=520");return false;}
function subscribeNewsletter(){window.document.newsletterform.submit();return false;}
function myGroupsOpenWindow(){var url=_HTTP_HOST+"groups/mygroups.asp";var win=window.open(url,"winmygroups","width=500,height=570");return false;}

function showLastReminderSender(type){
		var _QMPID = 0, _NICKNAME = 1, _DEFAULTPHOTO = 2, _GENDER = 3, _REGISTRATIONCOUNTRY = 4;
		var data = null;
		var notifiertext = "";
		var notifierlink = "";
		var text = "";
		
		switch(type.toLowerCase( )) {
			case "msg":
				data = _unreadmsglastsender.split(";");
				notifiertext = "<strong>" + LOGONGROUPCLIENTMSGTEXT + "</strong>";
				notifierlink = "<a href=\"" + _HTTP_HOST + "messages/" + "\"><strong>" + LOGONGROUPCLIENTMSGLINK + "</strong></a>";
				break;
			case "sms":
				data = _unreadsmslastsender.split(";");
				notifiertext = "<strong>" + LOGONGROUPCLIENTSMSTEXT + "</strong>";
				notifierlink = "<a href=\"" + _HTTP_HOST + "messages/" + "\"><strong>" + LOGONGROUPCLIENTSMSLINK + "</strong></a>";
				break;
			case "chat":
				data = _chatcallslastsender.split(";");
				notifiertext = "<strong>" + LOGONGROUPCLIENTCHATTEXT + "</strong>";
				notifierlink = "<a href=\"" + _HTTP_HOST + "chat/" + "\"><strong>" + LOGONGROUPCLIENTCHATLINK + "</strong></a>";
				break;
			case "online":
				data = _onlineuserslastsender.split(";");
				if ( data[_GENDER].toLowerCase( ) == "m" ) {
					notifiertext = "<strong>" + LOGONGROUPCLIENTONLINEMALETEXT + "</strong>";
				} else {
					notifiertext = "<strong>" + LOGONGROUPCLIENTONLINEFEMALETEXT + "</strong>";
				}
				notifierlink = "<a href=\"" + _HTTP_HOST + "chat/" + "\"><strong>" + LOGONGROUPCLIENTONLINELINK + "</strong></a>";
				break;
			case "birthdays":
				data = _birthdayslastsender.split(";");
				notifiertext = "<strong>" + LOGONGROUPCLIENTBIRTHDAYTEXT + "</strong>";
				if ( data[_GENDER].toLowerCase( ) == "m" ) {
					notifierlink = "<a href=\"" + _HTTP_HOST + "messages/" + "\"><strong>" + LOGONGROUPCLIENTBIRTHDAYMALELINK + "</strong></a>";
				} else {
					notifierlink = "<a href=\"" + _HTTP_HOST + "messages/" + "\"><strong>" + LOGONGROUPCLIENTBIRTHDAYFEMALELINK + "</strong></a>";
				}
				break;
		}
		
		data[_DEFAULTPHOTO] = countryToHostnameLookup( data[_REGISTRATIONCOUNTRY] ) + getPhotoUrl( data[_QMPID], data[_DEFAULTPHOTO], data[_GENDER], "avatar" );
		data[_NICKNAME] = "<a href=\"" + _HTTP_HOST + "users/" + data[_NICKNAME] + "\">" + data[_NICKNAME] + "</a>";

		text = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\">";
			text += "<tr>";
				text += "<td align=\"center\">";
					text += notifiertext;
				text += "</td>";
			text += "</tr>";
			text += "<tr>";					
				text += "<td align=\"center\">";
					text += doUserCard(data[_DEFAULTPHOTO],data[_NICKNAME]);
				text += "</td>";
			text += "</tr>";
			text += "<tr>";					
				text += "<td align=\"center\">";
					text += notifierlink;
				text += "</td>";
			text += "</tr>";
		text += "</table>";

		changeContent(window.document,"notifierdatadiv",text);
		return false;
	}
	
	function SetCookie(name, value, expires, path, domain, secure) {
	    document.cookie = name + "=" + escape (value) +
	         ((expires) ? "; expires=" + expires.toGMTString() : "") +
	         ((path) ? "; path=" + path : "") +
	         ((domain) ? "; domain=" + domain : "") +
	         ((secure) ? "; secure" : "");
	}

	function getCookieVal(offset) {
	     var endstr = document.cookie.indexOf (";", offset);
	     if (endstr == -1) {
	         endstr = document.cookie.length;
	     }
	     return unescape(document.cookie.substring(offset, endstr));
	}

	function GetCookie(name) {
	   var arg = name + "=";
	   var alen = arg.length;
	   var clen = document.cookie.length;
	   var i = 0;
	   while (i < clen) {
	     var j = i + alen;
	     if (document.cookie.substring(i, j) == arg)
	       return getCookieVal (j);
	     i = document.cookie.indexOf(" ", i) + 1;
	     if (i == 0) break; 
	   }
	   return null;
	}

	function testCookie( ) {
		SetCookie("test","yes");
		if ( GetCookie("test") == null ) {
			self.location.replace(_HTTP_HOST + "disabled-cookies.asp");
		} 
	}	
	
	function doScrollbarCss(name,width,height) {
		var offset = 0;

		var thestyle = "";
		thestyle += "<style>";
		thestyle += "div#hold" + name + "{";
		thestyle += "position:relative; overflow:hidden;";
		thestyle += "width:" + width + "; height:" + height + "px;"; 
		thestyle += "z-index:100;";
		thestyle += "}";
		thestyle += "div#wn" + name + "{";
		thestyle += "position:absolute;";
		thestyle += "left:0px; top:0px;";
		thestyle += "width:" + width + "px" + "; height:" + height + "px;"; 
		thestyle += "clip:rect(0px," + width + "px" + "," + height + "px" + "," + "0px);";
		thestyle += "overflow:hidden;";
		thestyle += "z-index:1;";
		thestyle += "}";
		thestyle += "div.content" + name + " {";
		thestyle += "position:absolute; visibility:hidden;";
		thestyle += "left:0px; top:0px;";
		thestyle += "z-index:1;";
		thestyle += "}";
		thestyle += "div#scrollbar" + name + " {";
		thestyle += "position:relative; left:0; top:0;";
		thestyle += "width:13px; height:" + height + "px;";
		thestyle += "font-size:1px; z-index:1;";
		thestyle += "}";
		thestyle += "div#track" + name + " {"; 
		thestyle += "position:absolute; left:0; top:12px;";
		thestyle += "width:13px; height:" + (height - (13*2) + 2) + "px;";
		thestyle += "background: #336 repeat;";
		thestyle += "z-index:1;";
		thestyle += "}";
		thestyle += "div#dragBar" + name + " {";
		thestyle += "position:absolute; left:1px; top:1px;";
		thestyle += "width:11px; height:20px;";
		thestyle += "background-color:#ceced6;";
		thestyle += "z-index:1;";
		thestyle += "}";
		thestyle += "div#up" + name + " { position:absolute; left:0; top:0; z-index:2 }";
		thestyle += "div#down" + name + " { position:absolute; left:0; bottom:0; z-index:3 }";
		thestyle += "</style>";
		
		document.write(thestyle);
	}
	
	function initScrollBar(name) {
		/*************************************************************************
		  This code is from Dynamic Web Coding at www.dyn-web.com
		  Copyright 2001-4 by Sharon Paine 
		  See Terms of Use at www.dyn-web.com/bus/terms.html
		  regarding conditions under which you may use this code.
		  This notice must be retained in the code as is!
		*************************************************************************/

		// arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 
		// if horizontal scrolling, id of element containing scrolling content (table?)
		var wndo = new dw_scrollObj("wn" + name, "divbody" + name);
			  
		// bSizeDragBar set true by default (explained at www.dyn-web.com/dhtml/scroll/ )
		// wndo.bSizeDragBar = false;
			  
		// arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset
		// (x/y offsets of dragBar in track)
		wndo.setUpScrollbar("dragBar" + name, "track" + name, "v", 1, 1);
			  
		// pass id('s) of scroll area(s) if inside table(s)
		// i.e., if you have 3 (with id's wn1, wn2, wn3): dw_scrollObj.GeckoTableBugFix('wn1', 'wn2', 'wn3');
		dw_scrollObj.GeckoTableBugFix("wn" + name); 
		wndo = null;
	}
	
	function doUserCard( defaultimage, nickname, info  ) {
		var usercard = "";
		usercard += "<table style=\"border:0px;width:100%;\" bgcolor=\"#ffff99\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">";
			usercard += "<tr>";	
				usercard += "<td class=\"border\">";
					usercard += "<table width=\"100%\" cellpadding=\"2\">";
						usercard +=	"<tr>";
							usercard += "<td style=\"width:30%;\">";
								usercard += "<img width=\"45\" height=\"45\" src=\"" + defaultimage + "\" border=\"1\">";
							usercard += "</td>";

							usercard += "<td width=\"70%\">";
								usercard += "<table style=\"height:100%;border:0px;width:100%;\" cellspacing=\"0\" cellpadding=\"0\">";
									usercard += "<tr>";
										usercard += "<td valign=\"top\" align=\"right\">";
											usercard += "<img src=\"" + _HTTP_HOST + "images/usercard_relief.gif" + "\" border=\"0\" alt=\"\">";
										usercard += "</td>";
									usercard += "</tr>";
													
									usercard += "<tr>";
										usercard += "<td class=\"nickname\" align=\"center\">";
											usercard += nickname;
										usercard += "</td>";
									usercard += "</tr>";
													
									usercard += "<tr>";
									if ( typeof(info) != "undefined" ) {
										usercard += "<td class=\"description\">";
											usercard += info;
										usercard += "</td>";
									} else {
										usercard += "<td class=\"description\">";
											usercard += "&nbsp;"
										usercard += "</td>";
									}
									usercard += "</tr>";
								usercard += "</table>";
							usercard +=	"</td>";
						usercard += "</tr>";
					usercard += "</table>";
				usercard += "</td>";
			usercard += "</tr>";
		usercard += "</table>";					
		return usercard;
	}	
	
	function userPhotoUrl(usrid,photoname) {
		var url = _HTTP_HOST + "users/photo/" + "USER_" + usrid + "/" + photoname;
		return url;
	}
		
	function getPhotoUrl(usrid, photoname, gender, type) {
		var url;
		gender = gender.toLowerCase( );
		if ( photoname == null || photoname.toLowerCase( ) == "null" || photoname == "" || photoname.toLowerCase( ) == "nothing" ) {
			switch( type.toLowerCase( ) ) {
				case "photo" : 
					if ( gender == "m" ) {
						url = _HTTP_HOST + "images/standardmale.jpg";
					} else if ( gender == "f" ) {
						url = _HTTP_HOST + "images/standardfemale.jpg";
					} else {
						url = _HTTP_HOST + "images/blank.gif";
					}
					break;
				case "avatar" : 
					if ( gender == "m" ) {
						url = _HTTP_HOST + "images/standardmale_avatar.jpg";
					} else if ( gender == "f" ) {
						url = _HTTP_HOST + "images/standardfemale_avatar.jpg";
					} else {
						url = _HTTP_HOST + "images/blank.gif";
					}	
					break;
				case "thumb" : 
					if ( gender == "m" ) {
						url = _HTTP_HOST + "images/standardmale_thumb.jpg";
					} else if ( gender == "f" ) {
						url = _HTTP_HOST + "images/standardfemale_thumb.jpg";
					} else {
						url = _HTTP_HOST + "images/blank.gif";
					}
					break;
			}
		} else {
			url = userPhotoUrl(usrid,photoname);
			url += "_" + type + ".jpg";
		}
		return url;
	}
	
	function countryToHostnameLookup(countrycode) {
		var hostname = "";
		//countrycode = parseInt(countrycode,10);
		switch(countrycode) {
			case 98 : // Italia
				hostname = "http://www.qmpeople.it";
				break;
			case 213: // Inghilterra
				hostname = "http://www.qmpeople.co.uk";
				break;
			case 214: // Stati uniti
				hostname = "http://www.qmpeople.us";
				break;
			case 0: // International
				hostname = "http://www.qmpeople.com";
				break;
			case 13: // Australia
				hostname = "http://www.qmpeople.com.au";
				break;
			case 144: // Nuova Zelanda
				hostname = "http://www.qmpeople.co.nz";
				break;
			case 96: // Irlanda
				hostname = "http://www.qmpeople.ie";
				break;
			case 187: // Sudafrica
				hostname = "http://www.qmpeople.co.za";
				break;
		}
		return hostname;
	}
	
	function doResizeableStyles(par) {
		testCookie( );
	}
	
	function changeSign(index,name) {
		var text = "";		
		/*
		text += "<table style=\"border:0px;width:100%;\" cellpadding=\"0\" cellspacing=\"0\">";
			text += "<tr>";
				text += "<td style=\"width:100%;\">";
					text += "<table style=\"border:0px;width:11%;\" cellspacing=\"0\" cellpadding=\"3\" align=\"left\">";
						text += "<tr>";
							text += "<td style=\"width:100%;\">";
								text += "<img style=\"border:0px;\" src=\"" + _HTTP_HOST + "images/zodiaclady.jpg" + "\" alt=\"\" style=\"LEFT: 1px; TOP: 3px\">";
							text += "</td>";
						text += "</tr>";
					text += "</table>";
								
					text += "<p align=\"justify\" style=\"font-size:11px;line-height:1.10\">";
						text += "<strong>" + name + "</strong>" + "<br>" + ZODIAC_DailyPredictions[index];
					text += "</p>";
				text += "</td>";
			text += "</tr>";
		text += "</table>";
		*/
		text += "<p align=\"justify\" style=\"font-size:11px;line-height:1.10\">";
			text += "<strong>" + name + "</strong>" + "<br>" + ZODIAC_DailyPredictions[index];
		text += "</p>";
		getElement(window.document,"prediction").innerHTML = text;		
		return false;
	}