
function logMeIn(){
	disable();
	$.post("login.php",{email:document.login.elements["email"].value,password:document.login.elements["password"].value},
  	function(data){
	if(data.length<1)	{window.location="index.php";}else{erMsg('error',data);}
});}
//alert(activeuserid+' '+activeuser+' '+activeimgid);

profileTypes=["band","booking_agent","light_engineer","manager","music_lawyer","music_shop","music_tutor","promoter","photographer","practise_room","publisher","sleeve_artist","sound_engineer","member","venue"];

function checkstock(){	if(cuteyRem<2){window.location.reload();}else{enable();}}
function addslashes(str) {str=str.replace(/\'/g,'\\\'');str=str.replace(/\"/g,'\\"');str=str.replace(/\\/g,'\\\\');str=str.replace(/\0/g,'\\0');return str;}
function stripslashes(str) {str=str.replace(/\\'/g,'\'');str=str.replace(/\\"/g,'"');str=str.replace(/\\\\/g,'\\');str=str.replace(/\\0/g,'\0');return str;}
function ucwords(str){return (str+'').replace(/^(.)|\s(.)/g, function ( $1 ) { return $1.toUpperCase ( ); } );}
function highlight(str,key) {var words=str.split(' ');var out='';for (var b=0; b<words.length; b++){if(words[b].replace (/[\.\,\?!\s]/g, "").toLowerCase() ==key.toLowerCase() ){out+="<b  class='red'>"+words[b]+'</b> ';}else{out+=words[b]+' ';}}return out;}
function page(){if(document.forms['searchForm'] && document.forms['searchForm'].elements['pagenum']){document.forms['searchForm'].elements['pagenum'].value=1;}}
function ret(i,ret){if ((i % ret == 0) && (i>0)) {return'<div class="clear"></div>';}else{return "";}}


function addTableRow(jQtable,e){
    jQtable.each(function(){
        var $table = $(this);
        // Number of td's in the last table row
       // var n = $('tr:last td', this).length;
        var tds = '<tr>';
        for(var i in e){
            tds += '<td>'+e[i]+'</td>';
        }
        tds += '</tr>';
        if($('tbody', this).length > 0){
            $('tbody', this).append(tds);
        }else {
            $(this).append(tds);
        }
    });
}

function date_translate(datetime,type){
     var dt=datetime.split(' ');
	 var d=dt[0].split('-');
	var date=d[2]+'-'+d[1]+'-'+d[0]
	var time=dt[1].substring(0,5);
	if(type=='date'){return date;}
	else if (type=='time'){return time;}
	else{return date+" @ "+time;}
}


function aBox(type,id,name,imgid,addon,showType,button,style,size){
	
	if(type=='band'){var ext='band';}
else if(type=='promoter'){var ext='p';}
else if(type=='member'){var ext='u';}
else if(type=='venue'){var ext='v';}
else{ext='';}

	var l='<div class="membersBox'+size+ext+'" style="'+style+'">';
	if(button!='' && type!='img'){l+=button+'<br />';}
    if(showType!=''){l+=type;}
	if(imgid==''||imgid==null){imgid=0;}
	//alert(imgid);
	l+='<div class="img">';
    l+='<div class="top"></div>';

	     if(type=='flyer'){var id=imgid; var page='href="flyerPrint.php?id='+id+'"'; }
	else if(type=='img'){var page='href="#" onclick="'+button+'"';}
	else{var page='href="'+type+'_profile.php?id='+id+'"';}
		if(id>0 ){ l+='<a '+page+'>'; }
		
       	l+='<img src="ups/'+size+'/'+imgid+'.jpg"  alt="'+escape(name)+'">';
    	if(id>0 ){ l+='</a>'; }
		l+='<div class="bottom"></div></div>'; 
   if(id>0 ){ l+='<a '+page+'>'; }
	l+=name;
	if(id>0 ){ l+='</a>'; }
	if(addon!=''){l+=' - <h4> '+addon+'</h4>';}
l+='</a></div>';

return l;

}

function subGenre(){
	var genSel=document.forms["searchForm"]["genre"];
	var subSel=document.forms["searchForm"]["subgenre"];
	var genre=genSel.value;
	var subgenre=subSel.value;
	subSel.options.length=0;
	if(genSel.value!=''){
		$("#subdiv").css("visibility","visible");
		$.post("subgenres.php",{o:genSel.value},
  		function(data){
			if(data.length>0)	{
				var a=$.evalJSON(data); 
				for (r=0; r<a.length;r++){ 
					if(subgenre==a[r]){
					var b=true
				}else{var b=false} 
				subSel.options[r] = new Option(a[r],a[r],false,b); 
			}		
			enable();
		}else{erMsg('error','there are no sub genres of '+genSel.value+'??'); }			
		});
	}else{
		$("#subdiv").css("visibility","hidden");
		subSel.value=''; 
	}
}
/*
function switchImg(dir,profileImgs){
	if(profileImgs.length>1){
			 if(dir==2){ 	var current=parseInt($("#currentImg").val())+1;}
		else if(dir==1){	var current=parseInt($("#currentImg").val())}
		else if(dir==0){	var current=parseInt($("#currentImg").val())-1;}
		$("#currentImg").val(current);
		if(current==0){$("#switchBtnB").css("visibility","hidden");}else{$("#switchBtnB").css("visibility","visible");}	
		if(current < (profileImgs.length-1)){$("#switchBtnF").css("visibility","visible");}else{$("#switchBtnF").css("visibility","hidden");}
		document.getElementById('profileImg').src="ups/l/"+profileImgs[current]+".jpg";
	}else{
		$("#switchBtnB").css("visibility","hidden");
		$("#switchBtnF").css("visibility","hidden");
	}
}*/

function in_array(needle, haystack, strict) {
    var found = false, key, strict = !!strict;
 	for (key in haystack) {
    	if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
            found = true;
            break;
        }
    } 
    return found;
}

function addEvent(type,date,id){
	disable();
	$.post("myCalendarAdd.php",{id:id,type:type,date:date},
  	function(data){
	if(data.length<1)	{erMsg('info','event added you your calendar');	}else{erMsg('error',data);}
});}


function areaSelect() {
	$("#all").css("display","none");
	$("#personal").css("display","none");
	$("#local").css("display","none");
     	 if (document.searchForm.area['0'].checked) {$("#local").css("display","block");}//else{erMsg('geo')}
	else if (document.searchForm.area['1'].checked) {$("#personal").css("display","block");}//else{erMsg('cla')}
	else if (document.searchForm.area['2'].checked) {$("#local").css("display","block");}//else{erMsg('cla')}
}

function distanceType() {
	document.getElementById('postcodeSearch').style.display='none';
	document.getElementById('townSearch').style.display='none';
	document.getElementById('countySearch').style.display='none';
	     if (document.searchForm.distancetype['0'].checked) {document.getElementById('postcodeSearch').style.display='block';}//else{erMsg('geo')}
	else if (document.searchForm.distancetype['1'].checked) {document.getElementById('townSearch').style.display='block';}//else{erMsg('cla')}
	else if (document.searchForm.distancetype['2'].checked) {document.getElementById('countySearch').style.display='block';}//else{erMsg('cla')}
}

function delTimeOut(){delete cancelTimeout;}
function disable(){	document.getElementById("blanket").style.display='block';}
function getFields(form){
	o= new Object;
	var f=document.forms[form];
	for (var i=0; i<f.elements.length; i++){
		var name=f.elements[i].name;
		var type=f.elements[i].type;
		//alert(type);
		if(type=='radio'){
			if(f.elements[i].checked){	o[name]=f.elements[i].value; }
		}else if(type=='checkbox'){
			if(f.elements[i].checked){
				if(!o[name]){o[name]=new Array();  	}
				o[name][o[name].length]=f.elements[i].value;
			}
		}
		else{			o[name]=f.elements[i].value; }
	}
	return o;
}

function enable(){var ob=document.getElementById('blanket').style;ob.display='none';}
function closeError(){if(typeof(cancelTimeout)=='undefined'){var ob=parent.document.getElementById('errorMessage').style; ob.display='none'; ob.opacity = 1;ob.MozOpacity=1;ob.KhtmlOpacity = 1;ob.filter = "alpha(opacity=100)"; enable();}}
function shiftOpa() {delTimeOut();	setTimeout("enable()", 1000);		setTimeout("opacity()", 2000);	 setTimeout("closeError()",4000);}
function opacity() {if(typeof(cancelTimeout)=='undefined'){var timer = 0;	for(i = 100; i >= 0; i--) {	setTimeout("changeOpac(" + i + ")",(timer * 10));	timer++;}		}}
function changeOpac(opa) {var ob=document.getElementById('errorMessage').style;ob.opacity=(opa/100);ob.MozOpacity=(opa/100);ob.KhtmlOpacity=(opa/100);ob.filter="alpha(opacity="+opa+")";}

//function hideflash() { /* hide all flash in the page */ flash = document.getElementsByTagName('object'); for (var i = 0; i < flash.length; i++) { flash[i].style.visibility = 'hidden'; } }
//function showflash() { /* show all flash */ flash = document.getElementsByTagName('object'); for (var i = 0; i < flash.length; i++) { flash[i].style.visibility = 'visible'; } }

function erMsg(type,e)
{
cancelTimeout=1;
document.getElementById('errorMessage').height=0+'px';
	if(type=='error'){
		if(e!=''){
		disable();
			document.getElementById('errorMessage').style.display='block';
		window["errorMessage"].document.getElementById('title').innerHTML="<a href='#' onclick='parent.delTimeOut(); parent.closeError(); return false' class='cancel'></a>";
		window["errorMessage"].document.getElementById('m').innerHTML=e+"<br /><input type='button'  class='btn'value='ok' onclick='parent.delTimeOut(); parent.closeError(); return false;'>";
		//shiftOpa(0);
		}
	}
	else if (type=='info'){
	//enable();
		document.getElementById('errorMessage').style.display='block';
		window["errorMessage"].document.getElementById('title').innerHTML='';
		window["errorMessage"].document.getElementById('m').innerHTML=""+e+"";
		shiftOpa();
	}
	else if(type=='arrangeGig2' ){
	disable();
//	alert(decodeURIComponent(e));
		var b = decodeURIComponent(e);
		var a = $.evalJSON(b);
		if(a[0].length>0){
			var dateNow=new Date();var month_names = new Array("January", "February", "March","April", "May", "June", "July", "August", "September", "October", "November", "December");var day_names = new Array("Sunday", "Monday", "Tuesday","Wednesday", "Thursday", "Friday", "Saturday");
			var p5="<form NAME='arrangeGigForm' class='form'>";
			p5+="<input type='hidden' name='requesttype' value='gigArrange2'>";
			p5+="<input type='hidden' name='bnameid' value=\""+a[1].bname+"^"+a[1].bid+"\">";	
			//p5+="<input type='hidden' name='sender' value=\""+escape(a[i].rname)+"^"+a[i].rid+"^"+escape(a[i].vname)+"^"+a[i].vid+"\">";	
			//p5+="<input type='hidden' name='reqdelid' value='"+a[i].id+"'>";
			if(a[0].length==1){
				p5+="<input type='hidden' name='sender' value='"+a[0][0]['pname']+"^"+a[0][0]['ipid']+"^"+a[0][0]['vname']+"^"+a[0][0]['ivid']+"'>";
				p5+="<div style='width:60px;'>Location</div><div style='float:left; display:inline;'>"+unescape(a[0][0]['vname'])+" and promoted by "+unescape(a[0][0]['pname'])+"</div><div class='clear'></div>";
				}
			else{
				p5+="<div style='width:60px; float:left; display:inline;'>Location</div><div style='float:left; display:inline;'><select name='sender' >";
				for(var c=0; c<a[0].length; c++){
					p5+="<option value='"+a[0][c]['pname']+"^"+a[0][c]['ipid']+"^"+a[0][c]['vname']+"^"+a[0][c]['ivid']+"'>"+a[0][c]['vname']+"-"+a[0][c]['pname']+"</option>";
				}
				p5+="</select></div><div class='clear'></div>"; 
			}
			p5+="<div style='width:60px; float:left; display:inline;'>Date</div><div style='float:left; display:inline;'><select name='gigdate' style='width:200px;'><option value=''>Select Date and Time</option>";
			for (day=0; day < 100; day++){
				dateNow.setDate(dateNow.getDate() + 1)
				p5+="<option value='"+dateNow.getFullYear()+'-'+(dateNow.getMonth()+1)+'-'+dateNow.getDate()+"'>"+day_names[dateNow.getDay()]+' '+dateNow.getDate()+' '+month_names[dateNow.getMonth()]+' '+dateNow.getFullYear()+"</option>"
			}
			p5+="</select></div><div class='clear'></div><div style='width:60px; float:left; display:inline;'>Time </div><div style='float:left; display:inline;'><select name='hour' style='width:60px;'><option value=''>Hour</option>";
			for (d=1; d <= 24; d++)	{		p5+="<option value='"+d+"'>"+d+"</option>";	}
			p5+="</select>  &nbsp;&nbsp;:&nbsp;&nbsp;<select name='min' style='width:60px;'><option value=''>Min</option>";
			for (d=1; d <= 59; d++)	{		p5+="<option value='"+d+"'>"+d+"</option>";	}		
			p5+="</select></div><input type='button' onclick='parent.arrangeGig(); return false;' class='btn' value='Offer Gig'  ></form> ";
		}else{alert('you can not offer a gig, you arent a promoter');}
		document.getElementById('errorMessage').style.display='block';
		window["errorMessage"].document.getElementById('title').innerHTML=window["errorMessage"].document.getElementById('title').innerHTML="<a href='#' onclick='parent.delTimeOut(); parent.closeError(); return false' class='cancel'></a>";		
		window["errorMessage"].document.getElementById('m').innerHTML='OFFER A GIG TO '+unescape(a[1].bname)+'<br /><br />'+p5;
		//shiftOpa(0);
	}
	else if(type=='arrangeGig1'){
	disable();
	
		var b = decodeURIComponent(e);
		//alert(b);
		var a = b.parseJSON();
		if(a[0].length>0){
			var p5="<form NAME='arrangeGigForm' class='form'>";
			p5+="<input type='hidden' name='requesttype' value='gigArrange1'>";
			p5+="<input type='hidden' name='vnameid' value=\""+a[1].vname+"^"+a[1].vid+"\">";	
			
			if(a[0].length==1){
				p5+="<input type='hidden' name='bnameid' value=\""+a[0][0].bname+"^"+a[0][0].bid+"\">";
				p5+="<div style='width:60px; float:left; display:inline;'>Artist </div><div style='float:left; display:inline;'>"+a[0][0].bname+"</div>";
			}else{
				p5+="<div style='width:60px; float:left; display:inline;'>Artist </div><div style='float:left; display:inline;'><select name='bnameid'>";
				for(var c=0; c<a[0].length; c++){
					p5+="<option value='"+a[0][c].bname+"^"+a[0][c].bid+"'>"+a[0][c].bname+"</option>";
				}
				p5+="</select></div>";
			}
			if(a[2]){
				p5+="<br />Promoter: <select name='pnameid'>";
				for(var c=0; c<a[2].length; c++){
					p5+="<option value='"+a[2][c].pname+"^"+a[2][c].pid+"'>"+a[2][c].pname+"</option>";
				}
				p5+="<option value='unknown^0'>unknown</option>";
				p5+="</select>";
			}else{p5+="<input type='hidden' name='pnameid' value=\"unknown^0\">";}
			
			p5+="<input type='button' onclick='parent.arrangeGig(); return false;' class='btn' value='Request Gig'  ></form> ";
		}else{alert('you can not request a gig, you arent a member of any bands');}
		document.getElementById('errorMessage').style.display='block';
		window["errorMessage"].document.getElementById('title').innerHTML=window["errorMessage"].document.getElementById('title').innerHTML="<a href='#' onclick='parent.delTimeOut(); parent.closeError(); return false' class='cancel'></a>";		
		window["errorMessage"].document.getElementById('m').innerHTML='REQUEST A GIG AT '+a[1].vname+'<br /><br />'+p5;
		//shiftOpa(0);
	}

	else{alert('no type but error is - '+type);}
	document.getElementById('errorMessage').height=document.getElementById('errorMessage').contentWindow.document.body.scrollHeight;
return false;

}

function showPeople(retFtn,types,title)
{
	cancelTimeout=1;
	disable();
	if(types=='*'){var types=profileTypes;}
	document.getElementById('errorMessage').height=0;
	document.getElementById('errorMessage').style.display='block';
	window["errorMessage"].document.getElementById('title').innerHTML="<a href='#' onclick='parent.delTimeOut(); parent.closeError(); return false' class='cancel'></a>"+unescape(title);
	var v="Name <input type=\"text\" id=\"name\">&nbsp;&nbsp;&nbsp;"
	v+="Profile Type<select id=\"type\">";
	v+="<option value=''>select</option>";
	for(i in types){v+="<option value='"+types[i]+"'>"+types[i]+"</option>";}
	v+="</select>&nbsp;&nbsp;&nbsp;";
	v+="<input type=\"button\" value=\"search\" onclick=\"parent.showPeopleGet('"+escape(retFtn)+"');\"></form>";
	v+="<div id=\"showPeopleResults\" style=\" overflow:auto;\"></div>";
	window["errorMessage"].document.getElementById('m').innerHTML=v;
	document.getElementById('errorMessage').height=document.getElementById('errorMessage').contentWindow.document.body.scrollHeight;
	return false;
}

function showPeopleGet(retFtn){
	var name=window["errorMessage"].document.getElementById('name').value;
	var type=window["errorMessage"].document.getElementById('type').value;
	if(name=='' || type==''){
		window["errorMessage"].document.getElementById('showPeopleResults').innerHTML='you need to enter a name and type to invite';		
	}else{	
		$.post("findmembers.php",{name:name,type:type},
  		function(data){
	 		var res=data.split('||');				
			if(eval(res[0])){
				var a=$.evalJSON(res[2]);
				var content='';
				for(var i=0; i<a.length; i++){
					//aBox($type,$id,$name,$imgid,$addon,$showType,$button,$style,$size
					content+=ret(i,4);
					content+=aBox("img",a[i].id,a[i].name,a[i].imgid,"","","parent."+unescape(retFtn.replace('IdSwItCh',a[i].id))+";","","m")
				
					//content+="<div class='membersBoxNoText'><div id=\"img\"><div id=\"top\"></div><a href=\"#\" onclick=\"parent."+unescape(retFtn.replace('IdSwItCh',a[i].id))+"\"><img src=\"ups/s/"+a[i].imgid+".jpg\"></a>";
					//content+="<div id=\"bottom\"></div></div><a href=\"#\" onclick=\"parent."+unescape(retFtn.replace('IdSwItCh',a[i].id))+"\">"+a[i]['name']+"</a></div>";													
				}
			}else{var content=res[1];}
			//window["errorMessage"].document.getElementById('showPeopleResults').style.height=0;
			window["errorMessage"].document.getElementById('showPeopleResults').innerHTML=content;
		});
	}
//window["errorMessage"].document.getElementById('showPeopleResults').style.height=400+'px';
setTimeout("document.getElementById('errorMessage').height=document.getElementById('errorMessage').contentWindow.document.body.scrollHeight",300);
}


function checkFunctions(){
	if(typeof loadResults=='function'){	loadResults();}
	if(typeof loadRecipients=='function'){		loadRecipients();}
	if(sessMess.length>0){erMsg('error',sessMess);}
}





function htmlentities(texto){
    var i,carac,letra,novo='';
    for(i=0;i<texto.length;i++){
        carac = texto[i].charCodeAt(0);
        if( (carac > 47 && carac < 58) || (carac > 62 && carac < 127) ){
          //se for numero ou letra normal
            novo += texto[i];
        }else{
            novo += "&#" + carac + ";";
        }
    }
    return novo;
}

function html_entity_decode(str) {
  var ta = document.createElement("textarea");
  ta.innerHTML=str.replace(/</g,"&lt;").replace(/>/g,"&gt;");
  toReturn = ta.value;
  ta = null;
  return toReturn
} 

function newslistAdd(id){
	disable();
	$.post("newslistadd.php",{id:id},
  	function(data){
	if(data.length<1)	{document.getElementById("innewslist").innerHTML="<a href='#' onclick='newslistRemove("+id+");'>Remove from News</a>";enable();	}else{erMsg('error',data);}
});}

function newslistRemove(id){
	disable();
	$.post("newslistremove.php",{id:id},
  	function(data){
	if(data.length<1)	{document.getElementById("innewslist").innerHTML="<a href='#' onclick='newslistAdd("+id+");'>Add To News List</a>";enable();	}else{erMsg('error',data);}
});}
					
function reportClosure(id){
	disable();
	$.post("reportClosed.php",{id:id},
  	function(data){
	if(data.length<1)	{erMsg('info',"Thanks, we'll look into the status of this company and remove the profile if it appears that they are no longer in business");enable();	}else{erMsg('error',data);}
});}

function changeRating(id){
	disable();
	$.post("ratingchange.php",{id:id,rating:document.getElementById('new_rating').value},
  	function(data){
	if(data.length<1)	{erMsg('info',"Rating ammended"); enable();	}else{erMsg('error',data);}
});}

function contactRemove(id){
	disable();
	$.post("contactremove.php",{id:id},
  	function(data){
	if(data.length<1)	{document.getElementById("incontacts").innerHTML="<a  onCLick='contactAdd("+id+");'>Add to Contacts</a>";enable();	}else{erMsg('error',data);}
});}

function contactAdd(rid){
	disable();
	$.post("request_add.php",{rid:rid,requesttype:"contactAdd"},
  	function(data){
	if(data.length<1)	{document.getElementById("incontacts").innerHTML="<a >Contact Requested</a>";enable();	}else{erMsg('error',data);}
});}

function requestAdd(sid,rid,requesttype){
	disable();
	$.post("request_add.php",{rid:rid,sid:sid,requesttype:requesttype},
  	function(data){
	if(data.length<1)	{erMsg('info','a request has been sent.');enable();	}else{erMsg('error',data);}
});}

/*function loadComments(id,t){
	disable();
	$.post("getComments.php",{id:id,t:t},
  	function(data){
	var res = data.split("||");
	var results=document.getElementById('results');
	results.innerHTML="";
	if(eval(res[0]))	{								
		var a = $.evalJSON(res[1]);
		if(a.length>0)	{
			for (i=0; i < a.length; i++){
				//if(a[i].imgid=='' || a[i].imgid==null || a[i].id==0){a[i].imgid=0;}
				if(a[i].id==null){a[i].imgid=0; a[i].name="A Guest"}
				
				var p1="<div class=\"content\">";
				var p2=aBox("member",a[i].id,a[i].name,a[i].imgid,"","","",'','m');
				var p3="<b >"+a[i].date+"</b><br />"+a[i].comment+"</div><div class='underline'></div>";
				results.innerHTML+=p1+p2+p3;
			}
		}else{results.innerHTML+=res[2];}
	}	else{results.innerHTML+=res[1];}					
	enable();
});}
*/
function closeComment(){$('#commentBox').css("display","none");}
function leaveComment(id,t){
	if(document.getElementById("com")){var com=$("#com").html();}else{var com="";}//.replace(/\r\nŠ\n/g,"<br />").replace(/\s/g,"&nbsp;")
	$("#commentBox").css("display","block");
	$("#commentTitle").html("Write Your Comment");
	var p1="<textarea id=\"theComment\" style=\"width:668px; height:100px; margin-left:5px; backround:#cecece;\">"+com+"</textarea> ";
	var p2="<input type='button' onclick=\"previewComment("+id+","+t+"); return false;\" value='Preview' class='btn'><div class='clear'></div>";
	$("#commentContent").html(p1+p2); 
}
function previewComment(id,t){
	if($("#theComment").val()==''){alert("you need to write a comment"); return false;}
	var p1="Below is a display of how you comment will look once posted, check it and edit if necessary.Otherwise click submit.<br />";
	var p2="<p id='comMsg' style='color:red;'></p><div class='underline'></div>";
	var p3="<div style='margin-left:49px;'class='commentText' id='com' >"+$("#theComment").val()+"</div>";
	var p4="<div class='underline'></div><input type='button' onclick=\"leaveComment("+id+","+t+"); return false;\" value='Edit' class='btn'>";
	var p5="<input type='button' onclick=\"submitComment("+id+","+t+"); return false;\" value='post'  class='btn'><div class='clear' ></div>";
	$("#commentContent").html(p1+p2+p3+p4+p5); 
}

function submitComment(id,t){
if($('#com').html()==''){$('#comMsg').html('you need to write something into the comment box');}
else {
	disable();
	$.post("leave_comment_process.php",{id:id,t:t,comment:$('#com').html()},
	function(data){
	if(data.length<1)	{
		$('#results').html('<div class="content">'+aBox("member",activeuserid,decodeURIComponent(activeuser),activeimgid,"","","",'','m')+'<b>Just Now</b><br />'+$('#com').html()+'</div><div class="underline"></div>'+ $('#results').html())
		$("#commentTitle").html('THANKS, COMMENT POSTED');
		$("#commentContent").html("<div style='width:400px; height:300px; background:#000000; color:#ffffff'>a big advert</div>");
		
		window.location='#comment';
		enable();
	}else{$('#comMsg').html(data); erMsg('error',data);}
});}}






function arrangeGig(){
	disable();
	
	var formIs=window["errorMessage"].document.forms['arrangeGigForm'];
	o = new Object;
	if(formIs.elements['requesttype']){o.requesttype 	= formIs.elements['requesttype'].value;}
	if(formIs.elements['receiver']){var receiver=formIs.elements['receiver'].value.split('^'); o.rname=receiver[0]; o.rid=receiver[1]; }
	if(formIs.elements['sender']){var sender=formIs.elements['sender'].value.split('^'); o.sname=sender[0]; o.sid=sender[1]; o.vname=sender[2]; o.vid=sender[3];  }
	if(formIs.elements['bnameid']){ var bnameid=formIs.elements['bnameid'].value.split('^'); o.bname=bnameid[0]; o.bid=bnameid[1];}
	if(formIs.elements['vnameid']){	var vnameid=formIs.elements['vnameid'].value.split('^'); o.vname=vnameid[0]; o.vid=vnameid[1];}
	if(formIs.elements['reqdelid']){o.reqdelid	= formIs.elements['reqdelid'].value;}
	if(formIs.elements['id']){o.id		= formIs.elements['id'].value;}		
	if(formIs.elements['gigdate']){o.gigdate			= formIs.elements['gigdate'].value;}
	if(formIs.elements['hour']){o.hour				= formIs.elements['hour'].value;}
	if(formIs.elements['min']){o.min			= formIs.elements['min'].value;}


	$.post("gigs_arrange.php",o,
  	function(data){
	if(data.length<1)	{erMsg('info','action successful'); if(typeof loadResults=='function'){		loadResults();}	}else{erMsg('error',data);}
});}



//-->

