function blog_search(e){		
		theextrachar = 	(e.charCode) ? e.charCode :
       						((e.keyCode) ? e.keyCode :
       						((e.which) ? e.which : 0));	
		postBodyStr = 'searchBlog=' + $('searchBlog').value;
		new Ajax.Updater('blogsearchdiv', 'blog_search_autocomplete.php', {evalScripts:true, postBody:postBodyStr});			
}


function screenSize() 
	{
		var postBodyStr = 
			'width=' + screen.width + 
			'&height=' + screen.height;				
		new Ajax.Request('screen.php', {postBody:postBodyStr});
		//alert(postBodyStr);
	}

function image_get() 
	{
		url = 'image_get.php';
		display = 'viewimagediv';
		new Ajax.Updater(display ,url ,{asynchronous:true});				
	}



function ajaxSaveEvent(){
	// the encodeURCompoenent is require to preserve & character in note	
	var postBodyStr = 
		'user='+$('user').value + 
		'&password='+$('password').value +				
		'&journal='+$('journal').value + 
		'&subject='+$('subject').value + 		
		'&event=' + encodeURIComponent($('event').value) +
		'&inactive='+$('inactive').checked;

	//alert(postBodyStr);
	display = 'geteventdiv';
	new Ajax.Updater(display, 'event_add.php', 
		{evalScripts:true, postBody:postBodyStr});	 	
}

	function loading(file){
		 //alert(file);	
		 if (file=="wait.gif")
		 	$("loadingdiv").update('<img src="'+file+'" />');	
		 else
		 	$("loadingdiv").update('Loading...<img src="'+file+'" />');	
	}

	function unloading(){
		  parent.document.getElementById("loadingdiv").innerHTML = '';	
		  //$("loadingdiv").update('');	iframe cannot use $
	}

	function iframe()
	{	
		new Ajax.Updater('iframediv','iframe.php');						
	}
	
	function test()
	{	
		new Ajax.Updater('iframediv','iframe.php');						
	}
	
	function mouse_in()
	{	
		//$("searchstatusdiv").update('mouse in');	
		//$("resultdiv").update('mouse in');	
		//new Ajax.Request('mouse_in.php');		
		new Ajax.Updater('creditdiv' , 'mouse_in.php');	
	}		

	function blog_mouse_in(entryDateEdit)
	{	
		// goto the #top
		
		// remove previous shop
		
		// load next shop
		var postBodyStr = 'lamppost=' + entryDateEdit;
		new Ajax.Updater('viewimagediv', 'blog_mouse_in.php', 
			{evalScripts:true, insertion:Insertion.Bottom, postBody:postBodyStr});	 	
	}
	
	function blog_mouse_in_close(entryDateEdit)
	{	
		// empty current div
		var currentdiv = entryDateEdit + "div";
		$(currentdiv).update("");
		$(currentdiv).remove();
		$("#top").focus();
	}
	
	
	function shop_load()
	{	
		// load next shop
		new Ajax.Updater('viewimagediv', 'shop_load.php', 
			{evalScripts:true, insertion:Insertion.Bottom});	 	
	}		

	function blog_image_load()
	{	
		new Ajax.Updater('viewimagediv', 'image_display.php', {evalScripts:true});	 	
	}		

	function mouse_out()
	{
		//$("searchstatusdiv").update('mouse out');	
		//$("resultdiv").update('mouse out');	
		//new Ajax.Request('mouse_out.php');		
		new Ajax.Updater('creditdiv' , 'mouse_out.php');	
	}		

	function credit_save()
	{
		//new Ajax.Request('credit_save.php');		
		new Ajax.Updater('creditdiv' , 'credit_save.php');			
	}		

	function credit_get()
	{
		new Ajax.Updater('creditdiv' , 'credit_get.php');	
	}		

	function checkAntiSpiderSite(name) {
	if (name){
		$("namestatusdiv").update('<span style="color: #000;">Checking username...</span>');
		var postBodyStr = "name="+name;
		new Ajax.Updater('namestatusdiv' , 'antispidersite_check.php', 
			{ evalScripts:true, postBody:postBodyStr});	
	}else 
		$("namestatusdiv").update('');	
	}

	function checkName(name) {
	if (name){
		$("namestatusdiv").update('<span style="color: #000;">Checking website...</span>');
		var postBodyStr = "name="+name;
		new Ajax.Updater('namestatusdiv' , 'name_check.php', 
			{method:'post', evalScripts:true, postBody:postBodyStr});	
	}else 
		$("namestatusdiv").update('');	
	}

	function checkUser(password) {
	if (password){
		//$("uservalidatediv").update('<span style="color: #000;">Validate user...</span>');
		var postBodyStr = 'user='+$('user').value + 
		'&password='+$('password').value;				
		new Ajax.Updater('uservalidatediv' , 'LJ_login.php', 
			{postBody:postBodyStr});	
	}else 
		$("uservalidatediv").update('');	
	}


	function email_spider()
	{
		postBodyStr = 'target='+ encodeURIComponent($('target').value);
		//document.getElementById("resultdiv").innerHTML = 'Searching emails...';	
		
		// log search
		new Ajax.Request('search_log.php', {postBody:postBodyStr});
		
		//$("Search").disabled = true;	
		
		// start spider
		if ($('target').value=='http://community.livejournal.com/_spreee/2190211.html#cutid1'){
			$("resultdiv").update('Searching emails...');	
			url = 'email_spider.php';
			new Ajax.Updater('resultdiv',url, {asynchronous:true, 
			method:'post', evalScripts:true, postBody:postBodyStr});					
			
		}else{
		
			//alert("You need to be a member before you can spider email. To join as a member, click To advistise link now!");
			//return;
			
			$("resultdiv").update('');	
			//url = 'simple_spider.php';
			//$("iframediv").update('Loading...');
			iframe();
		}
		
			
	}


function ajaxPostEnquiry(enquiryProduct){	
	// the encodeURCompoenent is require to preserve & character in note	
	var postBodyStr = 'enquiryNote=' + 
		encodeURIComponent($('enquiryNote_'+enquiryProduct).value) +
		'&enquiryProduct=' + enquiryProduct ;
	//alert(postBodyStr);	
	new Ajax.Updater('enquirydisplaydiv_'+enquiryProduct, 'enquiry_add.php', 
		{evalScripts:true, postBody:postBodyStr});	 	
}

function ajaxPostWiki(wikiName){
	var postBodyStr = 'wikiNote=' + 
		encodeURIComponent($('wikiNote').value) +
		'&wikiName=' + wikiName; 	// the encodeURCompoenent is require to preserve & character in note	
	new Ajax.Updater('wikidiv', 'wiki_add.php', {evalScripts:true, postBody:postBodyStr});	 	
}
		
		
	function ajaxPostAntispider(){		
		var postBodyStr = 'site=' + $('site').value +
			'&email='+$('email').value ;	
		//alert(postBodyStr);
		new Ajax.Updater('viewantispiderdiv', 'antispider_add.php', 
			{evalScripts:true, postBody:postBodyStr});	 	
	}

	function ajaxPostClearance(){		
		var postBodyStr = 'image_link=' + $('image_link').value +
			'&price='+$('price').value +	
			'&blogshop='+$('blogshop').value +	
			'&email='+$('email').value + 
			'&note='+$('note').value ;	
		new Ajax.Updater('viewimagediv', 'clearance_add.php', 
			{evalScripts:true, insertion:Insertion.Top, postBody:postBodyStr});	 	
	}




	function ajaxPostJoinMember(){		
		var postBodyStr = 'ref=' + $('ref').value +
			'&hp='+$('hp').value ;	
		new Ajax.Updater('memberstatusdiv', 'member_add.php', 
			{evalScripts:true, postBody:postBodyStr});	 	
	}


	function ajaxPostCheckLink(response){		
		var postBodyStr = 'site=' + $('site').value +
			'&response='+response ;	
		//alert(postBodyStr);	
		new Ajax.Updater('verifydiv', 'link_check.php', 
			{evalScripts:true, postBody:postBodyStr});	 	
	}


	function ajaxPostBlog(type){
		
		if (type == 1)
		// the encodeURCompoenent is require to preserve & character in note	
			var postBodyStr = 'note=' + encodeURIComponent($('note').value) +
			'&name='+$('name').value + '&type=' + type;
		else
			var postBodyStr = 'note=' + encodeURIComponent($('note').value) +
			'&name='+$('name').value + '&type=' + $('type').value;
			
		//if ($('type').value == 1)
		if (type == 1)
			display = 'viewblogdiv';
		else{
			if ($('type').value == 1)
				display = 'viewblogdiv';
			else
				display = 'viewwholesalerdiv';
		}
		
		new Ajax.Updater(display, 'blog_add.php', 
			{asynchronous:true, evalScripts:true,
			 method:'post', postBody:postBodyStr});	 	
		
		}

	function updateWholesalerDiv() 
	{
		url = 'wholesale_get.php';
		display = 'viewwholesalerdiv';
		new Ajax.Updater(display ,url ,{asynchronous:true});				
	}

	
	function ajaxEditBlog (entryID){
		var postBodyStr = 'entryID=' + entryID;
		new Ajax.Updater('descriptiondiv' , 'blog_edit.php', 
			{asynchronous:true, evalScripts:true,
			 method:'post', postBody:postBodyStr});		
		// ajaxUnStickBlog (-1);
	}
	
	function ajaxEditEnquiry (enquiryID){
		var postBodyStr = 'enquiryID=' + enquiryID;
		new Ajax.Updater('enquiryhiddendiv', 'enquiry_edit.php', {evalScripts:true, postBody:postBodyStr});		
		//new Ajax.Request('enquiry_edit.php', {evalJS: true, postBody:postBodyStr});		
	}

	function ajaxEditWiki (wikiID){
		var postBodyStr = 'wikiID=' + wikiID;
		new Ajax.Updater('wikidiv', 'wiki_edit.php', {evalScripts:true, postBody:postBodyStr});		
	}
	
	function ajaxEditAntispider (antispiderID){
		var postBodyStr = 'antispiderID=' + antispiderID;
		new Ajax.Updater('antispiderhiddendiv', 'antispider_edit.php', {evalScripts:true, postBody:postBodyStr});		
	}
	
	function ajaxReplyEnquiry (enquiryID){
		var postBodyStr = 'enquiryID=' + enquiryID;
		new Ajax.Updater('enquiryhiddendiv', 'enquiry_reply.php', {evalScripts:true, postBody:postBodyStr});		
	}
	
	

	function ajaxEditEvent (eventID){
		var postBodyStr = 'eventID=' + eventID;
		new Ajax.Updater('eventdiv' , 'event_edit.php', 
			{asynchronous:true, evalScripts:true,
			 method:'post', postBody:postBodyStr});
		//alert(postBodyStr);			
	}

	function ajaxFilterPost(eventID){
		var postBodyStr = 'eventID=' + eventID;
		new Ajax.Updater('getpostdiv' , 'post_get.php', 
			{asynchronous:true, evalScripts:true,
			 method:'post', postBody:postBodyStr});
	}
	
	function ajaxUpdateVisit (entryID){
		var postBodyStr = 'entryID=' + entryID;
		new Ajax.Updater('descriptiondiv' , 'blog_visit.php', 
			{asynchronous:true, method:'post', postBody:postBodyStr});	
	}

	function ajaxImageDisplay (entryID){
	
		var postBodyStr = 'entryID=' + entryID;
		var topviewimagediv = top.document.getElementById('viewimagediv');
		if (entryID == 1){
			new Ajax.Updater(topviewimagediv , 'image_display.php', 
				{asynchronous:true, evalScripts:true, method:'post', postBody:postBodyStr});		
			new Ajax.Updater(topviewimagediv , 'image_display.php', 
				{asynchronous:true, evalScripts:true, insertion:Insertion.Bottom});		
		}else{
			new Ajax.Updater(topviewimagediv , 'image_display.php', 
				{asynchronous:true, evalScripts:true, method:'post', postBody:postBodyStr});		
			//new Ajax.Updater(topviewimagediv , 'image_display.php', 
			//	{asynchronous:true, evalScripts:true, insertion:Insertion.Top});		
		}	
	
	}
	
	function ajaxUpdateRecommend (entryID){
		var postBodyStr = 'entryID=' + entryID;
		var display = 'recommenddiv' + entryID;
		new Ajax.Updater(display , 'recommend_add.php', 
			{asynchronous:true, method:'post', postBody:postBodyStr});	
	 	//alert(postBodyStr);	
	}
	
	
	function ajaxUpdateImage(entryID){
		var postBodyStr = 'target=' + entryID;

		var display = entryID + "imagediv";
		new Ajax.Updater(display , 'iframe_image_update.php', 
			{asynchronous:true, method:'post', postBody:postBodyStr});	
	}
	
	

	function ajaxStickBlog (blogID){
		var postBodyStr = 'blogID=' + blogID;
		new Ajax.Updater('viewstickdiv' , 'stick_add.php', 
			{asynchronous:true, evalScripts:true,
			 method:'post', postBody:postBodyStr});		
		//alert(postBodyStr);
	}
	
	function ajaxUnStickBlog (blogID){
		var postBodyStr = 'blogID=' + blogID;
		new Ajax.Updater('viewstickdiv' , 'stick_remove.php', 
			{asynchronous:true, evalScripts:true,
			 method:'post', postBody:postBodyStr});		
		//alert(postBodyStr);
	}
	
	