function assignImageToPage( my_page_id, my_image_id, my_image_type )
{
	if( isNaN( parseInt( my_page_id+"" )) || isNaN( parseInt( my_image_id+"" )) )
	{
		alert( " Please, select a page and an image");
		return;
	}
	else if(  parseInt( my_image_id+"" )== 0 && isNaN( parseInt( my_image_type+"" ))  )
	{
		// my_image_type=1 if page top image
		// my_image_type=2 if psge summary image
		alert( " Not sure which image - top or summary. Sorry could not delete.");
		return;	
	}
	

	
	$.get("/AssignImageToPage.asp",
	{ page_id:    my_page_id,
	  image_id:   my_image_id,
	  image_type: my_image_type
	},
	function(my_options)
	{
		//alert( my_options );
		
		if( parseInt( my_image_id+"" )== 0 )
		{
			location.reload();
		}
		else 
		{
			location = "/ContentAdmin_Page.asp?doWhat=edit_page_form&page_id=" + my_page_id;
		}
		
		
	});

	return;

}






function getLayoutDropdown( my_layout_id )
{
	if(isNaN( parseInt( my_layout_id+""))){ my_layout_id ="";}

	$.get("/LayoutDropdown.asp",
	{ layout_id: my_layout_id,
	  select_name:"page_layout_id",
	  add_javascript: " onChange='AssignedSnippets(); return false;'"
	},
	function(my_options)
	{
		$("#layout_dropdown").html(my_options);
		 AssignedSnippets();
	});
}





function AssignedSnippets()
{
	document.getElementById("layout_placeholders").innerHTML = "";

	$.get("/PageSnippetsAndPlaceholders.asp",
	{ layout_id: document.getElementById("page_layout_id").value,
	  page_id:document.getElementById("page_id").value
	},
	function(my_options)
	{
		$("#layout_placeholders").html(my_options);
	});
}






function LoopListItems()
{
	var form_parameters = "";

	var comma = ", ";

	for(var i=1; i<30; i++ )
	{
		if(document.getElementById("placeholder_"+i) )
		{
			 //alert( "Placeholder " + i + " exists");

			 var $kids =  $("#placeholder_"+i).children();
			 var k=0;

			 while( $kids[k] && k<30 )
			 {
				 if( $kids[k].id )
				 {
					var tstring = $kids[k].id  +"";
					form_parameters += "<input type=\"hidden\" name=\"snippet_" + i + "_"+ k +"\" value=\""+ tstring.replace(/snippet_/gi, "") +"\">";

					//alert( "snippet " + k + " inside placeholder " + i + " has id value " + tstring.replace(/snippet_/gi, ""));
				 }

				 k++;
			 }
		}
	}

	// check if there are snippets to be deleted
	var $arr_drop_offs = $("#unwanted").children();

	if($arr_drop_offs.length>1)
	{
		//var td = $arr_drop_offs.length-1;
		var td = $arr_drop_offs.length;

		if( confirm("Please note " + td + " snippets will be deleted from the page \n \nAre you sure you want to proceed?" ) )
		{}
		else
		{
			alert("Please make adjustments and hit Update button");
		}
	}


	document.getElementById("additional_parameters").innerHTML = form_parameters;
	document.getElementById("edit_content_form").submit();

	return false;



/*

"snippet_"  placeholder id _ snippet order inside the placeholder : snippet id
snippet_1_1:2,
snippet_2_1:3,
snippet_3_1:4,
snippet_4_1:1,
snippet_4_2:6,
snippet_5_1:5
*/


}



function getPagesDropdown()
{
	$.get("/PagesDropdown.asp",
	{ search_for2: document.getElementById("search_for2").value,
	  select_name:"lstPages"
	},
	function(my_options)
	{
		$("#list_pages").html(my_options);
		if( document.getElementById("search_for2").value != "" )
		{
			$("#change_links_from").html("<a href='javascript:void(0);' onClick='assignSelectedPage(); return false;' title='Click to change Linked From from current to selected'>Assign page as Linked From</a><br><i>Hit Update Page to save the change</i>");

		}
	});
}



function assignSelectedPage()
{
	document.getElementById("linked_from_name").innerHTML = document.getElementById("lstPages").options[document.getElementById("lstPages").selectedIndex].text;
	document.getElementById("linked_from_name").style.fontWeight=900;
	document.getElementById("page_links_from").value = document.getElementById("lstPages").value;
}





function  AddSnippets( todo )
{
	if( !todo ){ todo ="add";}

	var i=0;
	var toBeAdded = "";
	var comma ="";


	for( var i=0; i<document.Select_Snippets.elements.length; i++)
	{
		if( document.Select_Snippets.elements[i].type=="checkbox" && document.Select_Snippets.elements[i].checked )
		{
			toBeAdded += comma + document.Select_Snippets.elements[i].value
			comma = ",";
		}
	}

	$.get("/AddSelectedSnippets.asp",
	{ add_selected: toBeAdded
	},
	function(my_options)
	{
		if( my_options+"" == "0" )
		{
			if( todo == "add")
			{
				alert( "Sorry, no snippets added. Please check current selected snippets");
			}
		}
		else
		{
			alert( "Added " + my_options + " snippets");

		}

		if( todo == "add_n_go")
		{
			//location = "/ContentAdmin_Page.asp?doWhat=page_content_form&page_id=" + document.getElementById("page_id").value;
			opener.location.reload();
			self.close();


		}
		else
		{
			//location = "/ContentAdmin_Page.asp?doWhat=select_snippet_form&page_id=" + document.getElementById("page_id").value;
			opener.location.reload();
			self.focus();
			self.location.reload();
			


		}

	});
}



function DeleteSnippet( to_be_deleted_id )
{
	$.get("/AddSelectedSnippets.asp",
	{ deleted_this_id: to_be_deleted_id
	},
	function(my_options)
	{
		$("#cur_selected").html(my_options);
		opener.location.reload();
		self.focus();

	});

}




function EditCategory( category_id )
{
	var window_url = "/ContentAdmin_PageCategories.asp?doWhat=list_categories";

	window_url += "&category_id=" + category_id;
	window_url += "#info_" + category_id ;

	var category_window = window.open(window_url, "CategoryEditor", "status=no,location=no,toolbar=no,width=600,height=500,resizable=yes,scrollbars=yes,left=300,top=100" );

	alert( "Editor will open in new window" );

	category_window.flipForms( category_id );
	category_window.focus();

}




function ChildrenMenuListOutput( parent_menu_id, children_level )
{
	
//	alert( "parent_id  is " + parent_menu_id);
	level = 1;
	
	//document.getElementById("children_of_menu_"+ parent_menu_id).innerHTML = "";

	$.get("/ChildrenMenus.asp",
	{ parent_id: parent_menu_id,
	  level:children_level
	},
	function(my_options)
	{
		$("#children_of_menu_"+ parent_menu_id ).html(my_options);
	});
	
	
	return;
}





function CommentVsLoginSwitch( my_id )
{
	if(!my_id ){  return; }

	switch(my_id)
	{
		case "div_comment" :
		document.getElementById('div_comment').style.display='block';
		document.getElementById('div_login').style.display='none';
		document.getElementById('tabs_table').style.background="url('/images_tr/ti_images/industry_toolbox/tabs_post_ann.gif')";
		document.getElementById('changedots').className="dotted_border1";
		break;

		case "div_login" :
		document.getElementById('comment_mirror').value=document.getElementById('comment').value;
		document.getElementById('div_comment').style.display='none';
		document.getElementById('div_login').style.display='block';
		document.getElementById('tabs_table').style.background="url('/images_tr/ti_images/industry_toolbox/tabs_post_login.gif')";
		document.getElementById('changedots').style.background="url('/images_tr/spacer.gif')";
		break;

		default:
		break;
	}

	return;

}



function WebUserLogging()
{
	
	var my_email = document.getElementById("email").value;
	var my_password = document.getElementById("password").value;
	var my_comment =  document.getElementById("comment_mirror").value;
	var my_article = "";
	
	if( document.getElementById("article_id"))
	{
		my_article = document.getElementById("article_id").value;
	}
	
	if( !my_email ){  return; }
		
	if( !my_password )
	{  
		var message = "<div style='font-size:12; font-weight:900;'>";
		message += "Please enter your password.";
		//message += "<br />If you didn&acute;t create your password yet click <a href='ti.asp?page=200433&email="+my_email+"' title='Click to go to registration form'>here</a> to create a password.";
		message += "</div><br />";
		if(document.getElementById("sinopsis"))
		{document.getElementById("sinopsis").innerHTML = message; }		
		return; 
	}
	
	var params = {email: my_email, password: my_password, article_id: my_article, comment: my_comment, doWhat: "login"};
	$.ajax({
	 type: "POST",
	 url:"/LoginToComment.asp",
	 data: params,
	 async: false,
	 success: WebUserLogging_callback
	});


	function WebUserLogging_callback(data, status) 
	{
		//eval(data);
	
		var message = "";
				
		if(data+""=="1")
		{
		
			if ($("#start_discussion").length >0) {
				message += "<div style='font-size:12; font-weight:900; padding-bottom:10px;'>";
				message += "Sorry but it looks like you haven&acute;t registered yet.";
				message += "<br /></div>";
			} else {
				message += "<div style='font-size:12; font-weight:900; padding-bottom:10px;'>";
				message += "Sorry but it looks like you haven&acute;t registered yet.";
				message += "<br />To create a new account click on <a href='/TIWeb/IndustryToolbox/Insider/RegisterOrLogIn/' title='Click to go to registration form'>Register Now</a>";
				message += " or leave a comment anonymously.";
				message += "<br /></div>";
			}
		}
		else if(data+""=="2")
		{

			if ($("#start_discussion").length >0) {
				message += "<div style='font-size:12; font-weight:900; padding-bottom:10px;'>";
				message += "Sorry Travel Manitoba didn&acute;t finish processing your registration request yet";
				message += "<br />You will be notified via email immidiately after the processing is done.";
				message += "</div>";
			} else {
				message += "<div style='font-size:12; font-weight:900; padding-bottom:10px;'>";
				message += "Sorry Travel Manitoba didn&acute;t finish processing your registration request yet";
				message += "<br />You will be notified via email immidiately after the processing is done.<br />You may leave a comment anonymously by now.";
				message += "</div>";
			}

			
			document.getElementById("email_label_cell").style.paddingTop = "20px"; 
			
			/*document.getElementById("email").style.display = "none";
			document.getElementById("password").style.display = "none"; 
			document.getElementById("email_label").style.display = "none"; 
			document.getElementById("password_label").style.display = "none"; 
			document.getElementById("button_submit").style.display = "none"; 
			*/
		}
		else if(data+""=="3")
		{
			message += "<div style='font-size:12; font-weight:900;'>";
			message += "Travel Manitoba has approved your registration request - an email message was sent to email address you provied.";
			message += "<br />Now you need to create a password to confirm\/activate your account.";
			message += "<br />Please check your email inbox for the message from Travel Manitoba with an activation link.";
			message += "<br />Don&acute;t forget to check the junk mail folder too.";
			message += "</div>";
			
			document.getElementById("email_label_cell").style.paddingTop = "20px"; 
			
		/*				
			document.getElementById("email").style.display = "none";
			document.getElementById("password").style.display = "none";
			document.getElementById("email_label").style.display = "none"; 
			document.getElementById("password_label").style.display = "none"; 
			document.getElementById("button_submit").style.display = "none"; 
		*/	
		
		}		
		else if(data+""=="4")
		{		
			message += "<div style='font-size:12; font-weight:900;'>";
			message += "You are a registered user. Please enter your password to login";
			message += "</div>";
		}
		else if(data+""=="5")
		{		
			/*document.getElementById("div_login").innerHTML = "";
			document.getElementById("div_login").style.display = "none";
			document.getElementById("login_label").innerHTML = "";
			document.getElementById("div_comment").style.display = "block";			
			document.getElementById("pen_name").innerHTML = "Post your comment"; 
			document.getElementById("greetings").innerHTML = "You are logged in.<br />Your comments will be posted online moments after you submit them. The comments will be signed by your pen-name.";
			
			WebUserPenName( my_email );
			*/
			document.location.reload();;

		}
		else if(data+""=="6")
		{		
			message += "<div style='font-size:12; font-weight:900; color:#900;'>";
			message += "Incorrect login information ";
			message += "<br />Please try again.";
			message += "</div>";
		}
		else if(data+""=="7")
		{		
			message += "<div style='font-size:12; font-weight:900;'>";
			message += "Please enter your registration email address.";
			message += "</div>";
		}		
		
		if(document.getElementById("sinopsis"))
		{document.getElementById("sinopsis").innerHTML = message; }
	}
	
	return;
}




function WebUserPenName( my_email )
{

	if( !my_email ){  return; }
	
	var params = {email: my_email,  doWhat: "get_names"};
	$.ajax({
	 type: "POST",
	 url:"/LoginToComment.asp",
	 data: params,
	 async: false,
	 success: WebUserPenName_callback
	});

	function WebUserPenName_callback(data, status) 
	{
	
		document.getElementById("pen_name").innerHTML = data; 
	
	}
	
	return;
}



 $(document).ready(function()
 {
 	if ($("#change-org-textbox")) {
		$("#change-org-textbox").autocomplete("/jquery-org-list.asp", {
			width: 260,
			selectFirst: false,
			max:100
		});

		$("#change-org-textbox").result(function(event, data, formatted) {
			if (data)
				document.getElementById("org_id").value = data[1];

			// show details of the org
			org_details(  data[1] );

		});

	}

 });
 
 
 
 function sendCapchaForm()
 {

 
	var my_comment = document.getElementById("comment").value;
	var my_article_id = document.getElementById("article_id").value;
	var my_recaptcha_challenge_field = "";
	var my_recaptcha_response_field = "";
	var my_path = document.getElementById("path").value;
  	var my_sub = $("input[name='subscribe']:checked").val();

	
	if( document.getElementById("recaptcha_challenge_field") )
	{   my_recaptcha_challenge_field = document.getElementById("recaptcha_challenge_field").value;   }
	
	if( document.getElementById("recaptcha_response_field") )
	{   my_recaptcha_response_field = document.getElementById("recaptcha_response_field").value;   }	
	
	if( !my_comment ){  alert("Please enter a comment"); return; }
	
	//alert( "article_id: "+my_article_id);
	//alert( "comment:"+my_comment);	
	//alert( "recaptcha_challenge_field:"+my_recaptcha_challenge_field);
	//alert( "recaptcha_response_field:"+my_recaptcha_response_field);
	//alert( "my_path: "+my_path);


	var params = {article_id: my_article_id, comment:my_comment, recaptcha_challenge_field:my_recaptcha_challenge_field, recaptcha_response_field:my_recaptcha_response_field, doWhat:"save_comment",subscribe:my_sub};
	$.ajax({
	 type: "POST",
	 url:"/CommentProcessing.asp",
	 data: params,
	 async: false,
	 success: sendCapchaForm_callback
	});

	function sendCapchaForm_callback(data, status) 
	{
	
		if( data+"" == "1" )
		{
			document.getElementById("greetings").innerHTML ='<span style="font-weight:900; color:#900;">Please select an article to comment about</span>';
		}
		else if( data+"" == "2" )
		{
			document.getElementById("greetings").innerHTML ='<span style="font-weight:900; color:#900;">Please enter your comment.</span>';		
		}
		else if( data+"" == "4" )
		{
			showRecaptcha(); 
			document.getElementById("greetings").innerHTML ='<span style="font-weight:900; color:#900;">Your captcha entry was incorrect. Please re-enter the data and re-submit the form</span>';
		}
		else if( data+"" == "3" )
		{
			//location = my_path+ "&doWhat=comment_saved&article_id="+my_article_id;
			location = my_path+ "&doWhat=comment_saved&article_id="+my_article_id + "#comments_posted";

		
		}		
		else if( data+"" == "5" )
		{
 			location = my_path+ "&doWhat=comment_submitted&article_id="+my_article_id + "#comments_posted";
		
		}
		else
		{
			alert(data+"");
		}
	}
	
	return;		
		
 }
 
 
 
 
 
 
  function sendCapchaFormForDiscussionComment()
  {
 
  
 	var my_comment = document.getElementById("comment").value;
 	var my_recaptcha_challenge_field = "";
 	var my_recaptcha_response_field = "";
 	var my_path = document.getElementById("path").value;
 
 	
 	if( document.getElementById("recaptcha_challenge_field") )
 	{   my_recaptcha_challenge_field = document.getElementById("recaptcha_challenge_field").value;   }
 	
 	if( document.getElementById("recaptcha_response_field") )
 	{   my_recaptcha_response_field = document.getElementById("recaptcha_response_field").value;   }	
 	
 	if( !my_comment ){  alert("Please enter a comment"); return; }
 	
 	//alert( "comment:"+my_comment);	
 	//alert( "recaptcha_challenge_field:"+my_recaptcha_challenge_field);
 	//alert( "recaptcha_response_field:"+my_recaptcha_response_field);
 	//alert( "my_path: "+my_path);
 
 
 	var params = {article_id: 0, comment:my_comment, recaptcha_challenge_field:my_recaptcha_challenge_field, recaptcha_response_field:my_recaptcha_response_field, doWhat:"save_comment"};
 	$.ajax({
 	 type: "POST",
 	 url:"/CommentProcessingForDiscussion.asp",
 	 data: params,
 	 async: false,
 	 success: sendCapchaFormForDiscussionComment_callback
 	});
 
 	function sendCapchaFormForDiscussionComment_callback(data, status) 
 	{
 	/*
 		if( data+"" == "1" )
 		{
 			document.getElementById("greetings").innerHTML ='<span style="font-weight:900; color:#900;">Please select an article to comment about.</span>';
 		}
 		else 
 		*/
 		
 		if( data+"" == "2" )
 		{
 			document.getElementById("greetings").innerHTML ='<span style="font-weight:900; color:#900;">Please enter your comment.</span>';		
 		}
 		else if( data+"" == "4" )
 		{
 			showRecaptcha(); 
 			document.getElementById("greetings").innerHTML ='<span style="font-weight:900; color:#900;">Your captcha entry was incorrect. Please re-enter the data and re-submit the form</span>';
 		}
 		else if( data+"" == "3" )
 		{
 			//location = my_path+ "&doWhat=comment_saved&article_id="+my_article_id + "#comments_posted";
 			location = my_path;
 
 		
 		}		
 		else if( data+"" == "5" )
 		{
  			location = my_path+ "&doWhat=comment_submitted&article_id="+my_article_id + "#comments_posted";
  			location = my_path;
 		
 		}
 		else
 		{
 			alert(data+"");
 		}
 	}
 	
 	return;		
 		
 }
 
 
 
 
 
 
 
 
  function sendCommentWhenLogged()
  {
 
  
 	var my_comment = document.getElementById("comment").value;
 	var my_article_id = document.getElementById("article_id").value;
 	var my_path = document.getElementById("path").value;
   var my_sub = $("input[name='subscribe']:checked").val();

 	if( !my_comment ){  alert("Please enter a comment"); return; }
 	
 	//alert( "article_id: "+my_article_id);
 	//alert( "comment:"+my_comment);	
 	//alert( "recaptcha_challenge_field:"+my_recaptcha_challenge_field);
 	//alert( "recaptcha_response_field:"+my_recaptcha_response_field);
 	//alert( "my_path: "+my_path);
 
 
 	var params = {article_id: my_article_id, comment:my_comment, doWhat:"save_comment",subscribe:my_sub};
 	$.ajax({
 	 type: "POST",
 	 url:"/CommentProcessing.asp",
 	 data: params,
 	 async: false,
 	 success: sendCommentWhenLogged_callback
 	});
 
 	function sendCommentWhenLogged_callback(data, status) 
 	{
 	
 		if( data+"" == "1" )
 		{
 			document.getElementById("greetings").innerHTML ='<span style="font-weight:900; color:#900;">Please select an article to comment about</span>';
 		}
 		else if( data+"" == "2" )
 		{
 			document.getElementById("greetings").innerHTML ='<span style="font-weight:900; color:#900;">Please enter your comment.</span>';		
 		}		
 		else if( data+"" == "5" )
 		{
 			location = my_path+ "&doWhat=comment_submitted&article_id="+my_article_id + "#comments_posted";
 			document.getElementById("comment").value = "";
 		}
 		else
 		{
 			alert(data+"");
 		}
 	}
 	
 	return;		
 		
 }
 
 
 
 
 
 
 
 
 
 
   function sendDiscussionCommentWhenLogged()
   {
  
   
  	var my_comment = document.getElementById("comment").value;
  	var my_cid = document.getElementById("cid").value;
  	var my_path = document.getElementById("path").value;
    var my_sub = $("input[name='subscribe']:checked").val();

  	if( !my_comment ){  alert("Please enter a comment"); return; }
  	
  	//alert( "cid: "+my_cid);
  	//alert( "comment:"+my_comment);	
  	//alert( "recaptcha_challenge_field:"+my_recaptcha_challenge_field);
  	//alert( "recaptcha_response_field:"+my_recaptcha_response_field);
  	//alert( "my_path: "+my_path);
  
  
  	var params = {cid: my_cid, comment:my_comment, doWhat:"save_comment",subscribe:my_sub};
  	$.ajax({
  	 type: "POST",
  	 url:"/DiscussionCommentProcessing.asp",
  	 data: params,
  	 async: false,
  	 success: sendDiscussionCommentWhenLogged_callback
  	});
  
  	function sendDiscussionCommentWhenLogged_callback(data, status) 
  	{
  	
  		if( data+"" == "1" )
  		{
  			document.getElementById("greetings").innerHTML ='<span style="font-weight:900; color:#900;">Please select a thread</span>';
  		}
  		else if( data+"" == "2" )
  		{
  			document.getElementById("greetings").innerHTML ='<span style="font-weight:900; color:#900;">Please enter your comment.</span>';		
  		}		
  		else if( data+"" == "5" )
  		{
  			location = my_path+ "&doWhat=comment_submitted&cid="+my_cid + "#comments_posted";
  		
  		}
  		else
  		{
  			alert(data+"");
  		}
  	}
  	
  	return;		
  		
 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
   function sendDiscussionWhenLogged()
   {
  
   
  	var my_comment = document.getElementById("comment").value;
  	var my_subject = document.getElementById("subject").value;
  	var my_article_id = document.getElementById("article_id").value;
  	var my_path = document.getElementById("path").value;
  	var my_sub = $("input[name='subscribe']:checked").val();
  
  	if( !my_comment ){  alert("Please enter a comment"); return; }
  	
  	//alert( "article_id: "+my_article_id);
  	//alert( "comment:"+my_comment);	
  	//alert( "recaptcha_challenge_field:"+my_recaptcha_challenge_field);
  	//alert( "recaptcha_response_field:"+my_recaptcha_response_field);
  	//alert( "my_path: "+my_path);
  
  
  
  	var params = {article_id: my_article_id, comment:my_comment, doWhat:"save_comment", subject:my_subject,subscribe:my_sub};
  	$.ajax({
  	 type: "POST",
  	 url:"/DiscussionProcessing.asp",
  	 data: params,
  	 async: false,
  	 success: sendDiscussionWhenLogged_callback
  	});
  
  	function sendDiscussionWhenLogged_callback(data, status) 
  	{
  		if( data+"" == "1" )
  		{
  			document.getElementById("greetings").innerHTML ='<span style="font-weight:900; color:#900;">You must be logged in to start a new discussion.</span>';
  		}
  		else if( data+"" == "2" )
  		{
  			document.getElementById("greetings").innerHTML ='<span style="font-weight:900; color:#900;">Please enter your comment.</span>';		
  		}		
  		else if( data+"" == "3" )
  		{
  			document.getElementById("greetings").innerHTML ='<span style="font-weight:900; color:#900;">Please enter your subject.</span>';		
  		}		
  		else if( data+"" == "5" )
  		{
  			location = my_path+ "&doWhat=comment_submitted&article_id="+my_article_id + "#comments_posted";
  		
  		}
  		else
  		{
  			alert(data+"");
  		}
  	}
  	
  	return;		
  		
  }
  
 
 
 
 function passwordForgotten()
 {
 	
 	document.form_2.email.value = document.form_1.email.value ;
 	document.form_2.submit() ;
	return;	
 
 }
 
 
 
 function toggleTIMenu( menu_id, ground)
 {
 	if( document.getElementById("" + menu_id).style.display == 'block')
 	{
 		document.getElementById('li_' +menu_id).className='level_'+ground+'_item'; 
 		document.getElementById("" + menu_id).style.display='none';
 	}
 	else
 	{
 		document.getElementById('li_' +menu_id).className='level_'+ground+'_item_active'; 
 		document.getElementById("" + menu_id).style.display='block';
 	}
}



var discussion_start = 0;

function mi_fetchMoreDiscussions() {
	discussion_start += 10;
 	var params = {start:discussion_start,d:"list",page:200588};
 	$.ajax({
 	 type: "POST",
 	 url:"/fetch_discussions.asp",
 	 data: params,
 	 async: false,
 	 success: mi_fetchMoreDiscussions_callback
 	});
 
 	function mi_fetchMoreDiscussions_callback(data, status) 
 	{
 		// no more discussions
 		if( data+"" == "0" )
 		{
 			$("#fetch-more-discussions").hide();
 		} else {
 			$("#more-discussions").append(data);
 		}
 	}
}




function mi_FlipSearchForm( my_value, form_tag )
{
	
	if( isNaN( parseInt( my_value+"")))
	{
		return;
	}
	else if( parseInt( my_value+"") == 1 )
	{	
		document.getElementById("triplets_site_form").style.display="block";
		document.getElementById("triplets_offer_form").style.display="none";
		document.getElementById("triplets_accommodation_form").style.display="none";	
		
	}
	else if( parseInt( my_value+"") == 2)
	{
		document.getElementById("triplets_site_form").style.display="none";
		document.getElementById("triplets_offer_form").style.display="block";	
		document.getElementById("triplets_accommodation_form").style.display="none";	
	}
	else if( parseInt( my_value+"") == 3)
	{
		document.getElementById("triplets_site_form").style.display="none";
		document.getElementById("triplets_offer_form").style.display="none";	
		document.getElementById("triplets_accommodation_form").style.display="block";	
	}	
	
	return;
}



function mi_setFormValuesForOfferSearch_DELETE(  )
{
	
	if( document.getElementById("date_start") ){ $("#date_start").datepick(); }
	if( document.getElementById("date_end") ){ $("#date_end").datepick();   }
	
	return;	

}
