function $jquery_site_wrapper($type)
{
	function $generate_random_string()
	{
		var $chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
		var $string_length = 8;
		var $randomstring = "";
		for (var $i = 0; $i < $string_length; $i++)
		{
			var $rnum = Math.floor(Math.random() * $chars.length);
			$randomstring += $chars.substring($rnum, $rnum + 1);
		}
		return $randomstring;
	}
	$advocate = false;
	if (typeof($type) == "undefined")
	{
		$type = "";
	}
	switch ($type)
	{
		case "other":
			$("a").each(function()
			{
				if ($(this).attr("class") == "tn_link" && $(this).text() == "Login")
				{
					$(this).click(function()
					{
						$(this).parent().parent().css({marginLeft: "-90px"});
						$(this).parent().parent().addClass("tn_shift");
						$(this).parent().parent().next().fadeIn("fast");
					});
				}
				else if ($(this).attr("class") == "btn-close" || $(this).attr("class") == "btn-explore-ideas")
				{
					$(this).click(function()
					{
						if ($(this).parent().parent().attr("id") == "overlay")
						{
							$("#overlay").fadeOut("fast");
							$("div.overlay-alt").fadeOut("fast");
							$("div.lv_transparent_layer").hide();
						}
						else
						{
							$("div.overlay-alt").fadeOut("fast");
						}
					});
				}
				else if ($(this).attr("class") == "btn-submit-ideas")
				{
					$(this).click(function()
					{
						if ($(this).parent().parent().attr("id") == "overlay")
						{
							$("#overlay").fadeOut("fast");
							$("div.overlay-alt").fadeOut("fast");
							$("div.lv_transparent_layer").hide();
						}
						else
						{
							$("div.overlay-alt").fadeOut("fast");
						}
						document.location = "/submit-idea/";
					});
				}
                else if ($(this).attr("class") == "eng-story")
				{
					$(this).click(function()
					{
						if ($(this).parent().parent().attr("id") == "overlay")
						{
							$("#overlay").fadeOut("fast");
							$("div.overlay-alt").fadeOut("fast");
							$("div.lv_transparent_layer").hide();
						}
						else
						{
							$("div.overlay-alt").fadeOut("fast");
						}
                        document.location = "/engineering-stories/";
					});
				}
				else if ($(this).attr("class") == "eng-profile")
				{
					$(this).click(function()
					{
						if ($(this).parent().parent().attr("id") == "overlay")
						{
							$("#overlay").fadeOut("fast");
							$("div.overlay-alt").fadeOut("fast");
							$("div.lv_transparent_layer").hide();
						}
						else
						{
							$("div.overlay-alt").fadeOut("fast");
						}
						document.location = "/meet-engineers/";
					});
				}
				else if ($(this).attr("class") == "screen-intro")
				{
					$(this).click(function()
					{
						$($(this).parent().parent().parent().parent().parent().children().get(1)).fadeIn("fast");
						pageTracker._trackEvent("Videos", 'Clicked', "Campaign Introduction");
					});
				}
				else if ($(this).attr("class") == "site-intro")
				{
					$(this).click(function()
					{
						$($(this).parent().parent().parent().parent().parent().children().get(2)).fadeIn("fast");
						pageTracker._trackEvent("Videos", 'Clicked', "Website Explained");
					});
				}
				else if ($(this).attr("class") == "btn-continue")
				{
					$(this).click(function()
					{
						$("div.dialog-wrapper").hide();
						if ($is_ok)
						{
							$("div.lv_transparent_layer").fadeOut("fast");
						}
						$id = $("div#report_dialog_id").text();
						$json_string = "$json = {ajax: true, pg: " + parseInt($("div.lv_paging_box_on").html());
						if ($("#filter_allideas").val() == "true")
						{
							$json_string += ", all: \"\"";
						}
						else if ($("#filter_mostpopular").val() == "true")
						{
							$json_string += ", mostpopular: \"\"";
						}
						else if ($("#filter_mostrecent").val() == "true")
						{
							$json_string += ", mostrecent: \"\"";
						}
						if ($("#filter_discipline").val() != "" && $("#filter_discipline").val() != "none")
						{
							$json_string += ", discipline: \"" + $("#filter_discipline").val() + "\"";
						}
						if ($("#filter_keywords").val() != "" && $("#filter_keywords").val() != "Search")
						{
							$json_string += ", keywords: \"" + $("#filter_keywords").val() + "\"";
						}
						$json_string += "}";				
						eval($json_string);
						$("div#reportidea_" + $id).parent().html("<div class=\"lv_loader_container\"><img src=\"/wp-content/themes/oe/images/list_view_loader.gif\" class=\"lv_loader\" /></div>");
						$.post("/wp-content/themes/oe/ajax_report_idea.php", {id: $id}, function()
						{
							$.get("/wp-content/themes/oe/page_idea_list_view.php", $json, function(html)
							{
								$("div.lv_parent_container").get(0).innerHTML = html;
								$jquery_site_wrapper("listview");
							});
						});
					});
				}
				else if ($(this).attr("class") == "btn-cancel")
				{
					$(this).click(function()
					{
						$("div.dialog-wrapper").hide();
						$("div.lv_transparent_layer").fadeOut("fast");
					});
				}
			});
		break;
		case "header":
			$("div").each(function()
			{
				if ($(this).attr("class") == "tn_cross_icon_off")
				{
					if ($(this).parent().prev().html().match(/tn_invisible_submit/))
					{
						$(this).click(function()
						{
							$(this).parent().parent().parent().parent().prev().css({marginLeft: "0px"});
							$(this).parent().parent().parent().parent().prev().removeClass("tn_shift");
							$(this).parent().parent().parent().parent().fadeOut("fast");
						});
					}
				}
				else if ($(this).attr("class") == "tn_item_container")
				{
					$(this).click(function()
					{
						switch ($($($(this).children().get(1)).children().get(0)).attr("class"))
						{
							case "tn_cross_icon_on":
							case "tn_cross_icon_on_alt":
								document.location = "/logout/";
							break;
							case "tn_profile_icon_on":
							case "tn_profile_icon_on_alt":
								document.location = "/update-details/";
							break;
							case "tn_help_icon_on":
							case "tn_help_icon_on_alt":
								document.location = "/explore-ideas/list/index.php?induction=y";
							break;
							case "tn_arrow_left_icon_on":
								if ($($(this).parent().parent().next().next().get(0)).css("display") == "none")
								{
									$($($(this).children().get(1)).children().get(0)).attr("class", "tn_arrow_down_icon_on");
									$(this).parent().parent().next().hide();
									$(this).parent().parent().next().next().slideDown("fast");
									$(document.body).bind("mouseup", $tn_dropdown_handler);
								}
							break;
							case "tn_arrow_left_icon_on_alt":
								if ($($(this).parent().parent().next().next().get(0)).css("display") == "none")
								{
									$($($(this).children().get(1)).children().get(0)).attr("class", "tn_arrow_down_icon_on_alt");
									$(this).parent().parent().next().hide();
									$(this).parent().parent().next().next().slideDown("fast");
									$(document.body).bind("mouseup", $tn_dropdown_handler);
								}
							break;
						}
					});
					$(this).hover(function()
					{
						switch ($($($(this).parent().parent().prev().children().get(0)).children().get(0)).attr("class"))
						{
							case "tn_your_weekly_ranking_label":
								$($($(this).children().get(1)).children().get(0)).attr("class", $($($(this).children().get(1)).children().get(0)).attr("class").replace("_off", "_on"));
							break;
							case "tn_your_in_top100_label":
								$($($(this).children().get(1)).children().get(0)).attr("class", $($($(this).children().get(1)).children().get(0)).attr("class").replace("_off", "_on_alt"));
							break;
						}
					}, function()
					{
						$($($(this).children().get(1)).children().get(0)).attr("class", $($($(this).children().get(1)).children().get(0)).attr("class").replace("_on_alt", "_off"));
						$($($(this).children().get(1)).children().get(0)).attr("class", $($($(this).children().get(1)).children().get(0)).attr("class").replace("_on", "_off"));
					});
				}
				else if ($(this).attr("class").match(/tn_message_[1|4]$/))
				{
					$base = $(this);
					setTimeout(function()
					{
						$base.next().hide();
						$base.fadeIn("slow");
						setTimeout(function()
						{
							$base.hide();
							$base.next().fadeIn("slow");
						}, 15000);
					}, 15000);
				}
			});
		break;
		case "listview":
			$("div").each(function()
			{
				if ($(this).attr("class") == "home_transparent_layer")
				{
					$(this).get(0).style.opacity = 0.6;
					if (document.all && !window.opera)
					{
						$(this).get(0).style.filter = "alpha(opacity=60)";
					}
				}
				else if ($(this).attr("class") == "lv_transparent_layer")
				{
					$(this).get(0).style.opacity = 0.6;
					if (document.all && !window.opera)
					{
						$(this).get(0).style.filter = "alpha(opacity=60)";
					}
                    try {
					$(this).get(0).style.width = $("div.lv_parent_container").get(0).offsetWidth + "px";
					$(this).get(0).style.height = $("div.lv_parent_container").get(0).offsetHeight + "px";
                    } catch (err) {
//                        alert(err);
                    }
				}
				else if ($(this).attr("class").match(/lv_col_[1|2|3|4]_off$/) || $(this).attr("class").match(/lv_col_[1|2|3|4]_off_alt$/))
				{
					$(this).click(function()
					{
						if ($(this).attr("class").match(/_off/))
						{
							$(this).parent().hide();
							$("div.lv_col_1_on").each(function()
							{
								if ($(this).parent().css("display") == "block")
								{
									/*$index = $(this).parent().children().length - 1;
									if ($($($($($($(this).parent().children().get($index)).children().get(1)).children().get(0)).children().get(0)).children().get(6)).next().get(0).style.display != "none")
									{
										$($($($($($(this).parent().children().get($index)).children().get(1)).children().get(0)).children().get(0)).children().get(6)).children().each(function()
										{
											$(this).attr("class", "lv_large_circle");
										});										
										$($($($($($(this).parent().children().get($index)).children().get(1)).children().get(0)).children().get(0)).children().get(6)).next().hide();
										$($($($($($($($(this).parent().children().get($index)).children().get(1)).children().get(0)).children().get(0)).children().get(6)).next().children().get(2)).children().get(0)).attr("class", "lv_rating_captcha_input_off")
									}*/
									$(this).parent().slideToggle("fast");
									$(this).parent().prev().slideToggle("fast");
								}
							});
							$(this).parent().next().slideToggle("fast");
						}
					});
				}
				else if ($(this).attr("id").match(/approveidea_/))
				{
					$(this).click(function()
					{
						$(this).parent().html("<div class=\"lv_loader_container\"><img src=\"/wp-content/themes/oe/images/list_view_loader.gif\" /></div>");
						$id = $(this).attr("id").split("_")[1];
						$.post("/wp-content/themes/oe/ajax_approve_idea.php", {id: $id}, function(post_id)
						{
							if ($("#userloggedin").text() == "true")
							{
								$.get("/wp-content/themes/oe/header.php", {ajax: true}, function(html)
								{
									$("div.tn_main_container").get(0).innerHTML = html;
									$jquery_site_wrapper("header");
								});
							}
							$json_string = "$json = {ajax: true, pg: " + parseInt($("div.lv_paging_box_on").html());
							if ($("#filter_allideas").val() == "true")
							{
								$json_string += ", all: \"\"";
							}
							else if ($("#filter_mostpopular").val() == "true")
							{
								$json_string += ", mostpopular: \"\"";
							}
							else if ($("#filter_mostrecent").val() == "true")
							{
								$json_string += ", mostrecent: \"\"";
							}
							if ($("#filter_discipline").val() != "" && $("#filter_discipline").val() != "none")
							{
								$json_string += ", discipline: \"" + $("#filter_discipline").val() + "\"";
							}
							if ($("#filter_keywords").val() != "" && $("#filter_keywords").val() != "Search")
							{
								$json_string += ", keywords: \"" + $("#filter_keywords").val() + "\"";
							}
							$json_string += "}";				
							eval($json_string);
							$.get("/wp-content/themes/oe/page_idea_list_view.php", $json, function(html)
							{
								$("div.lv_parent_container").get(0).innerHTML = html;
								$jquery_site_wrapper("listview");
							});
						});
					});
				}
				else if ($(this).attr("id").match(/reportidea_/))
				{
					$(this).click(function()
					{
						$id = $(this).attr("id").split("_")[1];
						$("div.lv_transparent_layer").show();
						$("div#report_dialog_id").text($id);
						$(this).parent().parent().parent().parent().prev().prev().show();
					});
				}
				else if ($(this).attr("class").match(/lv_rate_tab_/) || $(this).attr("class").match(/lv_categorize_tab_/) || $(this).attr("class").match(/lv_comment_tab_/) || $(this).attr("class").match(/lv_share_tab_/) || $(this).attr("class").match(/lv_follow_tab_/))
				{
					$(this).click(function()
					{
						$advocate = false;
						$(this).parent().find("div").each(function()
						{
							if ($(this).attr("class").match(/lv_categorize_tab_/))
							{
								$advocate = true;
							}
						});
						if ($(this).attr("class").match(/lv_rate_tab_/))
						{
							$index = 0;
						}
						else if ($(this).attr("class").match(/lv_categorize_tab_/))
						{
							$index = 1;
						}
						else if ($(this).attr("class").match(/lv_comment_tab_/))
						{
							if ($advocate)
							{
								$index = 2;
							}
							else
							{
								$index = 1;
							}
						}
						else if ($(this).attr("class").match(/lv_share_tab_/))
						{
							if ($advocate)
							{
								$index = 3;
							}
							else
							{
								$index = 2;
							}
						}
						else if ($(this).attr("class").match(/lv_follow_tab_/))
						{
							if ($advocate)
							{
								$index = 4;
							}
							else
							{
								$index = 3;
							}
						}
						if ($(this).attr("class").match(/_off/))
						{
							$(this).parent().children().each(function()
							{
								$(this).attr("class", $(this).attr("class").replace(/_on/, "_off"));
							});
							$(this).attr("class", $(this).attr("class").replace(/_off/, "_on"));
							$(this).parent().next().children().each(function()
							{
								$(this).hide();
							});
							$($(this).parent().next().children().get($index)).show();
							if ($($(this).children().get(0)).text() != "0" && $(this).attr("class").match(/lv_comment_tab_/))
							{
								$nbase = $($($($(this).parent().next().children().get($index)).children()).get(0));
								$base = $nbase.find("div.lv_comment_arrow_right");
								if ($base.length == 1)
								{
	                                if ($base.parent().next().next().html().match(/list_view_comment_loader.gif/))
									{
										$post_id = $(this).parent().parent().parent().attr("id").split("_")[1];
										$.post("/wp-content/themes/oe/ajax_get_comment.php", {post_id: $post_id}, function($json)
										{
											$base.parent().next().next().html("<span class=\"lv_comment_author_text\">" + $json.author + ": </span>" + $json.content + "&nbsp;&nbsp;&nbsp;<span class=\"lv_comment_timestamp_text\">" + $json.timestamp + "</span>");
											$($base.parent().children().get(0)).html($json.prev);
											$($base.parent().children().get(1)).html($json.next);
											$($base.parent().children().get(3)).html("1 of " + $json.total)
											if ($($base.parent().children().get(0)).html() != "0")
											{
												$($base.parent().children().get(2)).attr("class", $($base.parent().children().get(2)).attr("class").replace(/arrow_left_off$/, "arrow_left"));
											}
											else
											{
												$($base.parent().children().get(2)).attr("class", $($base.parent().children().get(2)).attr("class").replace(/arrow_left$/, "arrow_left_off"));
											}
											if ($($base.parent().children().get(1)).html() != "0")
											{
												$($base.parent().children().get(4)).attr("class", $($base.parent().children().get(4)).attr("class").replace(/arrow_right_off$/, "arrow_right"));
											}
											else
											{
												$($base.parent().children().get(4)).attr("class", $($base.parent().children().get(4)).attr("class").replace(/arrow_right$/, "arrow_right_off"));
											}
										}, "json");
									}
								}
							}
						}
					});
				}
				else if ($(this).attr("class") == "lv_large_star" || $(this).attr("class") == "lv_large_circle")
				{
					$(this).hover(function()
					{
						if ($(this).parent().next().get(0).style.display == "none")
						{
							if ($(this).parent().attr("id") != "")
							{
								$index = $(this).parent().children().index(this);
								$(this).parent().children().each(function(i)
								{
									if ($index >= i)
									{
										$(this).attr("class", "lv_large_star");
									}
									else
									{
										$(this).attr("class", "lv_large_circle");
									}
									if ($index == i)
									{
										$(this).parent().parent().find("div.lv_rate_tip_" + (i + 1)).fadeIn("fast");
									}
									else
									{
										$(this).parent().parent().find("div.lv_rate_tip_" + (i + 1)).hide();
									}
								});
							}
						}
					},function()
					{
						if ($(this).parent().next().get(0).style.display == "none")
						{
							if ($(this).parent().attr("id") != "")
							{
								$index = $(this).parent().children().index(this);
								$(this).parent().children().each(function(i)
								{
									$(this).attr("class", "lv_large_circle");
									$(this).parent().parent().find("div.lv_rate_tip_" + (i + 1)).hide();
								});
							}
						}
					});
					$(this).click(function()
					{
						if ($(this).parent().parent().next().get(0).style.display == "none")
						{
							if ($(this).parent().next().length == 1)
							{
								$(this).parent().children().each(function(i)
								{
									$(this).parent().parent().find("div.lv_rate_tip_" + (i + 1)).hide();
								});
								$(this).parent().next().show();
								$($(this).parent().next().children().get(1)).html("<img src=\"/wp-content/themes/oe/ajax_rate_captcha.php?v=" + $generate_random_string() + "\" />");
							}
							else
							{
								if ($(this).parent().attr("id") != "")
								{
									$id = $(this).parent().attr("id").split("_")[1];
									$json_string = "$json = {ajax: true, id: " + $id;
									if ($("#filter_allideas").val() == "true")
									{
										$json_string += ", all: \"\"";
									}
									else if ($("#filter_mostpopular").val() == "true")
									{
										$json_string += ", mostpopular: \"\"";
									}
									else if ($("#filter_mostrecent").val() == "true")
									{
										$json_string += ", mostrecent: \"\"";
									}
									if ($("#filter_discipline").val() != "" && $("#filter_discipline").val() != "none")
									{
										$json_string += ", discipline: \"" + $("#filter_discipline").val() + "\"";
									}
									if ($("#filter_keywords").val() != "" && $("#filter_keywords").val() != "Search")
									{
										$json_string += ", keywords: \"" + $("#filter_keywords").val() + "\"";
									}
									$json_string += "}";
									eval($json_string);
									$value = $(this).parent().children().index(this) + 1;
									$(this).parent().parent().next().show();
									$(this).parent().parent().next().html("<img src=\"/wp-content/themes/oe/images/list_view_rating_loader.gif\" />");
									$.post("/wp-content/themes/oe/ajax_rate_idea.php", {id : $id, value : $value}, function()
									{
										if ($("#userloggedin").text() == "true")
										{
											$.get("/wp-content/themes/oe/header.php", {ajax: true}, function(html)
											{
												$("div.tn_main_container").get(0).innerHTML = html;
												$jquery_site_wrapper("header");
											});
										}
										$.get("/wp-content/themes/oe/page_idea_list_view.php", $json, function(html)
										{
											$("div.lv_parent_container").get(0).innerHTML = html;
											$jquery_site_wrapper("listview");
										});
									});
								}
							}
						}
					});
				}
				else if ($(this).attr("id").match(/submitrating_/))
				{
					$(this).click(function()
					{
						$(this).parent().parent().hide();
						$(this).parent().parent().next().show();
						$id = $(this).attr("id").split("_")[1];
						$value = 0;
						$captcha = $("#ratingcaptcha_" + $id).val();
						$(this).parent().parent().prev().children().each(function()
						{
							if ($(this).attr("class") == "lv_large_star")
							{
								$value++;
							}
						});
						$base = $(this);
						$.post("/wp-content/themes/oe/ajax_rate_idea.php", {id : $id, value : $value, captcha: $captcha}, function($err)
						{
							if ($err == "true")
							{
								$base.parent().prev().prev().html("<img src=\"/wp-content/themes/oe/ajax_rate_captcha.php?v=" + $generate_random_string() + "\" />");
								$($base.parent().prev().children().get(0)).attr("class", "lv_rating_captcha_input_on");
								$base.parent().parent().show();
								$base.parent().parent().next().hide();
							}
							else
							{
								$json_string = "$json = {ajax: true, id: " + $id;
								if ($("#filter_allideas").val() == "true")
								{
									$json_string += ", all: \"\"";
								}
								else if ($("#filter_mostpopular").val() == "true")
								{
									$json_string += ", mostpopular: \"\"";
								}
								else if ($("#filter_mostrecent").val() == "true")
								{
									$json_string += ", mostrecent: \"\"";
								}
								if ($("#filter_discipline").val() != "" && $("#filter_discipline").val() != "none")
								{
									$json_string += ", discipline: \"" + $("#filter_discipline").val() + "\"";
								}
								if ($("#filter_keywords").val() != "" && $("#filter_keywords").val() != "Search")
								{
									$json_string += ", keywords: \"" + $("#filter_keywords").val() + "\"";
								}
								$json_string += "}";
								eval($json_string);
								$.get("/wp-content/themes/oe/page_idea_list_view.php", $json, function(html)
								{
									$("div.lv_parent_container").get(0).innerHTML = html;
									$jquery_site_wrapper("listview");
								});
							}
						});
					});
				}
				else if ($(this).attr("class").match(/lv_share_icon_[2|3|4]_off/))
				{
					$(this).hover(function()
					{
						$(this).attr("class", $(this).attr("class").replace("_off", "_on"));
					}, function()
					{
						$(this).attr("class", $(this).attr("class").replace("_on", "_off"));
					});
					$(this).click(function()
					{
						$id = $(this).attr("id").split("_")[1];
						$network = $(this).attr("id").split("_")[0].replace("share", "");
						$title = $($(this).parent().parent().parent().parent().parent().parent().children().get(1)).text().replace(/\t|\r|\n/g, "");
						$url = window.location;
						$newurl = $(this).parent().prev().html();
						switch ($network)
						{
							case "facebook":
								$.get("/wp-content/themes/oe/ajax_share_idea.php", {id: $id, type: $network}, function()
								{
									if ($("#userloggedin").text() == "true")
									{
										$.get("/wp-content/themes/oe/header.php", {ajax: true}, function(html)
										{
											$("div.tn_main_container").get(0).innerHTML = html;
											$jquery_site_wrapper("header");
										});
									}
								});
								window.open("http://www.facebook.com/sharer.php?u=" + $newurl + "&t=Vote for this Make it so idea");
							break;
							case "twitter":
								$.get("/wp-content/themes/oe/ajax_share_idea.php", {id: $id, type: $network}, function()
								{
									if ($("#userloggedin").text() == "true")
									{
										$.get("/wp-content/themes/oe/header.php", {ajax: true}, function(html)
										{
											$("div.tn_main_container").get(0).innerHTML = html;
											$jquery_site_wrapper("header");
										});
									}
								});
								window.open("http://twitter.com/home?status=Vote%20for%20this%20%23make_it_so%20idea%20-%20" + $newurl);
							break;
							case "linkedin":
								$.get("/wp-content/themes/oe/ajax_share_idea.php", {id: $id, type: $network}, function()
								{
									if ($("#userloggedin").text() == "true")
									{
										$.get("/wp-content/themes/oe/header.php", {ajax: true}, function(html)
										{
											$("div.tn_main_container").get(0).innerHTML = html;
											$jquery_site_wrapper("header");
										});
									}
								});
								window.open("http://www.linkedin.com/shareArticle?mini=true&url=" + $newurl + "&title=Vote for this Make it so idea&source=Engineers Australia: Make it So");
							break;
						}
					});
				}
				else if ($(this).attr("class") == "lv_comment_arrow_left" || $(this).attr("class") == "lv_comment_arrow_left_off" || $(this).attr("class") == "lv_comment_arrow_right" || $(this).attr("class") == "lv_comment_arrow_right_off")
				{
					$(this).click(function()
					{
						if (($(this).attr("class") == "lv_comment_arrow_left" || $(this).attr("class") == "lv_comment_arrow_right") && !$(this).parent().next().next().html().match(/list_view_comment_loader.gif/))
						{
							if ($(this).attr("class") == "lv_comment_arrow_left")
							{
								$id = $($(this).parent().children().get(0)).html();
							}
							else
							{
								$id = $($(this).parent().children().get(1)).html();
							}
							$(this).parent().next().next().html("<img src=\"/wp-content/themes/oe/images/list_view_comment_loader.gif\" />");
							$base = $(this);
							$.post("/wp-content/themes/oe/ajax_get_comment.php", {id: $id}, function($json)
							{
								$base.parent().next().next().html("<span class=\"lv_comment_author_text\">" + $json.author + ": </span>" + $json.content + "&nbsp;&nbsp;&nbsp;<span class=\"lv_comment_timestamp_text\">" + $json.timestamp + "</span>");
								$($base.parent().children().get(0)).html($json.prev);
								$($base.parent().children().get(1)).html($json.next);
								$string = $($base.parent().children().get(3)).html();
								$array = $string.split(" ");
								if ($base.attr("class") == "lv_comment_arrow_left")
								{
									$position = parseInt($array[0]) - 1;
								}
								else
								{
									$position = parseInt($array[0]) + 1;
								}
								$($base.parent().children().get(3)).html($position + " of " + $json.total)
								if ($($base.parent().children().get(0)).html() != "0")
								{
									$($base.parent().children().get(2)).attr("class", $($base.parent().children().get(2)).attr("class").replace(/arrow_left_off$/, "arrow_left"));
								}
								else
								{
									$($base.parent().children().get(2)).attr("class", $($base.parent().children().get(2)).attr("class").replace(/arrow_left$/, "arrow_left_off"));
								}
								if ($($base.parent().children().get(1)).html() != "0")
								{
									$($base.parent().children().get(4)).attr("class", $($base.parent().children().get(4)).attr("class").replace(/arrow_right_off$/, "arrow_right"));
								}
								else
								{
									$($base.parent().children().get(4)).attr("class", $($base.parent().children().get(4)).attr("class").replace(/arrow_right$/, "arrow_right_off"));
								}
							}, "json");
						}
					});
				}
				else if ($(this).attr("id").match(/addcomment_/))
				{
					$(this).click(function()
					{
						$($(this).parent().children().get(0)).hide();
						$($(this).parent().children().get(1)).show();
						$($(this).parent().children().get(2)).show();
						$(this).parent().get(0).style.marginTop = "48px";
						$($(this).parent().prev().children().get(0)).show();
						if($(this).parent().prev().get(0))
						{
							$($(this).parent().prev().children().get(1)).hide();
						}
						if ($(this).parent().prev().prev().get(0))
						{
							$($(this).parent().prev().prev().get(0)).show();
						}
					});
				}
				else if ($(this).attr("id").match(/submitcomment_/))
				{
					$(this).click(function()
					{
						if($jquery_error_handler($(this).parent().parent().get(0)))
						{
							$($($($(this).parent().prev().children().get(0)).children().get(2)).children().get(0)).show();
							$($($($(this).parent().prev().children().get(0)).children().get(2)).children().get(1)).hide();
							$($($($(this).parent().prev().children().get(0)).children().get(2)).children().get(2)).hide();
							$base = $(this);
							$id = $(this).attr("id").split("_")[1];
							$name = escape($("#commentname_" + $id).val());
							$email = escape($("#commentemail_" + $id).val());
							$comment = escape($("#commentcontent_" + $id).val());
							$.post("/wp-content/themes/oe/ajax_submit_comment.php", {id: $id, name: $name, email: $email, comment: $comment}, function($json)
							{
								if ($json.result == "ok")
								{
									$.post("/wp-content/themes/oe/ajax_get_comment.php", {id: $json.id}, function($json)
									{
										$($($base.parent().prev().children().get(1)).children().get(2)).html("<span class=\"lv_comment_author_text\">" + $json.author + ": </span>" + $json.content);
										$($($($base.parent().prev().children().get(1)).children().get(0)).children().get(0)).html($json.prev);
										$($($($base.parent().prev().children().get(1)).children().get(0)).children().get(1)).html($json.next);
										$($($($base.parent().prev().children().get(1)).children().get(0)).children().get(3)).html($json.total + " of " + $json.total)
										if ($($($($base.parent().prev().children().get(1)).children().get(0)).children().get(0)).html() != "0")
										{
											$($($($base.parent().prev().children().get(1)).children().get(0)).children().get(2)).attr("class", $($($($base.parent().prev().children().get(1)).children().get(0)).children().get(2)).attr("class").replace(/arrow_left_off$/, "arrow_left"));
										}
										else
										{
											$($($($base.parent().prev().children().get(1)).children().get(0)).children().get(2)).attr("class", $($($($base.parent().prev().children().get(1)).children().get(0)).children().get(2)).attr("class").replace(/arrow_left$/, "arrow_left_off"));
										}
										if ($($($($base.parent().prev().children().get(1)).children().get(0)).children().get(1)).html() != "0")
										{
											$($($($base.parent().prev().children().get(1)).children().get(0)).children().get(4)).attr("class", $($($($base.parent().prev().children().get(1)).children().get(0)).children().get(4)).attr("class").replace(/arrow_right_off$/, "arrow_right"));
										}
										else
										{
											$($($($base.parent().prev().children().get(1)).children().get(0)).children().get(4)).attr("class", $($($($base.parent().prev().children().get(1)).children().get(0)).children().get(4)).attr("class").replace(/arrow_right$/, "arrow_right_off"));
										}
										$($($($base.parent().prev().children().get(0)).children().get(2)).children().get(0)).hide();
										$($($($base.parent().prev().children().get(0)).children().get(2)).children().get(1)).show();
										$($($($base.parent().prev().children().get(0)).children().get(2)).children().get(2)).show();
										$($base.parent().children().get(0)).show();
										$($base.parent().children().get(1)).hide();
										$($base.parent().children().get(2)).hide();
										$base.parent().get(0).style.marginTop = "64px";
										$($base.parent().prev().children().get(0)).hide();
										$($base.parent().prev().children().get(1)).show();
										if ($base.parent().prev().prev().get(0))
										{
											$($base.parent().prev().prev().get(0)).hide();
										}
									}, "json");
									if ($("#userloggedin").text() == "true")
									{
										$.get("/wp-content/themes/oe/header.php", {ajax: true}, function(html)
										{
											$("div.tn_main_container").get(0).innerHTML = html;
											$jquery_site_wrapper("header");
										});
									}
								}
								else
								{
									$($($($base.parent().prev().children().get(0)).children().get(2)).children().get(0)).hide();
									$($($($base.parent().prev().children().get(0)).children().get(2)).children().get(1)).show();
									switch ($json.result)
									{
										case "spam":
											$dialog = new $jquery_dialog_handler;
											$dialog.show({content: "Your comment has been marked as spam. If you feel this is an error please contact us at: makeitso@engineersaustralia.org.au", classname: "classname goes here", callback: function() {alert("ok button clicked");}});
										break;
									}
								}
							}, "json");
						}
						else
						{
							$($(this).parent().parent().get(0)).find("input").each(function()
							{
								if ($(this).val() == "")
								{
									$(this).val($(this).next().html());
								}
							});
							$($(this).parent().parent().get(0)).find("textarea").each(function()
							{
								if ($(this).val() == "")
								{
									$(this).val($(this).next().html());
								}
							});
						}
					});
				}
				else if ($(this).attr("id").match(/cancelcomment_/))
				{
					$(this).click(function()
					{
						$($($($(this).parent().prev().children().get(0)).children().get(2)).children().get(0)).hide();
						$($($($(this).parent().prev().children().get(0)).children().get(2)).children().get(1)).show();
						$($(this).parent().children().get(0)).show();
						$($(this).parent().children().get(1)).hide();
						$($(this).parent().children().get(2)).hide();
						$(this).parent().get(0).style.marginTop = "64px";
						$($(this).parent().prev().children().get(0)).hide();
						$($(this).parent().prev().children().get(1)).show();
						if ($(this).parent().prev().prev().get(0))
						{
							$($(this).parent().prev().prev().get(0)).hide();
						}
					});
				}
				else if ($(this).attr("id").match(/addfriend_/))
				{
					if (document.all && !window.opera)
					{
						$(this).get(0).style.marginTop = "10px";
					}
					$(this).click(function()
					{
						$id = $(this).attr("id").split("_")[1];
						$counter = parseInt($(this).prev().prev().html());
						$counter++;
						$(this).prev().prev().html($counter)
						$dom = $("<div class=\"lv_share_line_container\" style=\"display:none;\"><div class=\"lv_share_input_container_bottom\"><input id=\"share_firstname_" + $counter + "_" + $id + "\" class=\"lv_share_input_bottom\" type=\"text\" value=\"Friends First Name\"/></div><div class=\"lv_share_input_container_bottom\"><input id=\"share_lastname_" + $counter + "_" + $id + "\" class=\"lv_share_input_bottom\" type=\"text\" value=\"Friends Last Name\"/></div><div class=\"lv_share_input_container_bottom\"><input id=\"share_email_" + $counter + "_" + $id + "\" class=\"lv_share_input_bottom\" type=\"text\" value=\"Friends Email\"/></div><div class=\"float_clear\"></div></div>");
						$(this).prev().append($dom);
						$base = $(this);
						$(this).prev().find("div").each(function()
						{
							if ($(this).attr("class") == "lv_share_line_container")
							{
								if (this.style.display != "none" && this != $dom.get(0))
								{
									$(this).hide();
									$($base.next().children().get(0)).html($base.prev().prev().html() - 1);
									$($base.next().children().get(1)).html(0);
									$($($base.next().children().get(3)).children().get(0)).attr("class", "lv_share_arrow_up_on");
									$($($base.next().children().get(3)).children().get(1)).attr("class", "lv_share_arrow_down_off");
									$($($base.next().children().get(2)).children().get(0)).html($counter + " of " + $counter);
									$($($base.next().children().get(2)).children().get(0)).show();
									$dom.show();
								}
							}
						});
						$jquery_lv_share_wrapper();
					});
				}
				else if ($(this).attr("id").match(/previewemail_/))
				{
					$(this).click(function()
					{
						$id = $(this).attr("id").split("_")[1];
						window.open("/wp-content/themes/oe/pop_preview_email.php?id=" + $id, "pop_preview", "menubar=0,width=630,height=680");
					});
				}
				else if ($(this).attr("id").match(/submitemail_/))
				{
					$(this).click(function()
					{
						$id = $(this).attr("id").split("_")[1];
						$($($(this).parent().prev().children().get(0)).children().get(0)).hide();
						$($($(this).parent().prev().children().get(0)).children().get(1)).show();
						$count = 0;
						$json_string = "$json = {id: " + $id + ", type: \"email\", ";
						$(this).parent().parent().parent().find("input").each(function()
						{
							if ($count < 3)
							{
								switch ($count)
								{
									case 0:
										$json_string += "firstname_0: \"" + escape($(this).val()) + "\", ";
									break;
									case 1:
										$json_string += "lastname_0: \"" + escape($(this).val()) + "\", ";
									break;
									case 2:
										$json_string += "email_0: \"" + escape($(this).val()) + "\", ";
									break;
								}
							}
							else
							{
								if ($count == 3)
								{
									$i = 1;
								}
								if ($(this).attr("id").match(/firstname/))
								{
									$json_string += "firstname_" + $i + ": \"" + escape($(this).val()) + "\", ";
								}
								else if ($(this).attr("id").match(/lastname/))
								{
									$json_string += "lastname_" + $i + ": \"" + escape($(this).val()) + "\", ";
								}
								else if ($(this).attr("id").match(/email/))
								{
									$json_string += "email_" + $i + ": \"" + escape($(this).val()) + "\", ";
									$i++;
								}
							}
							$count++;
						});
						$json_string += "message: \"" + escape($($($(this).parent().prev().children().get(0)).children().get(0)).val()) + "\", ";
						$json_string = $json_string.slice(0, -2);
						$json_string += "}";
						eval($json_string);
						$base = $(this);
						$.post("/wp-content/themes/oe/ajax_share_idea.php", $json, function()
						{
							$base.parent().parent().hide();
							$base.parent().parent().next().show();
							$($($base.parent().prev().children().get(0)).children().get(0)).show();
							$($($base.parent().prev().children().get(0)).children().get(1)).hide();
							$($base.parent().parent().parent().children().get(0)).hide();
							$($base.parent().parent().parent().children().get(1)).show();
							if ($("#userloggedin").text() == "true")
							{
								$.get("/wp-content/themes/oe/header.php", {ajax: true}, function(html)
								{
									$("div.tn_main_container").get(0).innerHTML = html;
									$jquery_site_wrapper("header");
								});
							}
						});
					});
				}
				else if ($(this).attr("id").match(/submitidea_/))
				{
					$(this).click(function()
					{
						document.location = "/submit-idea/";
					});
				}
				else if ($(this).attr("id").match(/exploresimilar_/))
				{
					$(this).click(function()
					{	
						$id = $(this).attr("id").split("_")[1];
						document.location = "/explore-ideas/list/";
					});
				}
				else if ($(this).attr("id").match(/followidea_/))
				{
					$(this).click(function()
					{
						$(this).parent().parent().parent().hide();
						$($(this).parent().parent().parent().parent().prev().children().get(0)).attr("class", "lv_rate_tab_off");
						$index = $(this).parent().parent().parent().parent().prev().children().length - 2;
						$($(this).parent().parent().parent().parent().prev().children().get($index)).attr("class", $($(this).parent().parent().parent().parent().prev().children().get($index)).attr("class").replace("_off", "_on"));
						$($(this).parent().parent().parent().parent().children().get($index)).show();
					});
				}
				else if ($(this).attr("id").match(/submitfollow_/))
				{
					$(this).click(function()
					{
						$base = $(this);
						$(this).parent().parent().hide();
						$(this).parent().parent().prev().show();
						$id = $(this).attr("id").split("_")[1];
						$firstname = $("#follow_firstname_"+$id).val();
						$lastname = $("#follow_lastname_"+$id).val();
						$email = $("#follow_email_"+$id).val();
						$.post("/wp-content/themes/oe/ajax_follow_idea.php", {id:$id,firstname:$firstname,lastname:$lastname,email:$email}, function()
						{
							$base.parent().parent().prev().hide();
							$base.parent().parent().hide();
							$base.parent().parent().next().show();
							if ($("#userloggedin").text() == "true")
							{
								$.get("/wp-content/themes/oe/header.php", {ajax: true}, function(html)
								{
									$("div.tn_main_container").get(0).innerHTML = html;
									$jquery_site_wrapper("header");
								});
							}
						});
					});
				}
				else if ($(this).attr("id").match(/finish1_/) || $(this).attr("id").match(/finish2_/) || $(this).attr("id").match(/finish3_/))
				{
					$(this).click(function()
					{
						$(this).parent().parent().hide();
						$(this).parent().parent().prev().show();
					});
				}
				else if ($(this).attr("class") == "lv_share_arrow_up_off")
				{
					$(this).click(function()
					{
						if ($(this).attr("class") == "lv_share_arrow_up_on")
						{
							if (parseInt($($(this).parent().parent().children().get(0)).html()) > 0)
							{
								$($(this).parent().parent().children().get(1)).html(parseInt($($(this).parent().parent().children().get(0)).html()) + 1);
								$($(this).parent().parent().children().get(0)).html(parseInt($($(this).parent().parent().children().get(0)).html()) - 1);
								$current = parseInt($($(this).parent().parent().children().get(0)).html()) + 1;
								$total = $(this).parent().parent().prev().prev().prev().html();
								$($($(this).parent().parent().children().get(2)).children().get(0)).html($current + " of " + $total);
								if ($current == 1)
								{
									$($(this).parent().children().get(0)).attr("class", "lv_share_arrow_up_off");
								}
								$($(this).parent().children().get(1)).attr("class", "lv_share_arrow_down_on");
								$(this).parent().parent().prev().prev().find("div").each(function()
								{
									if ($(this).attr("class") == "lv_share_line_container")
									{
										$array = $($($(this).children().get(0)).children().get(0)).attr("id").split("_");
										if (parseInt($array[2]) == $current)
										{
											$(this).show();
										}
										else
										{
											$(this).hide();
										}
									}
								});
							}
						}
					});
				}
				else if ($(this).attr("class") == "lv_share_arrow_down_off")
				{
					$(this).click(function()
					{
						if ($(this).attr("class") == "lv_share_arrow_down_on")
						{
							if (parseInt($($(this).parent().parent().children().get(1)).html()) <= parseInt($(this).parent().parent().prev().prev().prev().html()))
							{
								$($(this).parent().parent().children().get(0)).html(parseInt($($(this).parent().parent().children().get(1)).html()) - 1);
								$($(this).parent().parent().children().get(1)).html(parseInt($($(this).parent().parent().children().get(1)).html()) + 1);
								$current = parseInt($($(this).parent().parent().children().get(1)).html()) - 1;
								$total = $(this).parent().parent().prev().prev().prev().html();
								$($($(this).parent().parent().children().get(2)).children().get(0)).html($current + " of " + $total);
								$($(this).parent().children().get(0)).attr("class", "lv_share_arrow_up_on");
								if ($current == parseInt($total))
								{
									$($(this).parent().children().get(1)).attr("class", "lv_share_arrow_down_off");
								}
								$(this).parent().parent().prev().prev().find("div").each(function()
								{
									if ($(this).attr("class") == "lv_share_line_container")
									{
										$array = $($($(this).children().get(0)).children().get(0)).attr("id").split("_");
										if (parseInt($array[2]) == $current)
										{
											$(this).show();
										}
										else
										{
											$(this).hide();
										}
									}
								});
							}
						}
					});
				}
				else if ($(this).attr("class") == "lv_paging_box_off")
				{
					$(this).click(function()
					{
						if ($(this).html().indexOf("Previous") != -1)
						{
							$pg = parseInt($("div.lv_paging_box_on").html()) - 1;
						}
						else if ($(this).html().indexOf("Next") != -1)
						{
							$pg = parseInt($("div.lv_paging_box_on").html()) + 1;
						}
						else
						{
							$pg = parseInt($(this).html());
						}
						$json_string = "$json = {ajax: true, pg: " + $pg;
						if ($("#filter_allideas").val() == "true")
						{
							$json_string += ", all: \"\"";
						}
						else if ($("#filter_mostpopular").val() == "true")
						{
							$json_string += ", mostpopular: \"\"";
						}
						else if ($("#filter_mostrecent").val() == "true")
						{
							$json_string += ", mostrecent: \"\"";
						}
						if ($("#filter_discipline").val() != "" && $("#filter_discipline").val() != "none")
						{
							$json_string += ", discipline: \"" + $("#filter_discipline").val() + "\"";
						}
						if ($("#filter_keywords").val() != "" && $("#filter_keywords").val() != "Search")
						{
							$json_string += ", keywords: \"" + $("#filter_keywords").val() + "\"";
						}
						$json_string += "}";
						eval($json_string);
						$("div.lv_parent_container").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/list_view_page_loader.gif\" /></div>");
						$.get("/wp-content/themes/oe/page_idea_list_view.php", $json, function(html)
						{
							$("div.lv_parent_container").html(html);
							$jquery_site_wrapper("listview");
						});
					});
				}
				else if ($(this).attr("class") == "lv_filter_keyword_button")
				{
					$(this).click(function()
					{
						$json_string = "$json = {ajax: true";
						if ($("#filter_allideas").val() == "true")
						{
							$json_string += ", all: \"\"";
						}
						else if ($("#filter_mostpopular").val() == "true")
						{
							$json_string += ", mostpopular: \"\"";
						}
						else if ($("#filter_mostrecent").val() == "true")
						{
							$json_string += ", mostrecent: \"\"";
						}
						if ($("#filter_discipline").val() != "" && $("#filter_discipline").val() != "none")
						{
							$json_string += ", discipline: \"" + $("#filter_discipline").val() + "\"";
						}
						if ($("#filter_keywords").val() != "" && $("#filter_keywords").val() != "Search")
						{
							$json_string += ", keywords: \"" + $("#filter_keywords").val() + "\"";
						}
						$json_string += "}";
						eval($json_string);
						$("div.lv_parent_container").prev().prev().prev().fadeOut("fast");
						$("div.lv_parent_container").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/list_view_page_loader.gif\" /></div>");
						$.get("/wp-content/themes/oe/page_idea_list_view.php", $json, function(html)
						{
							$("div.lv_parent_container").get(0).innerHTML = html;
							$jquery_site_wrapper("listview");
						});
					});
				}
				else if ($(this).attr("class") == "lv_filter_option_container")
				{
					$(this).click(function()
					{
						$("div.lv_filter_option_container").each(function()
						{
							$($(this).children().get(0)).attr("class", "lv_filter_option_left_off");
							$($(this).children().get(1)).attr("class", "lv_filter_option_right_off");
							$($(this).children().get(2)).val("false");
						});
						$($(this).children().get(0)).attr("class", "lv_filter_option_left_on");
						$($(this).children().get(1)).attr("class", "lv_filter_option_right_on");
						$($(this).children().get(2)).val("true");
					});
				}
				else if ($(this).attr("class") == "lv_filter_select_left" || $(this).attr("class") == "lv_filter_select_right")
				{
					$(this).click(function()
					{
						$(this).parent().next().show();
						$(document.body).bind("mouseup", $lv_filter_select_handler);
					});
				}
				else if ($(this).attr("class") == "lv_filter_select_menu_item_off")
				{
					$(this).hover(function()
					{
						$("div.lv_filter_select_menu_item_on").attr("class", "lv_filter_select_menu_item_off");
						$(this).attr("class", "lv_filter_select_menu_item_on");
					});
					$(this).click(function()
					{
						if ($(this).text() == "-- None --")
						{
							$($(this).parent().prev().children().get(1)).html("Select One...");
							$($(this).parent().prev().children().get(3)).val("");
						}
						else
						{
							$($(this).parent().prev().children().get(1)).html($(this).text());
							$($(this).parent().prev().children().get(3)).val($($(this).find("input").get(0)).val());
						}
					});
				}
				else if ($(this).attr("class") == "lv_filter_update_button")
				{
					$(this).click(function()
					{
						$json_string = "$json = {ajax: true";
						if ($("#filter_allideas").val() == "true")
						{
							$json_string += ", all: \"\"";
						}
						else if ($("#filter_mostpopular").val() == "true")
						{
							$json_string += ", mostpopular: \"\"";
						}
						else if ($("#filter_mostrecent").val() == "true")
						{
							$json_string += ", mostrecent: \"\"";
						}
						if ($("#filter_discipline").val() != "")
						{
							$json_string += ", discipline: \"" + $("#filter_discipline").val() + "\"";
						}
						if ($("#filter_keywords").val() != "" && $("#filter_keywords").val() != "Search")
						{
							$json_string += ", keywords: \"" + $("#filter_keywords").val() + "\"";
						}
						$json_string += "}";
						eval($json_string);
						$("div.lv_parent_container").prev().prev().prev().fadeOut("fast");
						$("div.lv_parent_container").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/list_view_page_loader.gif\" /></div>");
						$.get("/wp-content/themes/oe/page_idea_list_view.php", $json, function(html)
						{
							$("div.lv_parent_container").get(0).innerHTML = html;
							$jquery_site_wrapper("listview");
						});
					});
				}
				else if ($(this).attr("class") == "lv_filter_cancel_button")
				{
					$(this).click(function()
					{				
						if ($filter_allideas == "true")
						{
							$("#filter_allideas").val("true");
							$("#filter_allideas").prev().prev().attr("class", "lv_filter_option_left_on");
							$("#filter_allideas").prev().attr("class", "lv_filter_option_right_on");
						}
						else
						{
							$("#filter_allideas").val("false");
							$("#filter_allideas").prev().prev().attr("class", "lv_filter_option_left_off");
							$("#filter_allideas").prev().attr("class", "lv_filter_option_right_off");
						}
						if ($filter_mostpopular == "true")
						{
							$("#filter_mostpopular").val("true");
							$("#filter_mostpopular").prev().prev().attr("class", "lv_filter_option_left_on");
							$("#filter_mostpopular").prev().attr("class", "lv_filter_option_right_on");
						}
						else
						{
							$("#filter_mostpopular").val("false");
							$("#filter_mostpopular").prev().prev().attr("class", "lv_filter_option_left_off");
							$("#filter_mostpopular").prev().attr("class", "lv_filter_option_right_off");
						}
						if ($filter_mostrecent == "true")
						{
							$("#filter_mostrecent").val("true");
							$("#filter_mostrecent").prev().prev().attr("class", "lv_filter_option_left_on");
							$("#filter_mostrecent").prev().attr("class", "lv_filter_option_right_on");
						}
						else
						{
							$("#filter_mostrecent").val("false");
							$("#filter_mostrecent").prev().prev().attr("class", "lv_filter_option_left_off");
							$("#filter_mostrecent").prev().attr("class", "lv_filter_option_right_off");
						}
						$("div.lv_filter_select_menu_item_on").attr("class", "lv_filter_select_menu_item_off");
						if ($filter_discipline != "")
						{
							$("#filter_discipline").val($filter_discipline);
							switch ($filter_discipline)
							{
								case "biomedical-college":
									$("#filter_discipline").prev().prev().text("Biomedical Engineering");
								break;
								case "chemical-college":
									$("#filter_discipline").prev().prev().text("Chemical Engineering");
								break;
								case "civil-college":
									$("#filter_discipline").prev().prev().text("Civil Engineering");
								break;
								case "electrical-college":
									$("#filter_discipline").prev().prev().text("Electrical Engineering");
								break;
								case "environmental-college":
									$("#filter_discipline").prev().prev().text("Environmental Engineering");
								break;
								case "information-telecommunications-and-electronics-engineering-college":
									$("#filter_discipline").prev().prev().text("Information & Telecommunications");
								break;
								case "mechanical-college":
									$("#filter_discipline").prev().prev().text("Mechanical Engineering");
								break;
								case "structural-college":
									$("#filter_discipline").prev().prev().text("Structural Engineering");
								break;
							}
						}
						else
						{
							$("#filter_discipline").val("");
							$("#filter_discipline").prev().prev().text("Select One...");
						}
						$(this).parent().parent().parent().slideUp("fast");
						$(this).parent().parent().parent().parent().parent().prev().prev().prev().fadeOut("fast");
					});
				}
				else if ($(this).attr("id").match(/submittags_/))
				{
					$(this).click(function()
					{
						$id = $(this).attr("id").split("_")[1];
						$array = $("textarea.lv_categorize_textarea").val().split(",");
						$keywords = "";
						$total_words = 0;
						for (var $i = 0; $i < $array.length; $i++)
						{
							if ($array[$i] != "")
							{
								$keywords += $array[$i].replace(/^\s*(.*?)\s*$/,"$1") + ",";
								$total_words++;
								if ($total_words == 20)
								{
									break;
								}
							}
						}
						$keywords = $keywords.slice(0, -1);
						$categories = "";
						$(this).parent().parent().find("div").each(function()
						{
					        switch ($(this).attr("class"))
					        {
					        	case "lv_categorize_box1_on":
					        		$categories += "15,"
					        	break;
					        	case "lv_categorize_box2_on":
					        		$categories += "17,"
					        	break;
					        	case "lv_categorize_box3_on":
					        		$categories += "19,"
					        	break;
					        	case "lv_categorize_box4_on":
					        		$categories += "21,"
					        	break;
					        	case "lv_categorize_box5_on":
					        		$categories += "23,"
					        	break;
					        	case "lv_categorize_box6_on":
					        		$categories += "25,"
					        	break;
					        	case "lv_categorize_box7_on":
					        		$categories += "27,"
					        	break;
					        	case "lv_categorize_box8_on":
					        		$categories += "29,"
					        	break;
					        }
						});
						$categories = $categories.slice(0, -1);
						$(this).parent().parent().hide();
						$(this).parent().parent().prev().show();
						$base = $(this);
						$.post("/wp-content/themes/oe/ajax_tag_idea.php", {id: $id,categories: $categories, keywords: $keywords}, function()
						{
							$base.parent().parent().prev().hide();
							$base.parent().parent().next().show();
							if ($("#userloggedin").text() == "true")
							{
								$.get("/wp-content/themes/oe/header.php", {ajax: true}, function(html)
								{
									$("div.tn_main_container").get(0).innerHTML = html;
									$jquery_site_wrapper("header");
								});
							}
						});
					});
				}
		        switch ($(this).attr("class"))
		        {
		        	case "lv_categorize_box1_off":
		        	case "lv_categorize_box2_off":
		        	case "lv_categorize_box3_off":
		        	case "lv_categorize_box4_off":
		        	case "lv_categorize_box5_off":
		        	case "lv_categorize_box6_off":
		        	case "lv_categorize_box7_off":
		        	case "lv_categorize_box8_off":
		        	case "lv_categorize_box1_on":
		        	case "lv_categorize_box2_on":
		        	case "lv_categorize_box3_on":
		        	case "lv_categorize_box4_on":
		        	case "lv_categorize_box5_on":
		        	case "lv_categorize_box6_on":
		        	case "lv_categorize_box7_on":
		        	case "lv_categorize_box8_on":
		        		$(this).hover(function()
		        		{
							if ($(this).attr("class").match(/_off$/))
							{
								$(this).attr("class", $(this).attr("class").replace(/_off$/, "_off_over"));
							}
							else if ($(this).attr("class").match(/_on$/))
							{
								$(this).attr("class", $(this).attr("class").replace(/_on$/, "_on_over"));
							}
		        		}, function()
		        		{
							if ($(this).attr("class").match(/_off_over$/))
							{
								$(this).attr("class", $(this).attr("class").replace(/_off_over$/, "_off"));
							}
							else if ($(this).attr("class").match(/_on_over$/))
							{
								$(this).attr("class", $(this).attr("class").replace(/_on_over$/, "_on"));
							}
		        		});
		        		$(this).click(function()
		        		{
							if ($(this).attr("class").match(/_off_over$/))
							{
								$(this).attr("class", $(this).attr("class").replace(/_off_over$/, "_on"));
							}
							else if ($(this).attr("class").match(/_on_over$/))
							{
								$(this).attr("class", $(this).attr("class").replace(/_on_over$/, "_off"));
							}
		        		});
		        	break;
		        }
			});
			$filter_allideas = "";
			$filter_mostpopular = "";
			$filter_mostrecent = "";
			$filter_discipline = "";
			$("span").each(function()
			{
				if ($(this).attr("class") == "lv_filter_box_label_right" && $(this).html() == "(change)")
				{
					$(this).click(function()
					{
						$filter_allideas = $("#filter_allideas").val();
						$filter_mostpopular = $("#filter_mostpopular").val();
						$filter_mostrecent = $("#filter_mostrecent").val();
						$filter_discipline = $("#filter_discipline").val();
						$(this).parent().parent().prev().slideDown("fast");
						if ($is_ok)
						{
							$(this).parent().parent().parent().parent().prev().prev().prev().fadeIn("fast");
						}
					});
				}
				if ($(this).attr("class") == "lv_filter_box_label_right" && $(this).html() == "(clear)")
				{
					$(this).click(function()
					{
						if ($is_ok)
						{
							$("div.lv_parent_container").prev().prev().prev().fadeOut("fast");
						}
						$json = {ajax: true};
						$("div.lv_parent_container").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/list_view_page_loader.gif\" /></div>");
						$.get("/wp-content/themes/oe/page_idea_list_view.php", $json, function(html)
						{
							$("div.lv_parent_container").get(0).innerHTML = html;
							$jquery_site_wrapper("listview");
						});
					});
				}
			});
			$("input.lv_filter_keyword_input").blur(function()
			{
				if ($(this).val() == "")
				{
					$(this).val("Search");
				}
				else if ($(this).val() == "Search")
				{
					$(this).val("");
				}
			});
			$("input.lv_filter_keyword_input").bind("keypress", function(e)
			{
				if (e.keyCode == 13)
				{
					$json_string = "$json = {ajax: true";
					if ($("#filter_allideas").val() == "true")
					{
						$json_string += ", all: \"\"";
					}
					else if ($("#filter_mostpopular").val() == "true")
					{
						$json_string += ", mostpopular: \"\"";
					}
					else if ($("#filter_mostrecent").val() == "true")
					{
						$json_string += ", mostrecent: \"\"";
					}
					if ($("#filter_discipline").val() != "" && $("#filter_discipline").val() != "none")
					{
						$json_string += ", discipline: \"" + $("#filter_discipline").val() + "\"";
					}
					if ($("#filter_keywords").val() != "" && $("#filter_keywords").val() != "Search")
					{
						$json_string += ", keywords: \"" + $("#filter_keywords").val() + "\"";
					}
					$json_string += "}";
					eval($json_string);
					$("div.lv_parent_container").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/list_view_page_loader.gif\" /></div>");
					$.get("/wp-content/themes/oe/page_idea_list_view.php", $json, function(html)
					{
						$("div.lv_parent_container").get(0).innerHTML = html;
						$jquery_site_wrapper("listview");
					});
				}
			});
			$("input.lv_filter_keyword_input").click(function()
			{
				if ($(this).val() == "")
				{
					$(this).val("Search");
				}
				else if ($(this).val() == "Search")
				{
					$(this).val("");
				}
			});
			$("textarea.lv_required_textarea_off").val("");
			$("textarea").each(function()
			{
				if($(this).attr("class") == "lv_required_textarea_off")
				{
					$(this).keyup(function()
					{
						$limit = 140;
						$remaining = $limit - $(this).val().length;
						if ($remaining >= 0)
						{
							$(this).parent().next().html($remaining + " Characters Remaining");
						}
						if ($remaining < 0)
						{
							$(this).val($(this).val().substring(0, 140));
							$(this).parent().next().html("0 Characters Remaining");
						}
					});
				}
				if ($(this).attr("class") == "lv_categorize_textarea")
				{
					$(this).keyup(function()
					{
						$limit = 20;
						$array = $(this).val().split(",");
						$string = "";
						$total_words = 0;
						for (var $i = 0; $i < $array.length; $i++)
						{
							if ($array[$i] != "")
							{
								$string += $array[$i].replace(/^\s*(.*?)\s*$/,"$1") + ", ";
								$total_words++;
								if ($total_words == 20)
								{
									break;
								}
							}
						}
						$string = $string.slice(0, -2);
						$remaining = $limit - $total_words;
						if ($remaining <= 0)
						{
							$(this).val($string);
						}
						$(this).parent().next().html($remaining + " Words Remaining");
					});
				}
			});
			$jquery_lv_share_wrapper();
		break;
		case "eventlistviewnav":
			$("div").each(function()
			{
                switch ($(this).attr("class"))
                {
                    case "ev_pre_on":
                    case "ev_pre_off":
                        $(this).click(function()
                        {
                            $(this).attr("class", "ev_pre_on");
                            $(".ev_mon2_on").attr("class", "ev_mon2_off");
                            $(".ev_tue3_on").attr("class", "ev_tue3_off");
                            $(".ev_wed4_on").attr("class", "ev_wed4_off");
                            $(".ev_thu5_on").attr("class", "ev_thu5_off");
                            $(".ev_fri6_on").attr("class", "ev_fri6_off");
                            $(".ev_sat7_on").attr("class", "ev_sat7_off");
                            $(".ev_sun8_on").attr("class", "ev_sun8_off");
                            $(".ev_mon9_on").attr("class", "ev_mon9_off");
                            $(".ev_post_on").attr("class", "ev_post_off");
                            $("#ev_content").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader.gif\" /></div>");
                            $json = {d:"pre"}
							$.post("/wp-content/themes/oe/page_event_list_view.php", $json, function(html)
							{
				                $("#ev_content").html(html);
				                $jquery_site_wrapper("eventlistview");
							});                            
                        });
                    break;
                    case "ev_mon2_on":
                    case "ev_mon2_off":
                        $(this).click(function()
                        {
                            $(".ev_pre_on").attr("class", "ev_pre_off");
                            $(this).attr("class", "ev_mon2_on");
                            $(".ev_tue3_on").attr("class", "ev_tue3_off");
                            $(".ev_wed4_on").attr("class", "ev_wed4_off");
                            $(".ev_thu5_on").attr("class", "ev_thu5_off");
                            $(".ev_fri6_on").attr("class", "ev_fri6_off");
                            $(".ev_sat7_on").attr("class", "ev_sat7_off");
                            $(".ev_sun8_on").attr("class", "ev_sun8_off");
                            $(".ev_mon9_on").attr("class", "ev_mon9_off");
                            $(".ev_post_on").attr("class", "ev_post_off");
                            $("#ev_content").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader.gif\" /></div>");
                            $json = {d:2}
							$.post("/wp-content/themes/oe/page_event_list_view.php", $json, function(html)
							{
				                $("#ev_content").html(html);
				                $jquery_site_wrapper("eventlistview");
							});                            
                        });
                    break;
                    case "ev_tue3_on":
                    case "ev_tue3_off":
                        $(this).click(function()
                        {
                            $(".ev_pre_on").attr("class", "ev_pre_off");
                            $(".ev_mon2_on").attr("class", "ev_mon2_off");
                            $(this).attr("class", "ev_tue3_on");
                            $(".ev_wed4_on").attr("class", "ev_wed4_off");
                            $(".ev_thu5_on").attr("class", "ev_thu5_off");
                            $(".ev_fri6_on").attr("class", "ev_fri6_off");
                            $(".ev_sat7_on").attr("class", "ev_sat7_off");
                            $(".ev_sun8_on").attr("class", "ev_sun8_off");
                            $(".ev_mon9_on").attr("class", "ev_mon9_off");
                            $(".ev_post_on").attr("class", "ev_post_off");
                            $("#ev_content").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader.gif\" /></div>");
                            $json = {d:3}
							$.post("/wp-content/themes/oe/page_event_list_view.php", $json, function(html)
							{
				                $("#ev_content").html(html);
				                $jquery_site_wrapper("eventlistview");
							});                            
                        });
                    break;
                    case "ev_wed4_on":
                    case "ev_wed4_off":
                        $(this).click(function()
                        {
                            $(".ev_pre_on").attr("class", "ev_pre_off");
                            $(".ev_mon2_on").attr("class", "ev_mon2_off");
                            $(".ev_tue3_on").attr("class", "ev_tue3_off");
                            $(this).attr("class", "ev_wed4_on");
                            $(".ev_thu5_on").attr("class", "ev_thu5_off");
                            $(".ev_fri6_on").attr("class", "ev_fri6_off");
                            $(".ev_sat7_on").attr("class", "ev_sat7_off");
                            $(".ev_sun8_on").attr("class", "ev_sun8_off");
                            $(".ev_mon9_on").attr("class", "ev_mon9_off");
                            $(".ev_post_on").attr("class", "ev_post_off");
                            $("#ev_content").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader.gif\" /></div>");
                            $json = {d:4}
							$.post("/wp-content/themes/oe/page_event_list_view.php", $json, function(html)
							{
				                $("#ev_content").html(html);
				                $jquery_site_wrapper("eventlistview");
							});                            
                        });
                    break;
                    case "ev_thu5_on":
                    case "ev_thu5_off":
                        $(this).click(function()
                        {
                            $(".ev_pre_on").attr("class", "ev_pre_off");
                            $(".ev_mon2_on").attr("class", "ev_mon2_off");
                            $(".ev_tue3_on").attr("class", "ev_tue3_off");
                            $(".ev_wed4_on").attr("class", "ev_wed4_off");
                            $(this).attr("class", "ev_thu5_on");
                            $(".ev_fri6_on").attr("class", "ev_fri6_off");
                            $(".ev_sat7_on").attr("class", "ev_sat7_off");
                            $(".ev_sun8_on").attr("class", "ev_sun8_off");
                            $(".ev_mon9_on").attr("class", "ev_mon9_off");
                            $(".ev_post_on").attr("class", "ev_post_off");
                            $("#ev_content").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader.gif\" /></div>");
                            $json = {d:5}
							$.post("/wp-content/themes/oe/page_event_list_view.php", $json, function(html)
							{
				                $("#ev_content").html(html);
				                $jquery_site_wrapper("eventlistview");
							});                            
                        });
                    break;
                    case "ev_fri6_on":
                    case "ev_fri6_off":
                        $(this).click(function()
                        {
                            $(".ev_pre_on").attr("class", "ev_pre_off");
                            $(".ev_mon2_on").attr("class", "ev_mon2_off");
                            $(".ev_tue3_on").attr("class", "ev_tue3_off");
                            $(".ev_wed4_on").attr("class", "ev_wed4_off");
                            $(".ev_thu5_on").attr("class", "ev_thu5_off");
                            $(this).attr("class", "ev_fri6_on");
                            $(".ev_sat7_on").attr("class", "ev_sat7_off");
                            $(".ev_sun8_on").attr("class", "ev_sun8_off");
                            $(".ev_mon9_on").attr("class", "ev_mon9_off");
                            $(".ev_post_on").attr("class", "ev_post_off");
                            $("#ev_content").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader.gif\" /></div>");
                            $json = {d:6}
							$.post("/wp-content/themes/oe/page_event_list_view.php", $json, function(html)
							{
				                $("#ev_content").html(html);
				                $jquery_site_wrapper("eventlistview");
							});                            
                        });
                    break;
                    case "ev_sat7_on":
                    case "ev_sat7_off":
                        $(this).click(function()
                        {
                            $(".ev_pre_on").attr("class", "ev_pre_off");
                            $(".ev_mon2_on").attr("class", "ev_mon2_off");
                            $(".ev_tue3_on").attr("class", "ev_tue3_off");
                            $(".ev_wed4_on").attr("class", "ev_wed4_off");
                            $(".ev_thu5_on").attr("class", "ev_thu5_off");
                            $(".ev_fri6_on").attr("class", "ev_fri6_off");
                            $(this).attr("class", "ev_sat7_on");
                            $(".ev_sun8_on").attr("class", "ev_sun8_off");
                            $(".ev_mon9_on").attr("class", "ev_mon9_off");
                            $(".ev_post_on").attr("class", "ev_post_off");
                            $("#ev_content").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader.gif\" /></div>");
                            $json = {d:7}
   							$.post("/wp-content/themes/oe/page_event_list_view.php", $json, function(html)
							{
				                $("#ev_content").html(html);
				                $jquery_site_wrapper("eventlistview");
							});                            
                     });
                    break;
                    case "ev_sun8_on":
                    case "ev_sun8_off":
                        $(this).click(function()
                        {
                            $(".ev_pre_on").attr("class", "ev_pre_off");
                            $(".ev_mon2_on").attr("class", "ev_mon2_off");
                            $(".ev_tue3_on").attr("class", "ev_tue3_off");
                            $(".ev_wed4_on").attr("class", "ev_wed4_off");
                            $(".ev_thu5_on").attr("class", "ev_thu5_off");
                            $(".ev_fri6_on").attr("class", "ev_fri6_off");
                            $(".ev_sat7_on").attr("class", "ev_sat7_off");
                            $(this).attr("class", "ev_sun8_on");
                            $(".ev_mon9_on").attr("class", "ev_mon9_off");
                            $(".ev_post_on").attr("class", "ev_post_off");
                            $("#ev_content").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader.gif\" /></div>");
                            $json = {d:8}
							$.post("/wp-content/themes/oe/page_event_list_view.php", $json, function(html)
							{
				                $("#ev_content").html(html);
				                $jquery_site_wrapper("eventlistview");
							});                            
                        });
                    break;
                    case "ev_post_on":
                    case "ev_post_off":
                        $(this).click(function()
                        {
                            $(".ev_pre_on").attr("class", "ev_pre_off");
                            $(".ev_mon2_on").attr("class", "ev_mon2_off");
                            $(".ev_tue3_on").attr("class", "ev_tue3_off");
                            $(".ev_wed4_on").attr("class", "ev_wed4_off");
                            $(".ev_thu5_on").attr("class", "ev_thu5_off");
                            $(".ev_fri6_on").attr("class", "ev_fri6_off");
                            $(".ev_sat7_on").attr("class", "ev_sat7_off");
                            $(".ev_sun8_on").attr("class", "ev_sun8_off");
                            $(".ev_mon9_on").attr("class", "ev_mon9_off");
                            $(this).attr("class", "ev_post_on");
                            $("#ev_content").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader.gif\" /></div>");
                            $json = {d:"post"}
							$.post("/wp-content/themes/oe/page_event_list_view.php", $json, function(html)
							{
				                $("#ev_content").html(html);
				                $jquery_site_wrapper("eventlistview");
							});                            
                        });
                    break;
                }
            });
			$("a").each(function()
			{
                switch ($(this).attr("class"))
                {
                    case "ev_all_events":
                        $(this).click(function()
                        {
                            $(".ev_pre_on").attr("class", "ev_pre_off");
                            $(".ev_mon2_on").attr("class", "ev_mon2_off");
                            $(".ev_tue3_on").attr("class", "ev_tue3_off");
                            $(".ev_wed4_on").attr("class", "ev_wed4_off");
                            $(".ev_thu5_on").attr("class", "ev_thu5_off");
                            $(".ev_fri6_on").attr("class", "ev_fri6_off");
                            $(".ev_sat7_on").attr("class", "ev_sat7_off");
                            $(".ev_sun8_on").attr("class", "ev_sun8_off");
                            $(".ev_mon9_on").attr("class", "ev_mon9_off");
                            $(".ev_post_on").attr("class", "ev_post_off");
                            $("#ev_content").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader.gif\" /></div>");
                            $json = {d:"all"}
    						$.post("/wp-content/themes/oe/page_event_list_view.php", $json, function(html)
    						{
    			                $("#ev_content").html(html);
    			                $jquery_site_wrapper("eventlistview");
    						});                            
                        });
                    break;
    				case "ev_done_email":
                    case "ev_cancel_email":
            			$(this).click(function()
            			{
                            $('#faux_overlay').fadeOut("slow");
                            $("#real_youtube").html('<object width="315" height="202" wmode="transparent" id="ytplayer"><param name="movie" value="http://www.youtube.com/v/oo4qEl8xgyI&hl=en_US&fs=1&rel=0&enablejsapi=1&playerapiid=ytplayer"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param value="transparent" name="wmode"></param><embed src="http://www.youtube.com/v/oo4qEl8xgyI&hl=en_US&fs=1&rel=0&enablejsapi=1&playerapiid=ytplayer" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="315" height="202"></embed></object>');
                            $('.ev_pop_container').fadeOut("slow", function()
                            {
                			    $("#ev_popc_1").show();
                			    $("#ev_popc_2").hide();
                			    $("#ev_popc_3").hide();
                            });
            			});
    				break;
    				case "ev_send_email":
    				    $(this).click(function()
    				    {
    				        $("#ev_popc_1").hide();
    				        $("#ev_popc_2").show();
    				        $to = $("#ev_to").val();
    				        $from = $("#ev_from").val();
    				        $message = $("#ev_message").val();
        					$.post("/wp-content/themes/oe/ajax_event_send_to_friend.php", {to:$to, from:$from, message:$message}, function($json)
        					{
        				        $err = false;
        				        if ($json.to != "-1")
        				        {
        				            $("#ev_to_err").html($json.to);
        				            $("#ev_to_err").show();
        				            $err = true;
        				        }
        				        else
        				        {
        				            $("#ev_to_err").html("");
        				            $("#ev_to_err").hide();
        				        }
        				        if ($json.from != "-1")
        				        {
        				            $("#ev_from_err").html($json.from);
        				            $("#ev_from_err").show();
        				            $err = true;
        				        }
        				        else
        				        {
        				            $("#ev_from_err").html("");
        				            $("#ev_from_err").hide();
        				        }
        				        if ($json.message != "-1")
        				        {
        				            $("#ev_message_err").html($json.message);
        				            $("#ev_message_err").show();
        				            $err = true;
        				        }
        				        else
        				        {
        				            $("#ev_message_err").html("");
        				            $("#ev_message_err").hide();
        				        }
        				        if ($err)
        				        {
            				        $("#ev_popc_1").show();
            				        $("#ev_popc_2").hide();
                				}
        				        else
        				        {
        				            $("#ev_popc_2").hide();
        				            $("#ev_popc_3").show();
        				        }
        					}, "json");
    				    });
    				break;
                }
            });
        break;
// Resource List View        
        case "resourcelistviewnav":
			$("div").each(function()
			{
                switch ($(this).attr("class"))
                {
                    case "re_major_on":
					case "re_major_off":
                        $(this).click(function()
                        {
							$(this).attr("class", "re_major_on");
							$(".re_careers_on").attr("class", "re_careers_off");
							$(".re_companies_on").attr("class", "re_companies_off");
							$(".re_games_on").attr("class", "re_games_off");
							$(".re_body").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader3.gif\" /></div>");
							$json = {r:1}
							$.post("/wp-content/themes/oe/page_resource_list_view.php", $json, function(html)
							{
								$(".re_body").html(html);
								$jquery_site_wrapper("resourcelistview");
							});							                   
                        });
                    break;
                    case "re_careers_on":
                    case "re_careers_off":
                        $(this).click(function()
                        {
							$(".re_major_on").attr("class", "re_major_off");
							$(this).attr("class", "re_careers_on");
							$(".re_companies_on").attr("class", "re_companies_off");
							$(".re_games_on").attr("class", "re_games_off");
							$(".re_body").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader3.gif\" /></div>");
							$json = {r:2}
							$.post("/wp-content/themes/oe/page_resource_list_view.php", $json, function(html)
							{
								$(".re_body").html(html);
								$jquery_site_wrapper("resourcelistview");
							});             
                        });
                    break;
                    case "re_companies_on":
                    case "re_companies_off":
                        $(this).click(function()
                        {
							$(".re_major_on").attr("class", "re_major_off");
							$(".re_careers_on").attr("class", "re_careers_off");
							$(this).attr("class", "re_companies_on");
							$(".re_games_on").attr("class", "re_games_off");
							$(".re_body").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader3.gif\" /></div>");
							$json = {r:3}
							$.post("/wp-content/themes/oe/page_resource_list_view.php", $json, function(html)
							{
								$(".re_body").html(html);
								$jquery_site_wrapper("resourcelistview");
							});
                        });
                    break;
                    case "re_games_on":
                    case "re_games_off":
                        $(this).click(function()
                        {
							$(".re_major_on").attr("class", "re_major_off");
							$(".re_careers_on").attr("class", "re_careers_off");
							$(".re_companies_on").attr("class", "re_companies_off");
							$(this).attr("class", "re_games_on");
							$(".re_body").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader3.gif\" /></div>");
							$json = {r:4}
							$.post("/wp-content/themes/oe/page_resource_list_view.php", $json, function(html)
							{
								$(".re_body").html(html);
								$jquery_site_wrapper("resourcelistview");
							});
                        });
                    break;
                }
            });
        break;
        case "resourcelistview":
			$("div").each(function()
			{
                switch ($(this).attr("class"))
                {
    				case "ev_paging_box_off":
    					$(this).click(function()
    					{
    						if ($(this).html().indexOf("Previous") != -1)
    						{
    							$pg = parseInt($("div.ev_paging_box_on").html()) - 1;
    						}
    						else if ($(this).html().indexOf("Next") != -1)
    						{
    							$pg = parseInt($("div.ev_paging_box_on").html()) + 1;
    						}
    						else
    						{
    							$pg = parseInt($(this).html());
    						}
    						$json = {};
    						if ($("#resource_retainer").val() != "")
    						{
                                $json.r = $("#resource_retainer").val();
    						}
    						$json.pg = $pg;
    						$(".re_body").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader3.gif\" /></div>");
    						$.post("/wp-content/themes/oe/page_resource_list_view.php", $json, function(html)
    						{
				                $(".re_body").html(html);
				                $jquery_site_wrapper("resourcelistview");
    						});
    					});
    				break;
                }
			});
			$(".showallresources").click(function()
			{
				$json = {};
				$json.r = "";
				$(".re_major_on").attr("class", "re_major_off");
				$(".re_careers_on").attr("class", "re_careers_off");
				$(".re_companies_on").attr("class", "re_companies_off");
				$(".re_games_on").attr("class", "re_games_off");
				$(".re_body").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader3.gif\" /></div>");
				$.post("/wp-content/themes/oe/page_resource_list_view.php", $json, function(html)
				{
					$(".re_body").html(html);
					$jquery_site_wrapper("resourcelistview");
				});
			});
        break;
// Resource List View        
		case "eventlistview":
			$("div").each(function()
			{
                switch ($(this).attr("class"))
                {
    				case "ev_paging_box_off":
    					$(this).click(function()
    					{
    						if ($(this).html().indexOf("Previous") != -1)
    						{
    							$pg = parseInt($("div.ev_paging_box_on").html()) - 1;
    						}
    						else if ($(this).html().indexOf("Next") != -1)
    						{
    							$pg = parseInt($("div.ev_paging_box_on").html()) + 1;
    						}
    						else
    						{
    							$pg = parseInt($(this).html());
    						}
    						$json = {}
    						if ($("#day_retainer").val() != "")
    						{
                                $json.d = $("#day_retainer").val();
    						}
    						if ($("#keywords_retainer").val() != "")
    						{
                                $json.keywords = $("#keywords_retainer").val();
    						}
    						if ($("#filter_retainer").val() != "")
    						{
                                $json.filter = $("#filter_retainer").val();
    						}
    						$json.pg = $pg;
    						if ($("#keywords").val() != "" && $("#keywords").val() != "Enter keyword search")
    						{
    				            $json.keywords = $("#keywords").val();
    						}
    						if ($("#filter").val() != "")
    						{
    				            $json.filter = $("#filter").val();
    						}
    						$("#ev_content").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader.gif\" /></div>");
    						$.post("/wp-content/themes/oe/page_event_list_view.php", $json, function(html)
    						{
				                $("#ev_content").html(html);
				                $jquery_site_wrapper("eventlistview");
    						});
    					});
    				break;
                    case "ev_select_container":
                        $(this).click(function()
                        {
                            elm = $(this).children().get(1);
                            if (elm.style.display == "none")
                            {
                                $(elm).css({display:""});
                            }
                            else
                            {
                                $(elm).css({display:"none"});
                            }
                            $(document.body).bind("mouseup", $ev_filter_select_handler);
                            $("div.ev_select_menu_item_on").attr("class", "ev_select_menu_item_off");
                        });
                    break;
                    case "ev_select_container_button":
                        $(this).click(function()
                        {
                            elm = $($(this).parent().prev().children().get(0)).children().get(1);
                            if (elm.style.display == "none")
                            {
                                $(elm).css({display:""});
                            }
                            else
                            {
                                $(elm).css({display:"none"});
                            }
                            $(document.body).bind("mouseup", $ev_filter_select_handler);
                            $("div.ev_select_menu_item_on").attr("class", "ev_select_menu_item_off");
                        });
                    break;
                    case "ev_select_menu_item_off":
                        $(this).mouseover(function()
                        {
                            $(".ev_select_menu_item_on").attr("class", "ev_select_menu_item_off");
                            if ($(this).attr("class") == "ev_select_menu_item_off")
                            {
                                $(this).attr("class", "ev_select_menu_item_on");
                            }
                            else
                            {
                                $(this).attr("class", "ev_select_menu_item_off");
                            }
                        });
                        $(this).click(function()
                        {
                            $(".ev_pre_on").attr("class", "ev_pre_off");
                            $(".ev_mon2_on").attr("class", "ev_mon2_off");
                            $(".ev_tue3_on").attr("class", "ev_tue3_off");
                            $(".ev_wed4_on").attr("class", "ev_wed4_off");
                            $(".ev_thu5_on").attr("class", "ev_thu5_off");
                            $(".ev_fri6_on").attr("class", "ev_fri6_off");
                            $(".ev_sat7_on").attr("class", "ev_sat7_off");
                            $(".ev_sun8_on").attr("class", "ev_sun8_off");
                            $(".ev_post_on").attr("class", "ev_post_off");
                            switch ($(this).text())
                            {
                                case "Exhibition":
                                    $filter = 0;
                                break;
                                case "Competition":
                                    $filter = 1;
                                break;
                                case "Launch":
                                    $filter = 2;
                                break;
                                case "Forum":
                                    $filter = 3;
                                break;
                                case "Site Visit":
                                    $filter = 4;
                                break;
                                case "Workshop":
                                    $filter = 5;
                                break;
                                case "Seminar":
                                    $filter = 6;
                                break;
                                case "Presentation":
                                    $filter = 7;
                                break;
                                case "Fundraising":
                                    $filter = 8;
                                break;
                                case "Awards":
                                    $filter = 9;
                                break;
                                case "Experience":
                                    $filter = 10;
                                break;
                                case "Activity":
                                    $filter = 11;
                                break;
                                case "Info Session":
                                    $filter = 12;
                                break;
                                default:
                                    $filter = "";
                                break;
                            }
                            $("#filter").val($filter);
                            $json = {}
                            if ($(".ev_pre_on").length == 1)
                            {
                                $json.d = "pre";
                            }
                            else if ($(".ev_mon2_on").length == 1)
                            {
                                $json.d = 2;
                            }
                            else if ($(".ev_tue3_on").length == 1)
                            {
                                $json.d = 3;
                            }
                            else if ($(".ev_wed4_on").length == 1)
                            {
                                $json.d = 4;
                            }
                            else if ($(".ev_thu5_on").length == 1)
                            {
                                $json.d = 5;
                            }
                            else if ($(".ev_fri6_on").length == 1)
                            {
                                $json.d = 6;
                            }
                            else if ($(".ev_sat7_on").length == 1)
                            {
                                $json.d = 7;
                            }
                            else if ($(".ev_sun8_on").length == 1)
                            {
                                $json.d = 8;
                            }
                            else if ($(".ev_post_on").length == 1)
                            {
                                $json.d = "post";
                            }
                            $json.filter = $filter;
                            $("#ev_content").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader.gif\" /></div>");
							$.post("/wp-content/themes/oe/page_event_list_view.php", $json, function(html)
							{
				                $("#ev_content").html(html);
				                $jquery_site_wrapper("eventlistview");
							});
                        });
                    break;
                    case "ev_facebook_icon":
                        $(this).click(function()
                        {
                            window.open("http://www.facebook.com/sharer.php?u=" + $($(this).parent().parent().children().get(0)).val());
                        });
                    break;
                    case "ev_twitter_icon":
                        $(this).click(function()
                        {
                            window.open("http://twitter.com/home?status=" + $($(this).parent().parent().children().get(0)).val());
                        });
                    break;
                    case "ev_linkedin_icon":
                        $(this).click(function()
                        {
                            window.open("http://www.linkedin.com/shareArticle?mini=true&title=Australian+Engineering+Week&url=" + $($(this).parent().parent().children().get(0)).val());
                        });
                    break;
                    case "ev_email_icon":
                        $(this).click(function()
                        {
                            document.location = "#";
                            $id = $($(this).children().get(0)).val();
                            $json = {};
                            $json.id = $id;
							$.get("/wp-content/themes/oe/ajax_event_get_email_text.php", $json, function($html)
							{
				                $("#ev_to").val("");
				                $("#ev_to_err").hide();
				                $("#ev_from").val("");
				                $("#ev_from_err").hide();
				                $("#ev_message").val($html);
							});
							$('#faux_overlay').css('width', $('.background-1').width());
		        			$('#faux_overlay').css('height', $('.background-1').height());
		        			$('.ev_pop_container').css('left', ($('.background-1').width() / 2) - ($('.ev_pop_container').width() / 2) + 'px');
                            $("#faux_overlay").fadeIn("slow");
                            $(".ev_pop_container").fadeIn("slow");
                            $("#real_youtube").html("<img src=\"/wp-content/themes/oe/images/end/youtube_dummy.png\" alt=\"Youtube\" />");
                        });
                    break;
                    case "ev_search_button":
                        $(this).click(function()
                        {
                            $keywords = $("#keywords").val();
                            $(".ev_pre_on").attr("class", "ev_pre_off");
                            $(".ev_mon2_on").attr("class", "ev_mon2_off");
                            $(".ev_tue3_on").attr("class", "ev_tue3_off");
                            $(".ev_wed4_on").attr("class", "ev_wed4_off");
                            $(".ev_thu5_on").attr("class", "ev_thu5_off");
                            $(".ev_fri6_on").attr("class", "ev_fri6_off");
                            $(".ev_sat7_on").attr("class", "ev_sat7_off");
                            $(".ev_sun8_on").attr("class", "ev_sun8_off");
                            $(".ev_post_on").attr("class", "ev_post_off");
                            $("#ev_content").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader.gif\" /></div>");
							$.post("/wp-content/themes/oe/page_event_list_view.php", {ajax: "", keywords:$keywords}, function(html)
							{
				                $("#ev_content").html(html);
				                $jquery_site_wrapper("eventlistview");
							});
                        });
                    break;
                    case "ev_pop_header_right":
                        $(this).click(function()
                        {
                            $('#faux_overlay').fadeOut("slow");
                            $("#real_youtube").html('<object width="315" height="202" wmode="transparent" id="ytplayer"><param name="movie" value="http://www.youtube.com/v/oo4qEl8xgyI&hl=en_US&fs=1&rel=0&enablejsapi=1&playerapiid=ytplayer"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param value="transparent" name="wmode"></param><embed src="http://www.youtube.com/v/oo4qEl8xgyI&hl=en_US&fs=1&rel=0&enablejsapi=1&playerapiid=ytplayer" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="315" height="202"></embed></object>');
                            $('.ev_pop_container').fadeOut("slow", function()
                            {
                			    $("#ev_popc_1").show();
                			    $("#ev_popc_2").hide();
                			    $("#ev_popc_3").hide();
                            });
                        });
                    break;
                }
			});
			$("input").each(function()
			{
                switch ($(this).attr("class"))
                {
                    case "ev_search_field":
            			$(this).focus(function()
            			{
            				if ($(this).val() == "Enter keyword search")
            				{
            					$(this).val("");
            				}
            			});
            			$(this).blur(function()
            			{
            				if ($(this).val() == "")
            				{
            					$(this).val("Enter keyword search");
            				}
            			});
            			$(this).bind("keypress", function(e)
            			{
            				if (e.keyCode == 13)
            				{
                                $keywords = $("#keywords").val();
                                $(".ev_pre_on").attr("class", "ev_pre_off");
                                $(".ev_mon2_on").attr("class", "ev_mon2_off");
                                $(".ev_tue3_on").attr("class", "ev_tue3_off");
                                $(".ev_wed4_on").attr("class", "ev_wed4_off");
                                $(".ev_thu5_on").attr("class", "ev_thu5_off");
                                $(".ev_fri6_on").attr("class", "ev_fri6_off");
                                $(".ev_sat7_on").attr("class", "ev_sat7_off");
                                $(".ev_sun8_on").attr("class", "ev_sun8_off");
                                $(".ev_post_on").attr("class", "ev_post_off");
                                $("#ev_content").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader.gif\" /></div>");
            					$.post("/wp-content/themes/oe/page_event_list_view.php", {ajax: "", keywords:$keywords}, function(html)
            					{
            		                $("#ev_content").html(html);
            		                $jquery_site_wrapper("eventlistview");
            					});
            				}
            			});
    				break;
                }
            });
        break;
		case "common":
			$("div").each(function()
			{
				if ($(this).attr("class") == "toolTip")
				{
					$($(this).children().get(0)).css({width:$($(this).children().get(0)).width()})
					$($($($(this).children().get(0)).children().get(0)).children().get(1)).css({width:$($($($(this).children().get(0)).children().get(1)).children().get(0)).width()})
					$($($($(this).children().get(0)).children().get(2)).children().get(1)).css({width:$($($($(this).children().get(0)).children().get(1)).children().get(0)).width()})
					$(this).children().hide();
					$($(this).children().get(0)).css({"visibility" : "visible"});
					$(this).hover(function()
					{
						this.top = $(this).show().position().top - 25;
						$($(this).children().get(0)).css({"top":this.top})
						$($(this).children().get(0)).fadeIn(300);
					}, function()
					{
						$($(this).children().get(0)).fadeOut(300);
						$(this).children().hide();
					});
				}
			});
			$jquery_lv_share_wrapper();
		break;
		case "tweets":
			$("div").each(function()
			{
    			if ($(this).attr("id") == "top-tweets")
    			{
        			showNewTweets(1, 3);
        			setInterval("showNewTweets(1, 1)", 30000);
    			}
    			if ($(this).attr("id") == "bottom-tweets")
    			{
        			showNewTweets(2, 3);
        			setInterval("showNewTweets(2, 1)", 30000);
    			}
            });
		break;
		case "submitidea":
			if ($("#step").val() == 1 && $("#form").html() == "")
			{
				$("#loader").show();
				$.post("/wp-content/themes/oe/page_submit_idea.php", {step: 1}, function(html)
				{
					$("#step_breadcrumb").html("<span class=\"getleft\">STEP</span> <span class=\"getleft stepbox active\">1</span><span class=\"getleft stepbox inactive\">2</span><span class=\"getleft stepbox inactive\">3</span>");
					$("#form").html(html);
					$("#form").fadeIn("fast");
					$("#loader").hide();
					$jquery_site_wrapper("submitidea");
					$jquery_site_wrapper("common");
				});
			}
			else
			{
				$("#idea").keyup(function()
				{
					$limit = 140;
					$remaining = $limit - $(this).val().length;
					if ($remaining >= 0)
					{
						$(this).parent().next().html($remaining + " Characters Remaining");
					}
					if ($remaining < 0)
					{
						$(this).val($(this).val().substring(0, 140));
						$(this).parent().next().html("0 Characters Remaining");
					}
				});
				$("#keywords").focus(function()
				{
					if ($(this).val() == "Enter keywords separated by a comma (eg: environment, water, climate)" && $(this).attr("class") == "si_required_input_off")
					{
						$(this).val("");
					}
				});
				$("#keywords").blur(function()
				{
					if ($(this).val() == "" && $(this).attr("class") == "si_required_input_off")
					{
						$(this).val("Enter keywords separated by a comma (eg: environment, water, climate)");
					}
				});
				$("#step1_submit").click(function()
				{
					$("#loader").show();
					$("#form").hide();
					$idea = escape($("#idea").val());
					$keywords = escape($("#keywords").val());
					$.post("/wp-content/themes/oe/page_submit_idea.php", {step: 1, submit: 1, "idea": $idea, "keywords": $keywords}, function($json)
					{
						document.location = "#";
						$errors = false;
						$("#keywords").attr("class", "si_required_input_off");
						if ($json.idea == 1)
						{
							$errors = true;
						}
						if ($json.keywords == 1)
						{
							$("#keywords").attr("class", "si_required_input_on");
							$errors = true;
						}
						if ($errors)
						{
							$("#loader").hide();
							$("#form").fadeIn("fast");
						}
						else
						{
							if ($json.user_id != 11)
							{
								document.location = "#";
								$.post("/wp-content/themes/oe/page_submit_idea.php", {step: 3, submit: 1, idea: $idea, keywords: $keywords, user_id: $json.user_id}, function($json)
								{
									$.post("/wp-content/themes/oe/page_submit_idea.php", {step: 3, id: $json.id}, function($html)
									{
										$json.idea = $json.idea.replace(/\+/g, "%20");
										$("#step_breadcrumb").html("<span class=\"getleft\">STEP</span> <span class=\"getleft stepbox inactive\">1</span><span class=\"getleft stepbox inactive\">2</span><span class=\"getleft stepbox active\">3</span>");
										$html = $html.replace(/\{bitly_url\}/g, $json.bitly_url);
										$html = $html.replace(/\{idea\}/g, unescape($json.idea));
										$html = $html.replace(/\{id\}/g, $json.id);
										$("#form").html($html);
										$("#form").fadeIn("fast");
										$("#loader").hide();
									});
								}, "json");
							}
							else
							{
								$.post("/wp-content/themes/oe/page_submit_idea.php", {step: 2, idea: $idea, keywords: $keywords}, function(html)
								{
									$("#step_breadcrumb").html("<span class=\"getleft\">STEP</span> <span class=\"getleft stepbox inactive\">1</span><span class=\"getleft stepbox active\">2</span><span class=\"getleft stepbox inactive\">3</span>");
									$("#form").html(html);
									$("#form").fadeIn("fast");
									$("#loader").hide();
									$jquery_site_wrapper("submitidea");
									$jquery_site_wrapper("common");
								});
							}
						}
					}, "json");
				});
				$("#step2_submit").click(function()
				{
					$("#loader").show();
					$("#form").hide();
					$idea = escape($("#idea").val());
					$keywords = escape($("#keywords").val());
					$firstname = escape($("#firstname").val());
					$lastname = escape($("#lastname").val());
					$email = escape($("#email").val());
					$mobile = escape($("#mobile").val());
					$postcode = escape($("#postcode").val());
					$smsupdates = $("#smsupdates").is(":checked");
					$emailupdates = $("#emailupdates").is(":checked");
					$termsconds = $("#termsconds").is(":checked");
					$.post("/wp-content/themes/oe/page_submit_idea.php", {step: 2, submit: 1, idea: $idea, keywords: $keywords, firstname: $firstname, lastname: $lastname, email: $email, mobile: $mobile, postcode: $postcode}, function($json)
					{
						document.location = "#";
						$errors = false;
						$("#postcodeerror").hide();
						$("#firstname").prev().attr("class", "si_required_input_label_off");
						$("#firstname").attr("class", "si_required_input_off");
						$("#lastname").prev().attr("class", "si_required_input_label_off");
						$("#lastname").attr("class", "si_required_input_off");
						$("#email").prev().attr("class", "si_required_input_label_off");
						$("#email").attr("class", "si_required_input_off");
						$("#mobile").prev().attr("class", "si_required_input_label_off");
						$("#mobile").attr("class", "si_required_input_off");
						$("#postcode").prev().attr("class", "si_required_input_label_off");
						$("#postcode").attr("class", "si_required_input_off");
						$("#termsconds").parent().attr("class", "si_required_input_chkbox_label_off");
						if ($json.idea == 1)
						{
							$errors = true;
						}
						if ($json.keywords == 1)
						{
							$errors = true;
						}
						if ($json.firstname == 1)
						{
							$("#firstname").prev().attr("class", "si_required_input_label_on");
							$("#firstname").attr("class", "si_required_input_on");
							$errors = true;
						}
						if ($json.lastname == 1)
						{
							$("#lastname").prev().attr("class", "si_required_input_label_on");
							$("#lastname").attr("class", "si_required_input_on");
							$errors = true;
						}
						if ($json.email == 1)
						{
							$("#email").prev().attr("class", "si_required_input_label_on");
							$("#email").attr("class", "si_required_input_on");
							$errors = true;
						}
						if ($json.mobile == 1)
						{
							$("#mobile").prev().attr("class", "si_required_input_label_on");
							$("#mobile").attr("class", "si_required_input_on");
							$errors = true;
						}
						if ($json.postcode == 1)
						{
							$("#postcode").prev().attr("class", "si_required_input_label_on");
							$("#postcode").attr("class", "si_required_input_on");
							$errors = true;
						}
						if (!$termsconds)
						{
							$("#termsconds").parent().attr("class", "si_required_input_chkbox_label_on");
							$errors = true;
						}
						if ($errors)
						{
							$("#loader").hide();
							$("#form").fadeIn("fast");
						}
						else
						{
							document.location = "#";
							$.post("/wp-content/themes/oe/page_submit_idea.php", {step: 3, submit: 1, idea: $idea, keywords: $keywords, user_id: $json.user_id, firstname: $firstname, lastname: $lastname, email: $email, mobile: $mobile, postcode: $postcode, smsupdates: $smsupdates, emailupdates: $emailupdates}, function($json)
							{
								$.post("/wp-content/themes/oe/page_submit_idea.php", {step: 3, id: $json.id, bitly_url: $json.bitly_url, idea: $idea}, function($html)
								{
									$json.idea = $json.idea.replace(/\+/g, "%20");
									$("#step_breadcrumb").html("<span class=\"getleft\">STEP</span> <span class=\"getleft stepbox inactive\">1</span><span class=\"getleft stepbox inactive\">2</span><span class=\"getleft stepbox active\">3</span>");
									$html = $html.replace(/\{bitly_url\}/g, $json.bitly_url);
									$html = $html.replace(/\{idea\}/g, unescape($json.idea));
									$html = $html.replace(/\{id\}/g, $json.id);
									$("#form").html($html);
									$("#form").fadeIn("fast");
									$("#loader").hide();
									$jquery_site_wrapper("submitidea");
									$jquery_site_wrapper("common");
								});
							}, "json");
						}
					}, "json");
				});
			}
		break
	}
}
function $jquery_lv_share_wrapper()
{
	$("input").each(function()
	{
		if ($(this).attr("class").match(/lv_share_input_/) || $(this).attr("class").match(/lv_follow_input/) || $(this).attr("class").match(/formfield/) || $(this).attr("class").match(/frm-comp/) || $(this).attr("class").match(/si_required_input_off/) || $(this).attr("name") == "email" || $(this).attr("name") == "password")
		{
			$(this).click(function()
			{
				switch ($(this).val())
				{
					case "Your First Name":
					case "Your Last Name":
					case "Your Email":
					case "Your Message":						
					case "Friends First Name":
					case "Friends Last Name":
					case "Friends Email":
					case "email":
					case "password":
						$(this).val("");
					break;
				}
			});
			$(this).blur(function()
			{
				if ($(this).val() == "")
				{
					if ($(this).attr("id").match(/share_my_firstname/) || $(this).attr("id").match(/follow_firstname/) || $(this).attr("id").match(/firstname-formfield/) || $(this).attr("id").match(/firstname-formfield2/))
					{
						$(this).val("Your First Name");
					}
					else if ($(this).attr("id").match(/share_my_lastname/) || $(this).attr("id").match(/follow_lastname/) || $(this).attr("id").match(/lastname-formfield/) || $(this).attr("id").match(/lastname-formfield2/))
					{
						$(this).val("Your Last Name");
					}
					else if ($(this).attr("id").match(/share_my_email/) || $(this).attr("id").match(/follow_email/) || $(this).attr("id").match(/email-formfield/) || $(this).attr("id").match(/email-formfield2/))
					{
						$(this).val("Your Email");
					}
					else if ($(this).attr("id").match(/share_firstname/))
					{
						$(this).val("Friends First Name");
					}
					else if ($(this).attr("id").match(/share_lastname/))
					{
						$(this).val("Friends Last Name");
					}
					else if ($(this).attr("id").match(/share_email/) || $(this).attr("id").match(/email-formfield/))
					{
						$(this).val("Friends Email");
					}
					else if ($(this).attr("id").match(/message-formfield/))
					{
						$(this).val("Your Message");
					}
					else if ($(this).attr("name") == "email")
					{
						$(this).val("email");
					}
					else if ($(this).attr("name") == "password")
					{
						$(this).val("password");
					}
				}
			});
		}
	});
}
function $jquery_dialog_handler()
{
	this.show = function($json)
	{
		// $json.content 						(the content of the dialog)
		// $json.classname			 			(the class name of the ok or continue button)
		// $json.callback 						(the function that gets called when the above button is clicked)
		alert($json.content);
	}
	this.hide = function()
	{
	}
}
function $jquery_error_handler($elm)
{
	$error = false;
	if(typeof($elm) == "undefined")
	{
		$elm = 'form';
	}
	$($elm).find("input").each(function()
	{
		if ($(this).attr("class").match(/si_(.[^_]*)_input_off/) || $(this).attr("class").match(/si_(.[^_]*)_input_on/) || $(this).attr("class").match(/lv_(.[^_]*)_input_off/) || $(this).attr("class").match(/lv_(.[^_]*)_input_on/) || $(this).attr("class").match(/pw_(.[^_]*)_input_off/) || $(this).attr("class").match(/pw_(.[^_]*)_input_on/))
		{
			$type = $(this).attr("class").split("_")[1];
			switch ($type)
			{
				case "email":
					if ($(this).val() == "" || !$(this).val().match(/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/)  || $(this).val() == "E-mail")
					{
						$error = true;
						$(this).attr("class",$(this).attr("class").replace("_off","_on"));
						if($(this).prev().get(0))
						{
							$(this).prev().attr("class",$(this).prev().attr("class").replace("_off","_on"));
						}
					}
					else 
					{
						$(this).attr("class",$(this).attr("class").replace("_on","_off"));
						if($(this).prev().get(0))
						{
							$(this).prev().attr("class",$(this).prev().attr("class").replace("_on","_off"));
						}
					}
				break;
				case "required":
					if ($(this).val() == "" || $(this).val() == "Your First Name" || $(this).val() == "Your Last Name" || $(this).val() == "Name")
					{
						$error = true;
						$(this).attr("class",$(this).attr("class").replace("_off","_on"));
						if($(this).prev().get(0))
						{
							$(this).prev().attr("class",$(this).prev().attr("class").replace("_off","_on"));						
						}

					}
					else
					{
						$(this).attr("class",$(this).attr("class").replace("_on","_off"));
						if($(this).prev().get(0))
						{
							$(this).prev().attr("class",$(this).prev().attr("class").replace("_on","_off"));
						}
					}
				break;
				case "chkbox":
					if ($(this).attr('checked'))
					{
						$error = true;
						$(this).attr("class",$(this).attr("class").replace("_off","_on"));
						if($(this).prev().get(0))
						{
							$(this).prev().attr("class",$(this).prev().attr("class").replace("_off","_on"));
						}
					}
					else
					{
						$(this).attr("class",$(this).attr("class").replace("_on","_off"));
						if($(this).prev().get(0))
						{
							$(this).prev().attr("class",$(this).prev().attr("class").replace("_on","_off"));
						}
					}
				break;			
			}
		}
	});
	$($elm).find("textarea").each(function()
	{
		if ($(this).attr("class").match(/lv_(.[^_]*)_textarea_off/) || $(this).attr("class").match(/lv_(.[^_]*)_textarea_on/) || $(this).attr("class").match("si_required_input_off") || $(this).attr("class").match("si_required_input_on"))
		{
			$type = $(this).attr("class").split("_")[1];
			switch ($type)
			{
				case "required":
					if ($(this).val() == "" || $(this).val() == "Add a comment...")
					{
						$error = true;
						$(this).attr("class",$(this).attr("class").replace("_off","_on"));
						if($(this).prev().get(0))
						{
							$(this).prev().attr("class",$(this).prev().attr("class").replace("_off","_on"));						
						}
						else
						{
							$(this).parent().parent().attr("class",$(this).parent().parent().attr("class").replace("_off","_on"));
						}
					}
					else
					{
						$(this).attr("class",$(this).attr("class").replace("_on","_off"));
						if($(this).prev().get(0))
						{
							$(this).prev().attr("class",$(this).prev().attr("class").replace("_on","_off"));
						}
						else
						{
							$(this).parent().parent().attr("class",$(this).parent().parent().attr("class").replace("_on","_off"));
						}
					}
				break;
			}
		}
	});
	if($error)
	{
		return false;
	}
	else
	{
		return true;
	}
}
function $tn_dropdown_handler()
{
	$("div.tn_container_right").next().next().slideUp("fast");
	$("div.tn_container_right").next().slideDown("fast");
	$(document.body).unbind("mouseup", $tn_dropdown_handler);
	$("div.tn_arrow_down_icon_off").attr("class", "tn_arrow_left_icon_off")
	$("div.tn_arrow_down_icon_on").attr("class", "tn_arrow_left_icon_on")
	$("div.tn_arrow_down_icon_on_alt").attr("class", "tn_arrow_left_icon_on_alt")
}

// Function to show new Tweets for Twitter Widget
function showNewTweets($type, $total) {
	$json = {};
	$json = {s : $type, t: $total};
	if ($type == 1) { // Show the top tweet
		$.getJSON("/twitter1.json", $json, function(data) {
			if($total == 3) {
				for (var i = 2; i >= 0; i--) { // Show in the chronological order
					$("#top-tweets").prepend($("<div class=\"twitter-tweet\"><span class=\"twitter-user\">" + data[i].from_user + "</span> " +  data[i].text + "<br /><span class=\"twitter-info\">" + data[i].created_at.replace(" +0000", " Pacific Standard Time (PST)") + "</span><input type=\"hidden\" name=\"tweet-id\" value=\"" + data[i].id + "\"></div>").fadeIn("slow"));
				}
			} else {
				// Check the latest tweet is the current returned tweet
				var $latest_id = parseInt($("#top-tweets div.twitter-tweet > input").val());
				if (data[0].id != $latest_id) {
					$("#top-tweets").prepend($("<div class=\"twitter-tweet\"><span class=\"twitter-user\">" + data[0].from_user + "</span> " +  data[0].text + "<br /><span class=\"twitter-info\">" + data[0].created_at.replace(" +0000", " Pacific Standard Time (PST)") + "</span><input type=\"hidden\" name=\"tweet-id\" value=\"" + data[0].id + "\"></div>").fadeIn("slow"));
				}
			}
			// Remove the third tweet if any
			if($("#top-tweets div.twitter-tweet").length > 3) 
			{
				$("#top-tweets div.twitter-tweet").next().next().next().fadeOut("slow");
			}
		});
    } else { // Bottom tweet
		$.getJSON("/twitter2.json", $json, function(data) {
			if($total == 3) {
				for (var i = 2; i >= 0; i--) { // Show in the chronological order
					$("#bottom-tweets").prepend($("<div class=\"twitter-tweet\"><span class=\"twitter-user\">" + data[i].from_user + "</span> " +  data[i].text + "<br /><span class=\"twitter-info\">" + data[0].created_at.replace(" +0000", " Pacific Standard Time (PST)") + "</span><input type=\"hidden\" name=\"tweet-id\" value=\"" + data[i].id + "\"></div>").fadeIn("slow"));
				}
			} else {
				// Check the latest tweet is the current returned tweet
				var $latest_id = parseInt($("#bottom-tweets div.twitter-tweet > input").val());
				if (data[0].id != $latest_id) {
					$("#bottom-tweets").prepend($("<div class=\"twitter-tweet\"><span class=\"twitter-user\">" + data[0].from_user + "</span> " +  data[0].text + "<br /><span class=\"twitter-info\">" + data[0].created_at.replace(" +0000", " Pacific Standard Time (PST)") + "</span><input type=\"hidden\" name=\"tweet-id\" value=\"" + data[0].id + "\"></div>").fadeIn("slow"));
				}
			}
			// Remove the third tweet if any
			if($("#bottom-tweets div.twitter-tweet").length > 3) 
			{
				$("#bottom-tweets div.twitter-tweet").next().next().next().fadeOut("slow");
			}
		});
	}
}

function $lv_filter_select_handler()
{
	$("div.lv_filter_select_menu").hide();
	$(document.body).unbind("mouseup", $lv_filter_select_handler);
}
function $ev_filter_select_handler()
{
	$("div.ev_select_menu").hide();
	$(document.body).unbind("mouseup", $ev_filter_select_handler);
}
$is_ok = false;
if (document.all && !window.opera)
{
	if (typeof (window.external.AddService) != "undefined")
	{
		$is_ok = true;
	}
}
else
{
	$is_ok = true;
}
$(document).ready(function()
{
	$jquery_site_wrapper("other");
	$jquery_site_wrapper("common");
	$jquery_site_wrapper("tweets");
	$jquery_site_wrapper("header");
	$jquery_site_wrapper("listview");
	$jquery_site_wrapper("submitidea");
	$jquery_site_wrapper("eventlistviewnav");
	$jquery_site_wrapper("eventlistview");
	$jquery_site_wrapper("resourcelistviewnav");
	$jquery_site_wrapper("resourcelistview");
	
	if ($('#faux_overlay').length == 1)
    {
    	$(window).resize(function() {
    		if (document.getElementById('faux_overlay').style.display != "none") {

		        $('#faux_overlay').css('width', $('.background-1').width());
		        $('#faux_overlay').css('height', $('.background-1').height());
				if ($('#au-facebox').length == 1)
			    {
			    	$('#au-facebox').css('left', ($('.background-1').width() / 2) - ($('#au-facebox').width() / 2) + 'px');
			    }
			    if ($('.ev_pop_container').length == 1)
			    {
			    	$('.ev_pop_container').css('left', ($('.background-1').width() / 2) - ($('.ev_pop_container').width() / 2) + 'px');
			    }
    		}
    	});
    	
    	$('#faux_overlay').click(function(){
        	$('#faux_overlay').fadeOut('slow');
        	$('.ev_pop_container').fadeOut('slow');
        });
    }
    
});
