var ajax = new sack();


// Locale

function getLocaleLists(sel, node)
{
	if(node == 1)
	{
		document.getElementById('loc_select_box_2').style.display = 'none';
		document.getElementById('loc_select_box_3').style.display = 'none';
		
		document.getElementById('loc_select_box_2').options.length = 0;	// Empty select box
		document.getElementById('loc_select_box_3').options.length = 0;	// Empty select box
		
		ajax.onCompletion = createSubLocs1; // Specify function that will be executed after file has been found
	}
	if(node == 2)
	{
		document.getElementById('loc_select_box_3').style.display = 'none';

		document.getElementById('loc_select_box_3').options.length = 0;	// Empty select box
		
		ajax.onCompletion = createSubLocs2; // Specify function that will be executed after file has been found
	}
	
	//var propertyType = sel.options[sel.selectedIndex].value;
	var localeid = sel.options[sel.selectedIndex].value;
	ajax.requestFile = 'http://www.niteclubuk.com/localejs.php?localesid='+localeid;	// Specifying which file to get
	ajax.runAJAX();		// Execute AJAX function
}

function createSubLocs1()
{

	var obj = document.getElementById('loc_select_box_2');

	eval(ajax.response);	// Executing the response from Ajax as Javascript code	
}

function createSubLocs2()
{
	var obj = document.getElementById('loc_select_box_3');
	eval(ajax.response);	// Executing the response from Ajax as Javascript code	
}

function thumbs(d,c,l,gd){
	ajax.onCompletion = updateThumbs; // Specify function that will be executed after file has been found
	ajax.requestFile = 'http://www.niteclubuk.com/js/gal.php?d='+d+'&c='+c+'&l='+l+'&gd='+gd;	// Specifying which file to get
	ajax.runAJAX();		// Execute AJAX function
}


function updateThumbs(){
	document.getElementById('gallery_thumbs').innerHTML= ajax.response;
}

function uprof(u,t,rtf){
	if(rtf=='messageBox'){
		ajax.onCompletion = messageBox; // Specify function that will be executed after file has been found
	}
	else if(rtf=='messageBox2'){
		ajax.onCompletion = messageBox2; // Specify function that will be executed after file has been found
	}
	else if(rtf=='gMsgBox'){
		ajax.onCompletion = gMsgBox; // Specify function that will be executed after file has been found
	}
	else if(rtf=='gMsgBoxS'){
		ajax.onCompletion = gMsgBoxS; // Specify function that will be executed after file has been found
	}
	ajax.requestFile = 'http://www.niteclubuk.com/js/up.php?i='+u+'&t='+t;	// Specifying which file to get
	ajax.runAJAX();		// Execute AJAX function
}


function messageBox(){
	var response = new String(ajax.response);	// Executing the response from Ajax as Javascript code
	var values = response.split(',');
	var lastuid = values[0];
	var uidtid = values[1];
	var uid = values[2];
	var username = values[3];
	var hidden = values[4]; 
	var avatar = values[5];
	var posts = values[6];
	var spot = values[7];
	var spotter = '';
	var pic_rating = values[8];
	if(pic_rating!=0 || pic_rating=='undefined')
		rating = 'Pic rating: <a href="/forums/memberlist.php?mode=viewprofile&u=' + uid +'">' + pic_rating+'</a>';
	else
		rating = 'Pic rating: <a href="/forums/memberlist.php?mode=viewprofile&u=' + uid +'">Not yet rated</a>';
	if(spot=="y"){
		spotter = ' (Spotter)';
	}
	document.getElementById('uinfo'+uidtid).innerHTML="<div style=\"padding-left:5px; padding-top:10px; padding-right:5px;\"><div style=\"float:left; font-size:12pt;\">" + username + spotter + "</div><div style=\"float:right; padding-right:5px;\"><a href=\"#\" onclick=\"document.getElementById('uinfo" + uidtid + "').style.display='none';\">close window</a></div><br clear=\"all\" /><br clear=\"all\" /><center><img src=\"/avatars/" + avatar + "\" /><br />" + rating + "</center><br /><div style=\"float:left;\"><a href=\"/forums/search.php?author_id=" + uid + "&sr=posts\">Forum posts: " + posts+"</a><br /><a href=\"/find-galleries/" + uid + "\">View my galleries</a><br /></div><div style=\"float:right;\"><a href=\"/forums/ucp.php?i=pm&mode=compose&u=" + uid + "\">Send me a PM >></a><br /><a href=\"/be-my-buddy/rq/" + uid + "\">Be my Buddy >></a></div>";
	
	if(lastuid!=""){
		
		try{
	        document.getElementById('uinfo'+lastuid).style.display="none";
		}
		catch (error) {}
		
		try{
	    	  document.getElementById('uinfo'+lastuid+"_2").style.display="none";
		}
		catch (error) {}
		

	}
	
	document.getElementById('uinfo'+uidtid).style.display="inline";
	
}

function messageBox2(){
	
	var response = new String(ajax.response);	// Executing the response from Ajax as Javascript code
	var values = response.split(',');
	var lastuid = values[0];
	var uidtid = values[1];
	var uid = values[2];
	var username = values[3];
	var hidden = values[4]; 
	var avatar = values[5];
	var posts = values[6];
	var spot = values[7];
	var pic_rating = values[8];
	if(pic_rating!=0 || pic_rating=='undefined')
		rating = 'Pic rating: <a href="/forums/memberlist.php?mode=viewprofile&u=' + uid +'">' + pic_rating+'</a>';
	else
		rating = 'Pic rating: <a href="/forums/memberlist.php?mode=viewprofile&u=' + uid +'">Not yet rated</a>';
	var spotter = '';
	if(spot=="y"){
		spotter = ' (Spotter)';
	}
	document.getElementById('uinfo'+uidtid+"_2").innerHTML="<div style=\"padding-left:5px; padding-top:10px; padding-right:5px;\"><div style=\"float:left; font-size:12pt; padding-bottom:2px;\">" + username + spotter + "</div><div style=\"float:right; padding-right:5px;\"><a href=\"#\" onclick=\"document.getElementById('uinfo" + uidtid + "_2').style.display='none';\">close window</a></div><br clear=\"all\" /><br clear=\"all\" /><center><img src=\"/avatars/" + avatar + "\" /><br />" + rating + "</center><br /><div style=\"float:left;\"><a href=\"/forums/search.php?author_id=" + uid + "&sr=posts\">Forum posts: " + posts+"</a><br /><a href=\"/find-galleries/" + uid + "\">View my galleries</a></div><div style=\"float:right;\"><a href=\"/forums/ucp.php?i=pm&mode=compose&u=" + uid + "\">Send me a PM >></a><br /><a href=\"/be-my-buddy/rq/" + uid + "\">Be my Buddy >></a></div>";

	if(lastuid!=""){
		
		try{
	        document.getElementById('uinfo'+lastuid).style.display="none";
		}
		catch (error) {}
		
		try{
	    	  document.getElementById('uinfo'+lastuid+"_2").style.display="none";
		}
		catch (error) {}
	}
	document.getElementById('uinfo'+uidtid+"_2").style.display="inline";
}

function gMsgBox(){
	var response = new String(ajax.response);	// Executing the response from Ajax as Javascript code
	var values = response.split(',');
	var lastuid = values[0];
	var uidtid = values[1];
	var uid = values[2];
	var username = values[3];
	var hidden = values[4]; 
	var avatar = values[5];
	var posts = values[6];
	var spot = values[7];
	var spotter = '';
	var pic_rating = values[8];
	if(pic_rating!=0 || pic_rating=='undefined')
		rating = 'Pic rating: <a href="/forums/memberlist.php?mode=viewprofile&u=' + uid +'">' + pic_rating+'</a>';
	else
		rating = 'Pic rating: <a href="/forums/memberlist.php?mode=viewprofile&u=' + uid +'">Not yet rated</a>';
	if(spot=="y"){
		spotter = ' (Spotter)';
	}
	document.getElementById('uinfo' + uidtid).innerHTML="<div style=\"padding-left:5px; padding-top:10px; padding-right:5px;\"><div style=\"float:left; font-size:12pt; padding-bottom:2px;\">" + username + spotter + "</div><div style=\"float:right; padding-right:5px;\"><a href=\"#\" class=\"msgBoxa\" onclick=\"document.getElementById('uinfo" + uidtid + "').style.display='none';\">close window</a></div><br clear=\"all\" /><br clear=\"all\" /><center><img src=\"/avatars/" + avatar + "\" /><br />" + rating + "</center><br /><div style=\"float:left;\"><a href=\"/forums/search.php?author_id=" + uid + "&sr=posts\" class=\"msgBoxa\">Forum posts: " + posts+"</a><br /><a class=\"msgBoxa\" href=\"/find-galleries/" + uid + "\" style=\"margin-left:10px;\">View my galleries</a></div><div style=\"float:right;\"><a href=\"/forums/ucp.php?i=pm&mode=compose&u=" + uid + "\" class=\"msgBoxa\">Send me a PM >></a><br /><a href=\"/be-my-buddy/rq/" + uid + "\">Be my Buddy >></a></div>";
	document.getElementById('uinfo' + lastuid).style.display="none";

	document.getElementById('uinfo' + uidtid).style.display="inline";
	
}


function gMsgBoxS(){
	var response = new String(ajax.response);	// Executing the response from Ajax as Javascript code
	var values = response.split(',');
	var lastuid = values[0];
	var uidtid = values[1];
	var uid = values[2];
	var username = values[3];
	var hidden = values[4]; 
	var avatar = values[5];
	var posts = values[6];
	var spot = values[7];
	var spotter = ''; 
	var pic_rating = values[8];
	if(pic_rating!=0 || pic_rating=='undefined')
		rating = 'Pic rating: <a href="/forums/memberlist.php?mode=viewprofile&u=' + uid +'">' + pic_rating+'</a>';
	else
		rating = 'Pic rating: <a href="/forums/memberlist.php?mode=viewprofile&u=' + uid +'">Not yet rated</a>';
		
	if(spot=="y"){
		spotter = ' (Spotter)';
	}
	document.getElementById('uinfo' + uidtid).innerHTML="<div style=\"padding-left:5px; padding-top:10px; padding-right:5px;\"><div style=\"float:left; font-size:12pt; padding-bottom:2px;\">" + username + spotter + "</div><div style=\"float:right; padding-right:5px;\"><a href=\"#gal\" class=\"msgBoxa\" onclick=\"document.getElementById('uinfo" + uidtid + "').style.display='none';\">close window</a></div><br clear=\"all\" /><br clear=\"all\" /><center><img src=\"/avatars/" + avatar + "\" /><br />" + rating + "</center><br /><div style=\"float:left;\"><a href=\"/forums/search.php?author_id=" + uid + "&sr=posts\" class=\"msgBoxa\">Forum posts: " + posts+"</a><br /><a class=\"msgBoxa\" href=\"/find-galleries/" + uid + "\" style=\"margin-left:10px;\">View my galleries</a></div><div style=\"float:right;\"><a href=\"/forums/ucp.php?i=pm&mode=compose&u=" + uid + "\" class=\"msgBoxa\">Send me a PM >></a><br /><a href=\"/be-my-buddy/rq/" + uid + "\">Be my Buddy >></a></div>";
	document.getElementById('uinfo' + lastuid).style.display="none";

	document.getElementById('uinfo' + uidtid).style.display="inline";
	
}




function daysEnable()
{
	document.getElementById('days').style.display = "inline";
}
function daysDisable()
{
	document.getElementById('days').style.display = "none";
}
function rateU(value,userId)
{
	window.location = "http://www.niteclubuk.com/rate-profile/" + userId + "/" + value;
}

/* Actually slideshow code but this file's included everywhere */

	var useBSNns;
				
				if (useBSNns)
				{
					if (typeof(bsn) == "undefined")
						bsn = {}
					var _bsn = bsn;
				}
				else
				{
					var _bsn = this;
				}
				
				
				

				_bsn.Crossfader = function (divs, fadetime, delay )
				{	
					
					this.nAct = -1;
					this.aDivs = divs;
					
					for (var i=0;i<divs.length;i++)
					{
						document.getElementById(divs[i]).style.opacity = 0;
						document.getElementById(divs[i]).style.position = "absolute";
						document.getElementById(divs[i]).style.filter = "alpha(opacity=0)";
						document.getElementById(divs[i]).style.visibility = "hidden";
					}
					
					this.nDur = fadetime;
					this.nDelay = delay;
					
					this._newfade();
					
				}
				
				
				_bsn.Crossfader.prototype._newfade = function()
				{
						if (this.nID1)
							clearInterval(this.nID1);
						
						this.nOldAct = this.nAct;
						this.nAct++;
						if (!this.aDivs[this.nAct])	this.nAct = 0;
						
						if (this.nAct == this.nOldAct)
							return false;
						
						document.getElementById( this.aDivs[this.nAct] ).style.visibility = "visible";
						
						this.nInt = 50;
						this.nTime = 0;
						
						var p=this;
						this.nID2 = setInterval(function() { p._fade() }, this.nInt);
						if(typeof(tmptst)=="undefined"){
							tmptst = "1";
						}else{
							if(tmptst == "1"){
								this.nDelay = 500000;
							}
						}
				}
				
				
				_bsn.Crossfader.prototype._fade = function()
				{
					this.nTime += this.nInt;
					
					var ieop = Math.round( this._easeInOut(this.nTime, 0, 1, this.nDur) * 100 );
					var op = ieop / 100;
					document.getElementById( this.aDivs[this.nAct] ).style.opacity = op;
					document.getElementById( this.aDivs[this.nAct] ).style.filter = "alpha(opacity="+ieop+")";
					
					if (this.nOldAct > -1)
					{
						document.getElementById( this.aDivs[this.nOldAct] ).style.opacity = 1 - op;
						document.getElementById( this.aDivs[this.nOldAct] ).style.filter = "alpha(opacity="+(100 - ieop)+")";
					}
					
					if (this.nTime == this.nDur)
					{
						clearInterval( this.nID2 );
						
						if (this.nOldAct > -1)
							document.getElementById( this.aDivs[this.nOldAct] ).style.visibility = "hidden";	
						
						var p=this;
						this.nID1 = setInterval(function() { p._newfade() }, this.nDelay);
					}
				}
				
				
				
				_bsn.Crossfader.prototype._easeInOut = function(t,b,c,d)
				{
					return c/2 * (1 - Math.cos(Math.PI*t/d)) + b;
				}
