$(document).ready(function(){	
			$("#slider").easySlider({
				auto: true,
				continuous: true 
			});
			$("#slider2").easySlider({
				controlsBefore:	'<p id="controls2">',
				controlsAfter:	'</p>',		
				prevId: 'prevBtn2',
				nextId: 'nextBtn2',	
				auto: true,
				continuous: true,
				speed: 			600,
				pause:			6000
			});			
		
		
//Use this for shoutout posting
				  $('.error').hide();
				  $('textarea#comment').css({backgroundColor:"#000000"});
					  $('textarea#comment').focus(function(){
						$(this).css({backgroundColor:"#000000"});
						$(this).css({TextColor:"#000000"});
					  });
					  
					  $('textarea#comment').blur(function(){
						$(this).css({backgroundColor:"#000000"});
					  });
				
				  $("#sendshout").click(function() {
					$('.error').hide();
				  
						var comment = $('textarea#comment').val();
						var dataString = 'comment='+ comment;
		
		              var filePath ='e_ajax_shoutout.php';			

if (window.XMLHttpRequest) {
    var xmlhr = new XMLHttpRequest();
  } else {
    var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
  }

  xmlhr.open('POST', filePath);
  xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 

  xmlhr.onreadystatechange = function() {
    var resultDiv = document.getElementById('shouttalk');
	
    if (xmlhr.readyState == 1) {
      resultDiv.innerHTML = '<b>Sending shoutout <img src="e_img/ajax-loader.gif" border="0"></b>'; 
	    $("#sendshout").hide('slow');
	  
    } else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
			  if (xmlhr.responseText ==225) {
                                    $('#shout_form').fadeOut('slow');					
									$('.done').fadeIn('slow');
									
			   }else if(xmlhr.responseText){
				resultDiv.innerHTML = xmlhr.responseText;
				$("#sendshout").show('slow');
				  
			  }
	  
    } else if (xmlhr.readyState == 4) {
	  resultDiv.innerHTML = 'Sorry server busy. Please try again'; 
    }
  }
  xmlhr.send(dataString);
  
					return false;
});
					
	
	 //validate telephone before sending to nooksy
  $("#country").change(function() {
 
						var country = $('select#country').val();
						var dataString = 'country='+ country;
		         var filePath ='e_ajax_country.php';			

if (window.XMLHttpRequest) {
    var xmlhr = new XMLHttpRequest();
  } else {
    var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
  }

  xmlhr.open('POST', filePath);
  xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 

  xmlhr.onreadystatechange = function() {
    var resultDiv = document.getElementById('zipcode');
	
    if (xmlhr.readyState == 1) {
      resultDiv.innerHTML = 'Loading'; 
	  
    } else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
		 $('input#zipcode').val(xmlhr.responseText);
		
    } else if (xmlhr.readyState == 4) {
	  resultDiv.innerHTML = '+'; 
    }
  }
  xmlhr.send(dataString);
  
					return false;
});
  
	
	//validate telephone before sending to nooksy
  $("#tel").click(function() {
				  
						var userid = $('input#tel').val();
						var dataString = 'userid='+ userid;
		
		              var filePath ='e_ajax_fake.php';			

if (window.XMLHttpRequest) {
    var xmlhr = new XMLHttpRequest();
  } else {
    var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
  }

  xmlhr.open('POST', filePath);
  xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 

  xmlhr.onreadystatechange = function() {
    var resultDiv = document.getElementById('nooksytalk');
	
    if (xmlhr.readyState == 1) {
      resultDiv.innerHTML = '<b>Sending SMS <img src="e_img/ajax-loader.gif" border="0"></b>'; 
	  
    } else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
				resultDiv.innerHTML = '<div class="caption" style="-moz-border-radius: 5px 5px 5px 5px; margin-bottom: 10px; margin-top: 0px; padding: 12px; color:light-wight; font-family: arial,sans-serif; background-color: #000000;"><font color="#ff0000">Please add your phone number to enable you send short messages</font> <a href="e_mainprofile_real.php"><u>click here</u></a></div>';
				  
			 
    } else if (xmlhr.readyState == 4) {
	  resultDiv.innerHTML = '<font color=\"#ff0000\">Sorry server busy. Please try again</font>'; 
    }
  }
  xmlhr.send(dataString);
  
					return false;
});
	
	
	
 //check if already register with nooksy and then connect
  $("#nconnect").click(function() {
				  
						var nemail = $('input#nemail').val();
						var ncom   = $('textarea#ncom').val();
						var dataString = 'nemail='+ nemail +'&ncom='+ ncom;
		
		              var filePath ='e_ajax_nooksy_validate.php';			

if (window.XMLHttpRequest) {
    var xmlhr = new XMLHttpRequest();
  } else {
    var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
  }

  xmlhr.open('POST', filePath);
  xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 

  xmlhr.onreadystatechange = function() {
    var resultDiv = document.getElementById('nooksytalk');
    var confirmDiv = document.getElementById('nooksyconnect');
    var reloadDiv = document.getElementById('reloadnooksy');
	
    if (xmlhr.readyState == 1) {
      resultDiv.innerHTML = '<b>Sending SMS <img src="e_img/ajax-loader.gif" border="0"></b>'; 
	  
    } else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
		alert(xmlhr.responseText);
			  if (xmlhr.responseText ==111) {
                                    $('#nooksytable').hide();					
									$('#nooksyconnect').show();
									
									
			   }else if (xmlhr.responseText ==202) {
            resultDiv.innerHTML = '<font color=\"#ff0000\"><b>Message is empty</b></font>'; 
				  
			   }else if (xmlhr.responseText ==203) {
            resultDiv.innerHTML = '<font color=\"#ff0000\"> <b>Server Error User ID is empty, please try again</b></font>'; 
				  
			   }else{
			   }
				  
			 
    } else if (xmlhr.readyState == 4) {
	  resultDiv.innerHTML = '<font color=\"#ff0000\">Sorry server busy. Please try again</font>'; 
    }
  }
  xmlhr.send(dataString);
  
					return false;
});
  
  
  
   //check if already register with nooksy and then connect
  $("#nooksyallow").click(function() {
				  
						var f = $('input#f').val();
						var u = $('input#u').val();
						var p = $('input#p').val();
						var b = $('input#b').val();
						var l = $('input#l').val();
						var ntel = $('input#ntel').val();
						var img = $('input#img').val();
						var ncom = $('textarea#ncom').val();
						var dataString = 'f='+ f +'&u='+ u +'&p='+ p +'&b='+ b +'&l='+ l +'&ntel='+ ntel +'&img='+ img +'&ncom='+ ncom;

var filePath ='e_ajax_nooksy_allow.php';			

if (window.XMLHttpRequest) {
    var xmlhr = new XMLHttpRequest();
  } else {
    var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
  }

  xmlhr.open('POST', filePath);
  xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 

  xmlhr.onreadystatechange = function() {
    var resultDiv = document.getElementById('nooksytalk');
    var confirmDiv = document.getElementById('nooksyconnect');
    var reloadDiv = document.getElementById('reloadnooksy');
	
    if (xmlhr.readyState == 1) {
      resultDiv.innerHTML = '<b>Sending SMS <img src="e_img/ajax-loader.gif" border="0"></b>'; 
	  
    } else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
		alert(dataString);
             if (xmlhr.responseText ==200) {
				  $('#nooksytable').hide();	
				  $('#nooksyconnect').hide();
				  $('#nooksytalk').hide();
            reloadDiv.innerHTML = '<div class="caption" style="-moz-border-radius: 5px 5px 5px 5px; margin-bottom: 10px; margin-top: 0px; padding: 12px; color:light-wight; font-family: arial,sans-serif; background-color: #000000;"><b>SMS sent and posted successfully</b><br> <a href="e_mainboard.php">Click here to post another</a></div>'; 
                           				
							
  
			   }else if (xmlhr.responseText ==202) {
            resultDiv.innerHTML = '<b>Message is empty</b>'; 
				  
			   }else if (xmlhr.responseText ==203) {
            resultDiv.innerHTML = '<b>Error occur, please reload this page and try again'; 
				  
			   }else{
	   	resultDiv.innerHTML = '<font color=\"#ff0000\"><b>Sorry error occurred. Please try again</b></font>';
				
			   }
				  
			 
    } else if (xmlhr.readyState == 4) {
	  resultDiv.innerHTML = '<font color=\"#ff0000\">Sorry server busy. Please try again</font>'; 
    }
  }
  xmlhr.send(dataString);
  
					return false;
});
  
  
  
		//Now we send the txt to nooksy
  $("#nsay").click(function() {
				  
						var nooksyid = $('input#nooksy_id').val();
						var ncom = $('textarea#ncom').val();
						var dataString = 'nooksyid='+ nooksyid +'&ncom='+ ncom;
		
		              var filePath ='e_ajax_nooksy.php';			

if (window.XMLHttpRequest) {
    var xmlhr = new XMLHttpRequest();
  } else {
    var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
  }

  xmlhr.open('POST', filePath);
  xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 

  xmlhr.onreadystatechange = function() {
    var resultDiv = document.getElementById('nooksytalk');
    var confirmDiv = document.getElementById('nooksyconnect');
    var reloadDiv = document.getElementById('reloadnooksy');
	
    if (xmlhr.readyState == 1) {
      resultDiv.innerHTML = '<b>Sending SMS <img src="e_img/ajax-loader.gif" border="0"></b>'; 
	  
    } else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
			 		alert(xmlhr.responseText);
              if (xmlhr.responseText ==200) {
            reloadDiv.innerHTML = '<div class="caption" style="-moz-border-radius: 5px 5px 5px 5px; margin-bottom: 10px; margin-top: 0px; padding: 12px; color:light-wight; font-family: arial,sans-serif; background-color: #000000;"><b>SMS sent and posted successfully</b> <a href="e_mainboard">Click here to post another</a></div>'; 
                             $('#nooksytable').fadeOut('fast');					
				  
			   }else if (xmlhr.responseText ==202) {
            reloadDiv.innerHTML = '<b>Message is empty</b>'; 
				  
			   }else if (xmlhr.responseText ==203) {
            resultDiv.innerHTML = '<b>Error occur, please reload this page and try again'; 
				  
			   }else{
	   				resultDiv.innerHTML = '<font color=\"#ff0000\"><b>Sorry error occurred. Please try again</b></font>';
				
			   }
				  
			 
    } else if (xmlhr.readyState == 4) {
	  resultDiv.innerHTML = '<font color=\"#ff0000\">Sorry server busy. Please try again</font>'; 
    }
  }
  xmlhr.send(dataString);
  
					return false;
});
	
// Use this function for comment posting
				  $("#sendcom").click(function() {
				  
				     var sendcom      = $('input#sendcom').val();
					 var com          = $('textarea#com').val();
					 var playid       = $('input#playid').val();
					 var types        = $('input#types').val();  
					 var pl           = $('input#pl').val();  
					 var dataString = 'com='+ com +'&types='+ types +'&playid='+ playid +'&pl='+ pl;
					
var filePath ='e_ajax_comment.php';			

if (window.XMLHttpRequest) {
    var xmlhr = new XMLHttpRequest();
  } else {
    var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
  }

  xmlhr.open('POST', filePath);
  xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 

  xmlhr.onreadystatechange = function() {
    var resultDiv = document.getElementById('talknow');
	
    if (xmlhr.readyState == 1) {
      resultDiv.innerHTML = '<b>Sending comment <img src="e_img/ajax-loader.gif" border="0"></b>'; 
	  $("#sendcom").hide('slow');
	  
    } else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
			  if (xmlhr.responseText ==205) {
               resultDiv.innerHTML = '<h3>Comment Posted successfully</h3>'; 
					  //$('#com_form').fadeOut('fast');	
					  $('textarea#com').val('');
					  $("#sendcom").show('slow');

			   }else if(xmlhr.responseText){
				resultDiv.innerHTML = xmlhr.responseText;
				$("#sendcom").show('slow');
				  
			  }
	  
    } else if (xmlhr.readyState == 4) {
      alert('Sorry server busy. Please try again');
    }
  }
  xmlhr.send(dataString);
 
					return false;
});
					
					
// Use this function for follow up comment posting
				  $("#dofollow").click(function() {
				  
					 var dofollow     = $('input#dofollow').val();
					 var playid       = $('input#playid').val();
					 var types        = $('input#types').val();  
					 var dataString = 'dofollow='+ dofollow +'&types='+ types +'&playid='+ playid;

             var filePath ='e_ajax_follow_comment.php';			

			if (window.XMLHttpRequest) {
				var xmlhr = new XMLHttpRequest();
			  } else {
				var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			  }
			
			  xmlhr.open('POST', filePath);
			  xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
			
			  xmlhr.onreadystatechange = function() {
				var resultDiv = document.getElementById('followcomment');
				
				if (xmlhr.readyState == 1) {
				  resultDiv.innerHTML = '<b>Loading <img src="e_img/ajax-loader.gif" border="0"></b>'; 
				  
				} else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
						  if (xmlhr.responseText ==230) {
						   resultDiv.innerHTML = '<a href="?a=join&redr=index.php?a=nm">Please Loggin to follow this comment</a><br>'; 
						   $('#dofollow').attr('disabled','true');
			
						   }else if (xmlhr.responseText ==225) {
						   resultDiv.innerHTML = 'You\'re now following this comment.<br>'; 
						   $('#follow_div').hide();
			
						   }else if (xmlhr.responseText ==226) {
						   resultDiv.innerHTML = 'You\'re not following this comment.<br>'; 
						   $('#follow_div').hide();
			
						   }else if(xmlhr.responseText){
							resultDiv.innerHTML = xmlhr.responseText;
							  
						  }
				  
				} else if (xmlhr.readyState == 4) {
				  alert('Sorry server busy. Please try again');
				}
			  }
			  xmlhr.send(dataString);
  
   return false;
});
				  
				  
		 // Use this function for mail replying
				  $("#butt").click(function() {

					 var replytxt     = $('textarea.replytxt').val();
					 var readid       = $('input#readid').val();
					 var subject      = $('input#subject').val();
					 var dataString = 'replytxt='+ replytxt +'&readid='+ readid  +'&subject='+ subject;
                     
					 var filePath ='e_ajax_reply.php';			

			if (window.XMLHttpRequest) {
				var xmlhr = new XMLHttpRequest();
			  } else {
				var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			  }
			
			  xmlhr.open('POST', filePath);
			  xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
			
			  xmlhr.onreadystatechange = function() {
				var resultDiv = document.getElementById('talknow');
				
				if (xmlhr.readyState == 1) {
			resultDiv.innerHTML = '<b>Replying Message <img src="e_img/ajax-loader.gif" border="0"></b>'; 
				 $("#butt").hide('slow');
				  //$('#sends').attr('disabled','true');
				  
				} else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
						  if (xmlhr.responseText =="<h2>Message replied successfully.</h2>") {
						   $("#kill").fadeOut('slow');
						   resultDiv.innerHTML = xmlhr.responseText;
			
						   }else if(xmlhr.responseText){
							resultDiv.innerHTML = xmlhr.responseText;
							$("#butt").show('slow');
							  
						  }
				  
				} else if (xmlhr.readyState == 4) {
				  alert('Sorry server busy. Please try again');
				}
			  }
			  xmlhr.send(dataString);
			  
                       
					return false;
		});
				  
				  
	// Use this function for compose messge to user
				  $("#sends").click(function() {
                     var sends       = $('input#sends').val();
					 var comptxt     = $('textarea.comptxt').val();
					 var to          = $('input#inputString').val();
					 var subject     = $('input#subject').val();
					 var dataString = 'comptxt='+ comptxt +'&to='+ to +'&subject='+ subject;

             var filePath ='e_ajax_compose.php';			

			if (window.XMLHttpRequest) {
				var xmlhr = new XMLHttpRequest();
			  } else {
				var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			  }
			
			  xmlhr.open('POST', filePath);
			  xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
			
			  xmlhr.onreadystatechange = function() {
				var resultDiv = document.getElementById('talknow');
				
				if (xmlhr.readyState == 1) {
				  resultDiv.innerHTML = '<b>Sending <img src="e_img/ajax-loader.gif" border="0"></b>'; 
				  $("#sends").hide('slow');
				  
				} else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
						  if (xmlhr.responseText =="<h2>Message sent successfully.</h2>") {
						   $("#kills").fadeOut('slow');
						   resultDiv.innerHTML = xmlhr.responseText;
			
						   }else if(xmlhr.responseText){
							resultDiv.innerHTML = xmlhr.responseText;
							$("#sends").show('slow');
							  
						  }
				  
				} else if (xmlhr.readyState == 4) {
				  alert('Sorry server busy. Please try again');
				}
			  }
			  xmlhr.send(dataString);
					return false;
	});
				  
				  
	 // Use this function for search alerter on header page
				  $("#txt").keyup(function() {

					 var sel     = $('select#sel').val();
					 var txt       = $('input#txt').val();
					 var dataString = 'sel='+ sel +'&txt='+ txt ;

                     $.ajax({
						  type: "POST",
						  url: "search_alert.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {
							$('#suggest').show();
					        //$('#autoSuggestion').html(data);
						document.getElementById('autoSuggestion').innerHTML = ""+ html +"";

					  }
					 });
					return false;
					});
				  
			
				  
				     // Use this function for equip sell page page
				  $("#equipsell").keyup(function() {

					 var equipsell       = $('input#equipsell').val();
					 var dataString = 'equipsell='+ equipsell ;

                     $.ajax({
						  type: "POST",
						  url: "equipsell_ajax.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {
							$('#suggestequipsell').show();
					        //$('#autoSuggestion').html(data);
						document.getElementById('autoSuggestionequipsell').innerHTML = ""+ html +"";

					  }
					 });
					return false;
					});
				  
				  
				  
				  
				     // Use this function for yellow page
				  $("#yellowpage").keyup(function() {

					 var yellowpage       = $('input#yellowpage').val();
					 var dtype     = $('select#dtype').val();
					 var dataString = 'yellowpage='+ yellowpage +'&dtype='+ dtype ;

                     $.ajax({
						  type: "POST",
						  url: "yellowpage_ajax.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {
							$('#suggestyellowpage').show();
					        //$('#autoSuggestion').html(data);
						document.getElementById('autoSuggestionyellowpage').innerHTML = ""+ html +"";

					  }
					 });
					return false;
					});
				  
				  
				   // Use this function for search alerter on header page
				  $("#txtfree").keyup(function() {

					 var txtfree       = $('input#txtfree').val();
					 var dataString = 'txtfree='+ txtfree ;

                     $.ajax({
						  type: "POST",
						  url: "e_freedownload_ajax.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {
							$('#suggesttxt').show();
					        //$('#autoSuggestion').html(data);
						document.getElementById('autoSuggestiontxt').innerHTML = ""+ html +"";

					  }
					 });
					return false;
					});
				  
	 // Use this function for general discussion in account
				  $("#general").click(function() {

					 var comptxt     = $('textarea.general_text').val();
					 var permit     = $('select#permit').val();
					 var dataString = 'comptxt='+ comptxt +'&permit='+ permit;

                     $.ajax({
						  type: "POST",
						  url: "e_ajax_generalcomment.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {
						  
						  if(html ==205){
							   $('.general_text').fadeOut('slow');
							   $("#postcom").fadeIn('slow');
							   $("#offcome").fadeOut('slow');

						  }else{
							document.getElementById('generaltalk').innerHTML = ""+ html +"";
                            //$('#appendcomment').append(""+ html +"");
                          }
					  }
					 });
					return false;
					});
				  
				  
// Use this function to rate artist on media player
$("#rateme").click(function() {

					 var artid     = $('input#artid').val();
					 var status     = $('input#status').val();
					 var dataString = 'artid='+ artid +'&status='+ status;
			var filePath ='e_ajax_rateme.php';			
			
			if (window.XMLHttpRequest) {
			var xmlhr = new XMLHttpRequest();
			} else {
			var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			}
			
			xmlhr.open('POST', filePath);
			xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
			
			xmlhr.onreadystatechange = function() {
			var resultDiv = document.getElementById('rateresult');
			var ratemeDiv = document.getElementById('rateme');
			
			if (xmlhr.readyState == 1) {
			  resultDiv.innerHTML = '<b>Loading <img src="e_img/ajax-loader.gif" border="0"></b>'; 
			  $("#rateme").hide('fast');
			  
			} else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
					if(xmlhr.responseText){
						resultDiv.innerHTML = xmlhr.responseText;
						  
					  }
			  
			} else if (xmlhr.readyState == 4) {
			  alert('Sorry server busy. Please try again');
			  $("#rateme").fadeIn('slow');
			  $("#rateresult").hide('slow');
			}
			}
			xmlhr.send(dataString);
                    
					return false;
});
				  
				  
				  
// Use this function to subscribe artist on media player
$("#subme").click(function() {

					 var artid     = $('input#artid').val();
					 var status     = $('input#status').val();
					 var dataString = 'artid='+ artid +'&status='+ status;
           
		   var filePath ='e_ajax_subscribeme.php';			
			
			if (window.XMLHttpRequest) {
			var xmlhr = new XMLHttpRequest();
			} else {
			var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			}
			
			xmlhr.open('POST', filePath);
			xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
			
			xmlhr.onreadystatechange = function() {
			var resultDiv = document.getElementById('subresult');
			var submeDiv = document.getElementById('subtalk');
			
			if (xmlhr.readyState == 1) {
			  resultDiv.innerHTML = '<b>Loading <img src="e_img/ajax-loader.gif" border="0"></b>'; 
			  $("#subtalk").hide('fast');
			  
			} else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
					if(xmlhr.responseText){
						$("#subtalk").hide();
						resultDiv.innerHTML = xmlhr.responseText;
						  
					  }
			  
			} else if (xmlhr.readyState == 4) {
			  alert('Sorry server busy. Please try again');
			  $("#subtalk").fadeIn('slow');
			  $("#subresult").hide('slow');
			}
			}
			xmlhr.send(dataString);
					return false;
});
				  
				  

// Use this function to unsubscribe artist on media player
$("#unsubme").click(function() {

					 var artid     = $('input#artid').val();
					 var status     = $('input#status').val();
					 var dataString = 'artid='+ artid +'&status='+ status;

 var filePath ='e_ajax_unsubscribeme.php';			
			
			if (window.XMLHttpRequest) {
			var xmlhr = new XMLHttpRequest();
			} else {
			var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			}
			
			xmlhr.open('POST', filePath);
			xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
			
			xmlhr.onreadystatechange = function() {
			var resultDiv = document.getElementById('subresult');
			var unsubmeDiv = document.getElementById('unsubtalk');
			
			if (xmlhr.readyState == 1) {
			  resultDiv.innerHTML = '<b>Loading <img src="e_img/ajax-loader.gif" border="0"></b>'; 
			  $("#unsubtalk").hide('fast');
			  
			} else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
					if(xmlhr.responseText){
						$("#unsubtalk").hide();
						resultDiv.innerHTML = xmlhr.responseText;
						  
					  }
			  
			} else if (xmlhr.readyState == 4) {
			  alert('Sorry server busy. Please try again');
			  $("#unsubtalk").fadeIn('slow');
			  $("#subresult").hide('slow');
			}
			}
			xmlhr.send(dataString);
                    
					return false;
});
				  
		
		
// Use this function to unsubscribe artist on media player
$("#addfriend").click(function() {

					 var artid     = $('input#artid').val();
					 var status     = $('input#status').val();
					 var dataString = 'artid='+ artid +'&status='+ status;
            
			var filePath ='e_ajax_addfriend.php';			
			
			if (window.XMLHttpRequest) {
			var xmlhr = new XMLHttpRequest();
			} else {
			var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			}
			
			xmlhr.open('POST', filePath);
			xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
			
			xmlhr.onreadystatechange = function() {
			var resultDiv = document.getElementById('addresult');
			var unsubmeDiv = document.getElementById('addclose');
			
			if (xmlhr.readyState == 1) {
			  resultDiv.innerHTML = '<b>Loading <img src="e_img/ajax-loader.gif" border="0"></b>'; 
			  $("#addclose").hide('fast');
			  
			} else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
					if(xmlhr.responseText){
						$("#addclose").hide();
						resultDiv.innerHTML = xmlhr.responseText;
						  
					  }
			  
			} else if (xmlhr.readyState == 4) {
			  alert('Sorry server busy. Please try again');
			  $("#addclose").fadeIn('slow');
			  $("#addresult").hide('slow');
			}
			}
			xmlhr.send(dataString);
					return false;
});
				  
// Use this function to display rent Nm Card confirmation
$("#rent").click(function() {

					 var artid     = $('input#artid').val();
					 var dataString = 'artid='+ artid;

                     $.ajax({
						  type: "POST",
						  url: "e_ajax_fake.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {
  						       $("#rentab").hide();
							   $("#buytab").fadeIn('slow');
							   $("#subbuy").fadeOut('slow');
							   $("#subrent").fadeIn('slow');
							   $("#rentshow").fadeIn('slow');
						 
					  }
					 });
					return false;
					});
			  
			      // Use this function to buy movie 
	          $("#buy").click(function() {

					 var nmcard     = $('input#nmcard').val();
					 var movid      = $('input#movid').val();
					 var dataString = 'nmcard='+ nmcard +'&movid='+ movid;

                     $.ajax({
						  type: "POST",
						  url: "e_ajax_fake.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {
  						       $("#buytab").hide();
  						       $("#rentab").fadeIn('slow');
							   $("#subrent").fadeOut('slow');
							   $("#rentshow").fadeIn('slow');
							   $("#subbuy").fadeIn('slow');
					      
						  if(html =="<b>Successful rented...</b><br> Refresh to watch now"){
							  $("#rented").fadeOut('slow');
						  }
					      document.getElementById('renttalk').innerHTML = ""+ html +"";
						  
						  
				  
						 
					  }
					 });
					return false;
					});
			  
			  
			  // Use this function to finally rent movie
	          $("#subrent").click(function() {

					 var nmcard     = $('input#nmcard').val();
					 var pl         = $('input#pl').val();
					 var movid      = $('input#movid').val();
					 var dataString = 'nmcard='+ nmcard +'&pl='+ pl +'&movid='+ movid;

                     $.ajax({
						  type: "POST",
						  url: "e_ajax_rentbuymovie.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {
  						       //$("#rentab").hide();
							   $("#rentshow").fadeIn('slow');
					      
						  if(html =="<b>Successful rented...</b><br> Refresh to watch now"){
							  $("#rented").fadeOut('slow');
						  }
					      document.getElementById('renttalk').innerHTML = ""+ html +"";
						  
						  
				  
						 
					  }
					 });
					return false;
					});
			  
			  
			    // Use this function to finally rent movie
	          $("#subbuy").click(function() {

					 var nmcard     = $('input#nmcard').val();
					 var type         = $('input#type').val();
					 var movid      = $('input#movid').val();
					 var dataString = 'nmcard='+ nmcard +'&type='+ type +'&movid='+ movid;

                     $.ajax({
						  type: "POST",
						  url: "e_ajax_rentbuymovie.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {
  						       //$("#rentab").hide();
							   $("#rentshow").fadeIn('slow');
					      
						  if(html =="<b>Successful rented...</b><br> Refresh to watch now"){
							  $("#rented").fadeOut('slow');
						  }
					      document.getElementById('renttalk').innerHTML = ""+ html +"";
						  
						  
				  
						 
					  }
					 });
					return false;
					});
			 
			 
			    // Use this function to resend activation code to user
	          $("#resendactivation").click(function() {

					 var movid      = $('input#movid').val();
					 var dataString = 'nmcard='+ movid ;

                     $.ajax({
						  type: "POST",
						  url: "e_resendactivation.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {
					      
						  if(html ==201){
							  $("#resendactivation").hide('slow');
							  $("#issend").fadeIn('slow');
						  }
					  }
					 });
					return false;
					});
			  
			      // Use this function to display activation code to user
	          $("#anow").click(function() {

					 var acttxt      = $('input#acttxt').val();
					 var dataString = 'axt='+ acttxt ;

                     $.ajax({
						  type: "POST",
						  url: "e_ajax_fake.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {
							  $("#anow").hide('slow');
							  $("#displayactive").fadeIn('slow');
						 
					  }
					 });
					return false;
					});
			  
			  
			    // Use this function to activation code to user
	          $("#sentactive").click(function() {

					 var acttxt      = $('input#acttxt').val();
					 var dataString = 'acttxt='+ acttxt ;

                     $.ajax({
						  type: "POST",
						  url: "e_resendactivation.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {

                          if(html ==211){
							  $("#activeid").hide('slow');
							  
						  }else if(html ==210){
							$("#wrongactive").fadeIn('slow');  
							setTimeout("$('#wrongactive').hide();", 500);
							
						  }else if(html ==212){
							$("#emptyactive").fadeIn('slow');  
							setTimeout("$('#emptyactive').hide();", 500);
							
						  }else if(html ==213){
							$("#loginact").fadeIn('slow');  
							setTimeout("$('#loginact').hide();", 500);
							
						  }
					  }
					 });
					return false;
					});
			 
			 
			    // Use this function to check if nickname already exit on register page
	          $("#email").keyup(function() {

					 var email      = $('input#email').val();
					 var dataString = 'email='+ email ;

                     $.ajax({
						  type: "POST",
						  url: "e_ajax_registerexist.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {
					      document.getElementById('emailcheck').innerHTML = ""+ html +"";
					  }
					 });
					return false;
					});
			  
			  
			    // Use this function to check if nickname already exit on register page
	          $("#nickname").keyup(function() {

					 var nickname      = $('input#nickname').val();
					 var dataString = 'nickname='+ nickname ;

                     $.ajax({
						  type: "POST",
						  url: "e_ajax_registerexist.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {
					      document.getElementById('nicknamecheck').innerHTML = ""+ html +"";
					  }
					 });
					return false;
					});
			 
// Use this function to exlain category detailon register page
$("#cate").change(function() {

					 var cate      = $('select#cate').val();
					 var dataString = 'cate='+ cate ;
var filePath ='e_ajax_registerexist.php';			
			
			if (window.XMLHttpRequest) {
			var xmlhr = new XMLHttpRequest();
			} else {
			var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			}
			
			xmlhr.open('POST', filePath);
			xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
			
			xmlhr.onreadystatechange = function() {
			var resultDiv = document.getElementById('catedetail');
			
			if (xmlhr.readyState == 1) {
			  resultDiv.innerHTML = '<b>Loading <img src="e_img/ajax-loader.gif" border="0"></b>'; 
			  
			} else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
					if(xmlhr.responseText){
						resultDiv.innerHTML = xmlhr.responseText;
						  
					  }
			  
			} else if (xmlhr.readyState == 4) {
			  alert('Sorry server busy. Please try again');
			  $("#catedetail").hide('slow');
			}
			}
			xmlhr.send(dataString);
                   
					return false;
});


// Use this function to display the user profile
$("#director").change(function() {

					 var director      = $('select#director').val();
					 var dataString = 'director='+ director ;
var filePath ='e_ajax_director.php';			
			
			if (window.XMLHttpRequest) {
			var xmlhr = new XMLHttpRequest();
			} else {
			var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			}
			
			xmlhr.open('POST', filePath);
			xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
			
			xmlhr.onreadystatechange = function() {
			var resultDiv = document.getElementById('director_result');
			
			if (xmlhr.readyState == 1) {
			  resultDiv.innerHTML = '<b>Loading Profile <img src="e_img/ajax-loader.gif" border="0"></b>'; 
			  
			} else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
					if(xmlhr.responseText){
						resultDiv.innerHTML = xmlhr.responseText;
						  
					  }
			  
			} else if (xmlhr.readyState == 4) {
			   resultDiv.innerHTML = '<b>Sorry server busy. Please try again</b>'; 
			}
			}
			xmlhr.send(dataString);
                   
					return false;
});

// Use this function to display the user profile
$("#dj").change(function() {

					 var dj      = $('select#dj').val();
					 var dataString = 'dj='+ dj ;
var filePath ='e_ajax_dj.php';			
			
			if (window.XMLHttpRequest) {
			var xmlhr = new XMLHttpRequest();
			} else {
			var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			}
			
			xmlhr.open('POST', filePath);
			xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
			
			xmlhr.onreadystatechange = function() {
			var resultDiv = document.getElementById('dj_result');
			
			if (xmlhr.readyState == 1) {
			  resultDiv.innerHTML = '<b>Loading Profile <img src="e_img/ajax-loader.gif" border="0"></b>'; 
			  
			} else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
					if(xmlhr.responseText){
						resultDiv.innerHTML = xmlhr.responseText;
						  
					  }
			  
			} else if (xmlhr.readyState == 4) {
			   resultDiv.innerHTML = '<b>Sorry server busy. Please try again</b>'; 
			}
			}
			xmlhr.send(dataString);
                   
					return false;
});


// Use this function to display the user profile
$("#label").change(function() {

					 var label      = $('select#label').val();
					 var dataString = 'label='+ label ;
var filePath ='e_ajax_label.php';			
			
			if (window.XMLHttpRequest) {
			var xmlhr = new XMLHttpRequest();
			} else {
			var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			}
			
			xmlhr.open('POST', filePath);
			xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
			
			xmlhr.onreadystatechange = function() {
			var resultDiv = document.getElementById('label_result');
			
			if (xmlhr.readyState == 1) {
			  resultDiv.innerHTML = '<b>Loading Profile<img src="e_img/ajax-loader.gif" border="0"></b>'; 
			  
			} else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
					if(xmlhr.responseText){
						resultDiv.innerHTML = xmlhr.responseText;
						  
					  }
			  
			} else if (xmlhr.readyState == 4) {
			   resultDiv.innerHTML = '<b>Sorry server busy. Please try again</b>'; 
			}
			}
			xmlhr.send(dataString);
                   
					return false;
});


// Use this function to display the user profile
$("#marketer").change(function() {

					 var marketer      = $('select#marketer').val();
					 var dataString = 'marketer='+ marketer ;
var filePath ='e_ajax_marketer.php';			
			
			if (window.XMLHttpRequest) {
			var xmlhr = new XMLHttpRequest();
			} else {
			var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			}
			
			xmlhr.open('POST', filePath);
			xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
			
			xmlhr.onreadystatechange = function() {
			var resultDiv = document.getElementById('marketer_result');
			
			if (xmlhr.readyState == 1) {
			  resultDiv.innerHTML = '<b>Loading Profile <img src="e_img/ajax-loader.gif" border="0"></b>'; 
			  
			} else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
					if(xmlhr.responseText){
						resultDiv.innerHTML = xmlhr.responseText;
						  
					  }
			  
			} else if (xmlhr.readyState == 4) {
			   resultDiv.innerHTML = '<b>Sorry server busy. Please try again</b>'; 
			}
			}
			xmlhr.send(dataString);
                   
					return false;
});


			 
			  // Use this function to activation code to user
	          $("#signup").click(function() {

					 var cate      = $('select#cate').val();
					 var name      = $('input#name').val();
					 var lastname      = $('input#lastname').val();
					 var gender      = $('select#gender').val();
					 var yrs         = $('select#yrs').val();
					 var mnth        = $('select#mnth').val();
					 var dy          = $('select#dy').val();
					 var email       = $('input#email').val();
					 var email_con   = $('input#email_con').val();
					 var nickname    = $('input#nickname').val();
					 var marintal    = $('select#marintal').val();
					 var city        = $('input#city').val();
					 var state       = $('select#state').val();
					 var other       = $('input#other').val();
					 var country     = $('select#country').val();
					 var pwd         = $('input#pwd').val();
					 var cpwd        = $('input#cpwd').val();
					 var aboutus     = $('select#aboutus').val();
					 var invite      = $('textarea#invite').val();
					 var chxbox      = $('input#chxbox').val();
					 var dataString = 'cate='+ cate +'&name='+ name +'&lastname='+ lastname +'&gender='+ gender +'&yrs='+ yrs +'&mnth='+ mnth +'&dy='+ dy +'&email='+ email +'&email_con='+ email_con +'&nickname='+ nickname +'&marintal='+ marintal +'&city='+ city +'&state='+ state +'&other='+ other +'&country='+ country +'&pwd='+ pwd +'&cpwd='+ cpwd +'&aboutus='+ aboutus +'&invite='+ invite +'&chxbox='+ chxbox;

                     $.ajax({
						  type: "POST",
						  url: "e_ajax_register.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {
					      
						  if(html ==1){
							  $("#cateerror").fadeOut('slow');
							  
						  }
					  }
					 });
					return false;
					});
			 
		//$('#example').append("this text was appended");
		
		
		// Use this function for general discussion in account
				  $("#general").click(function() {

					 var comptxt     = $('textarea.general_text').val();
					 var permit     = $('select#permit').val();
					 var dataString = 'comptxt='+ comptxt +'&permit='+ permit;

                     $.ajax({
						  type: "POST",
						  url: "e_ajax_generalcomment.php",
						  cache: false,
						  data: dataString,
					  success: function(html) {
						  
						  if(html ==205){
							   $('.general_text').fadeOut('slow');
							   $("#postcom").fadeIn('slow');
							   $("#offcome").fadeOut('slow');

						  }else{
							document.getElementById('generaltalk').innerHTML = ""+ html +"";
                            //$('#appendcomment').append(""+ html +"");
                          }
					  }
					 });
					return false;
					});
					
					
					// Use this function to exlain category detailon register page
function dashboard(int) {

            var filePath ="e_dashboard.php?dashid="+ int;			
			
			if (window.XMLHttpRequest) {
			var xmlhr = new XMLHttpRequest();
			
			} else {
			var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			
			}
			
			xmlhr.open("GET", filePath, true);
			xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
			
			xmlhr.onreadystatechange = function() {
			var resultDiv = document.getElementById('dashboard');
			
			if (xmlhr.readyState == 1) {
			  resultDiv.innerHTML = '<b>Loading <img src="e_img/ajax-loader.gif" border="0"></b>'; 
			  
			} else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
					if(xmlhr.responseText){
						resultDiv.innerHTML = xmlhr.responseText;
					  }
			  
			} else if (xmlhr.readyState == 4) {
			  resultDiv.innerHTML = 'Sorry server busy. Please try again';
			  $("#catedetail").hide('slow');
			}
			}
			
			xmlhr.send();
}



//validate telephone before sending to nooksy
  $("#sendsms").click(function() {
				  
						var usid       = $('input#usid').val();
						var sms_sender = $('select#sms_sender').val();
						var sms        = $('textarea#sms').val();
						var dataString = 'usid='+ usid +'&sms_sender='+ sms_sender +'&sms='+ sms;
		
		              var filePath ='e_ajax_smssend.php';			

if (window.XMLHttpRequest) {
    var xmlhr = new XMLHttpRequest();
  } else {
    var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
  }

  xmlhr.open('POST', filePath);
  xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 

  xmlhr.onreadystatechange = function() {
    var resultDiv = document.getElementById('smstalk');
	
    if (xmlhr.readyState == 1) {
     resultDiv.innerHTML = '<b>Sending SMS, please wait <img src="e_img/ajax-loader.gif" border="0"></b>';
	  $("#sendsms").hide('slow');
	  
    } else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
				if(xmlhr.responseText =="<h2>SMS sent successfully</h2>"){
						  resultDiv.innerHTML = xmlhr.responseText;
						  $(".smstable").hide('slow');

				}else{
				resultDiv.innerHTML = xmlhr.responseText;
	                $("#sendsms").show('slow');
			    
				}
				
    } else if (xmlhr.readyState == 4) {
	  resultDiv.innerHTML = '<font color=\"#ff0000\">Sorry server busy. Please try again</font>'; 
    }
  }
  xmlhr.send(dataString);
  
	return false;
});
	

// Use this function to display the user profile
$("#credit").keyup(function() {

					 var amountsms      = $('input#credit').val();
					 var dataString = 'amountsms='+ amountsms ;

var filePath ='e_ajax_amountsms.php';			

if (window.XMLHttpRequest) {
			var xmlhr = new XMLHttpRequest();
			} else {
			var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
			}
			
			xmlhr.open('POST', filePath);
			xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
			
			xmlhr.onreadystatechange = function() {
			    var resultDiv = document.getElementById('amountresult');

			if (xmlhr.readyState == 1) {
            resultDiv.innerHTML = 'Calculating...'; 
			  
			  
			} else if (xmlhr.readyState == 4 && xmlhr.status == 200) {

					if(xmlhr.responseText){
 						resultDiv.innerHTML = xmlhr.responseText;
 			              

					  }
			  
			} else if (xmlhr.readyState == 4) {
  	   			  resultDiv.innerHTML = 'Server busy...'; 

			}
			}
			xmlhr.send(dataString);
                   
					return false;
});



});
runOnLoad(function(){
  $("textarea#comment").select().focus();
});

function puts(thisValue) {
		$('#txt').val(thisValue);
		setTimeout("$('#suggest').hide();", 200);
	}
	
function puttxt(thisValue) {
		$('#txtfree').val(thisValue);
		setTimeout("$('#suggesttxt').hide();", 200);
}

function putyellow(thisValue) {
		$('#yellowpage').val(thisValue);
		setTimeout("$('#suggestyellowpage').hide();", 200);
}

function putequipsell(thisValue) {
		$('#equipsell').val(thisValue);
		setTimeout("$('#suggestequipsell').hide();", 200);
}
	
	function putreal(thisValue) {
		$('#txts').val(thisValue);
	}
	




$(function() {
      $("#refresh").click(function(evt) {
         $("#randomdiv").load("index.php")
         evt.preventDefault();
      })
    })
