// vote iconsfunction ratingstar_toggle(content_id, score, toggle){	for ( var i = 1; i <= score; i++ )	{		var obj = $('#ratingstar'+content_id+'__'+i)[0];		obj.src = ( toggle == 'show' ) ? (obj.src).replace(/rate0/, 'rate1') : (obj.src).replace(/rate1/, 'rate0');	}}// ratingfunction submit_rating(type, member_id, content_id, score, url){	$.post(virpath+'index.php?m=rating', {'type':type,'score':score,'member_id':member_id,'content_id':content_id},		function(response) {			var response = response.split("\n");			if ( response.length == 2 )			{				if ( response[0] == 'ok' && response[1] )				{					if ( typeof(url) != 'undefined' ) {						window.location = url;					}					else {						$('#rating_'+type+'_box'+content_id).html('<p class="response">' + response[1] + '</p>');						return true;					}				}			}		}	);}// send winkfunction send_wink(member_id, message_id){	window.location = virpath+'index.php?m=account_messages&p=quickmessage&id='+member_id+'&sid='+message_id;}// reportsfunction submit_report(type, member_id, content_id, noreason){	var reason = $('#report_'+type+'_reason'+content_id).val();	if ( !reason ) { alert(noreason); return; }	$.post(virpath+'index.php?m=report', {'type':type,'reason':reason,'member_id':member_id,'content_id':content_id},		function(response) {			var response = response.split("\n");			if ( response.length == 2 )			{				if ( response[0] == 'ok' && response[1] )				{					$('#report_'+type+'_box'+content_id).html('<p class="response">' + response[1] + '</p>');					return true;				}			}		}	);}// pollsfunction submit_poll(poll_id, answer_id){	$.post(virpath+'index.php?m=vote', {'poll_id':poll_id,'answer_id':answer_id},		function(response) {			var response = response.split("\n");			if ( response.length == 3 )			{				if ( response[0] == 'ok' && response[1] )				{					$('#poll_votes_'+poll_id).html(response[1]);					var votes = response[2].split(",");					for ( var i = 0, totalvotes = votes.length; i < totalvotes; i++ ) {						var counters = votes[i].split("=");						if ( counters.length == 2 )						{							$('#poll_'+poll_id+'_answer_votes_'+counters[0]).html(counters[1]);							$('#poll_'+poll_id+'_answer_votes_'+counters[0]+'_wrap').css('display', 'inline');						}						$('#poll_'+poll_id+'_answer_'+i).attr('disabled','disabled');						//$('poll_'+poll_id+'_answer_'+i+'_wrap').hide();					}					return true;				}			}			else if ( response.length == 2 )			{				if ( response[0] == 'ok' && response[1] )				{					$('#poll_votes_'+poll_id).html(response[1]);					for ( var i = 0; $('#poll_'+poll_id+'_answer_'+i) != null; i++ ) {						$('#poll_'+poll_id+'_answer_'+i).attr('disabled','disabled');						//$('#poll_'+poll_id+'_answer_'+i+'_wrap').hide();					}					return true;				}			}		}	);}// togglesfunction row_toggle(name){    for (var i = 0; document.getElementById(name+'_'+i) != null;  i++)    {        if (document.getElementById(name+'_'+i).style.display == "none")            $('#'+name+'_'+i).show();        else            $('#'+name+'_'+i).hide();    }}// switchesfunction row_switch(name){    $('#'+active_tab).hide();    $('#'+name).show();    active_tab = name;}// tabsvar active_tab = 0;var active_tab_first = 1;function switch_tabs(prefix, new_tab, first){	if ( typeof(first) != 'undefined' ) {		if ( active_tab_first == 1 ) {			$('#'+prefix + '_' + new_tab + '_content').show();			active_tab = new_tab;			active_tab_first = 0;		}	}	else if ( active_tab != new_tab ) {		$('#'+prefix + '_' + active_tab + '_content').hide(300);		$('#'+prefix + '_' + new_tab + '_content').show(300);		active_tab = new_tab;	}}function showhide_field(name, show){    if ( $('#'+name).css("display") == "none"  &&  (show == '' || show == undefined)  ||  show == 1 )    {        $('#'+name).fadeIn("fast");    }    else    {        $('#'+name).fadeOut("fast");    }}// miscfunction confirmLink(question, url){    var is_confirmed = confirm(question);    if (is_confirmed && url != '')        window.location = url;    return is_confirmed;}function confirmForm(question, form){    var is_confirmed = confirm(question);    if (is_confirmed && form != '')        eval('document.' + form + '.submit()');    return is_confirmed;}function toggleMessages(form, check){    for (var i = 0; i < form.elements.length; i++)    {        if (form.elements[i].type == 'checkbox')        {            form.elements[i].checked = check;        }    }}function stylizeBooleanBox(prefix, boxid){	var options = document.getElementById(prefix + boxid);	for ( var i = 0, length = options.length; i < length; i++ )	{		options[i].style.background = ( options[i].value == 1 ) ? '#DEFAE0' : '#FBDDDD';		if ( options[i].value == 1 && options[i].selected )			document.getElementById(prefix + boxid).style.background = '#DEFAE0';		else if ( options[i].value == 0 && options[i].selected )			document.getElementById(prefix + boxid).style.background = '#FBDDDD';	}}$.fn.ToolTip = function(customclass){	this.mouseover(		function(e)		{			if((!this.title && !this.alt) && !this.tooltipset) return;			// get mouse coordinates			// based on code from http://www.quirksmode.org/js/events_properties.html			var mouseX = e.pageX || (e.clientX ? e.clientX + document.body.scrollLeft : 0);			var mouseY = e.pageY || (e.clientY ? e.clientY + document.body.scrollTop : 0);			mouseX += 10;			mouseY += 10;			// if there is no div containing the tooltip			if(!this.tooltipdiv)			{				// create a div and style it				var div = document.createElement("div");				this.tooltipdiv = div;				$(div).addClass(customclass || 'tooltip');				// add the title/alt attribute to it				$(div).html((this.title || this.alt));				this.title = "";				this.alt = "";				$("body").append(div);				this.tooltipset = true;			}			$(this.tooltipdiv).fadeIn("fast").css({left: mouseX + "px", top: mouseY + 3 + "px"});		}	).mouseout(		function()		{			if(this.tooltipdiv)			{				$(this.tooltipdiv).fadeOut("fast");			}		}	);	return this;}$.fn.ToolPic = function(customclass){	this.mouseover(		function(e)		{			if((!this.name) && !this.tooltipset) return;			var mouseX = e.pageX || (e.clientX ? e.clientX + document.body.scrollLeft : 0);			var mouseY = e.pageY || (e.clientY ? e.clientY + document.body.scrollTop : 0);			mouseX += 10;			mouseY += 10;			if(!this.tooltipdiv)			{				var div = document.createElement("div");				this.tooltipdiv = div;				$(div).addClass(customclass || 'tooltip');				$(div).html('<img src="' + this.name + '"/>');				this.title = "";				this.alt = "";				$("body").append(div);				this.tooltipset = true;			}			$(this.tooltipdiv).fadeIn("fast").css({left: mouseX + "px", top: mouseY + 3 + "px"});		}	).mousemove(		function(e)		{			if((!this.name) || !this.tooltipset) return;			var mouseX = e.pageX || (e.clientX ? e.clientX + document.body.scrollLeft : 0);			var mouseY = e.pageY || (e.clientY ? e.clientY + document.body.scrollTop : 0);			mouseX += 10;			mouseY += 10;			$(this.tooltipdiv).css({left: mouseX + "px", top: mouseY + 3 + "px"});		}	).mouseout(		function()		{			if(this.tooltipdiv)			{				$(this.tooltipdiv).fadeOut("fast");			}		}	);	return this;}function selectSmiley(smiley_id, textbox){	var val = $('#'+textbox).val();	val = val + '' + smilies[smiley_id]['shortcut'];	$('#'+textbox).val(val);}//------------------------------------------------// Chat//------------------------------------------------var chatwincurr = 0;var autocheck = 0;var autodelay = 8;var virpath = '';chatwins = new Array();function checkChat(path,check,delay){    virpath = path;    autocheck = check;    autodelay = delay;    checkChatText();}function checkChatText() {	$.post(virpath+'chat.php?p=check', {},		function(member_id) {  			if ( member_id != '0' ) {		        openChatWindow(member_id);			}			else {			    if ( autocheck ) {			        setTimeout('checkChatText()', (autodelay*1000));				}			}		}	);}function openChatWindow(member_id) {    if (member_id > 0 && (typeof(chatwins['chat' + member_id]) != "object"  ||  chatwins['chat' + member_id].closed)) {        chatwins['chat' + member_id] = window.open(virpath + 'index.php?m=account_chat&p=request&id=' + member_id, 'chat' + member_id, 'width=470,height=410,resizable=yes,scrollbars=no,toolbar=no,location=no,status=no,menubar=no');        if ( chatwins['chat' + member_id] && chatwins['chat' + member_id].open)        	chatwins['chat' + member_id].focus();		else			alert('Could not open a chat window. Please disable your popup blocker.');    }}function trim(str) {	return str.replace(/^\s+|\s+$/g,"");}function greedy_meter(score) {$("#score").progressBar(score, { barImage: '/media/progressbg_green.gif'} );}// fetch geofunction fetch_geo(country, state, city, curpath){	if ( ! country ) return;	var ajax_loading = $('#ajax_geo_loading').empty().addClass('ajax_loading');	$.post(( typeof(curpath) != 'undefined' && curpath != '' ? curpath : virpath) + 'index.php?hp=1&m=geo', {'country':country,'state':state},		function(response) {			var itemsbox = '';			if ( response != "" ) {				var items = response.split("\n");				for ( var i = 0, count = items.length; i < count; i++ ) {					itemsbox = itemsbox + '<option value="' + items[i] + '">' + items[i] + '</option>';				}			}			if ( country && state ) {				itemsbox = '<select id="field_city" name="city" class="select"><option value="">Any</option>' + itemsbox + '</select>';				$('#data_city').html(itemsbox);				$('#field_state').val(state);				$('#field_city').val(city);			}			else if ( country ) {				itemsbox = '<select id="field_state" name="state" onchange="fetch_geo($(\'#field_country\').val(),this.value,\'\')" class="select"><option value="">Any</option>' + itemsbox + '</select>';				$('#data_state').html(itemsbox);			}			ajax_loading.removeClass('ajax_loading');		}	);}// fetch offers geofunction fetch_offers_geo(country, state, city, curpath){	if ( ! country ) return;	var ajax_loading = $('#ajax_geo_loading').empty().addClass('ajax_loading');//	$.post(( typeof(curpath) != 'undefined' && curpath != '' ? curpath : virpath) + 'index.php?hp=1&m=offers_geo', {'country':country,'state':state},	$.post('/index.php?hp=1&m=offers_geo', {'country':country,'state':state},		function(response) {			var itemsbox = '';			if ( response != "" ) {				var items = response.split("\n");				for ( var i = 0, count = items.length; i < count; i=i+2 ) {					itemsbox = itemsbox + '<option value="' + items[i] + '">' + items[i+1] + '</option>';				}			}			if ( country && state ) {				itemsbox = '<select id="field_city" name="city_id" class=""><option value="">Anywhere</option>' + itemsbox + '</select>';				$('#data_city').html(itemsbox);				$('#field_state').val(state);				$('#field_city').val(city);			}			else if ( country ) {				itemsbox = '<select id="field_state" name="state_id" onchange="fetch_offers_geo($(\'#field_country\').val(),this.value,\'\')" class=""><option value="">Anywhere</option>' + itemsbox + '</select>';				$('#data_state').html(itemsbox);			}			ajax_loading.removeClass('ajax_loading');		}	);}