// Theme: Dark Void
// Author: Fawaz Tahir
// File Type: JS	
// Description: These are my own custom functions to enhance theme's functionallity
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//

function TabToggle(obj,Target)
{
	var $this = $(obj);
		$target = $(Target);
		$cur_ele = $(Target+".selected");
		$cur_rel = $(Target+".selected a").attr('rel');
		$new_rel = $this.attr('rel');
		
		if($cur_rel != $new_rel)
		{
			$("#"+$cur_rel).hide();
			$target.removeClass('selected');
			$this.parent().addClass('selected');
			$("#"+$new_rel).show();
					
		} else {
			return false;	
		}
}
var rel;
function OwnAccordin(obj)
{
	var $this = $(obj);
		id = $this.attr('rel');
		
	if(rel != id || rel == undefined)
	{		
		$this.parent().parent().children().filter('.side_box').animate({height: "hide"}, 600, "easeOutQuad", function(){});
		$('#'+id).animate({height: "show"}, 600, "easeOutQuad", function(){});
		rel = $this.attr('rel');
	} else {
		if(rel == id && $("#"+id).css('display') == "none"){
			$("#"+id).animate({height: "show"}, 600, "easeOutQuad", function(){});
		}else{	
			$("#"+id).animate({height: "hide"}, 600, "easeOutQuad", function(){}); }
	}
	
}

function SearchThis(object)
{
	var obj = $(object);
	obj.parent().siblings().removeClass('selected').end().addClass('selected');
	$('#selectedText').text(obj.text());
	$('#query').val("Search "+obj.text());
	$('#searchType').val(obj.attr('id'));			
}

function ToggleSearch(selector)
{
	$(selector).bind({
		focus : function() {
			var searchType = 	$("#searchSelectWrapper li").filter('.selected').children().text();
			if(this.defaultValue == this.value || this.value == "Search "+searchType)
				this.value = "";
		},
		blur : function () {
			var searchType = 	$("#searchSelectWrapper li").filter('.selected').children().text();
			if(this.value == "")
				if(this.defaultValue != "")
					this.value = this.defaultValue;
				else
					this.value = "Search "+searchType;		
		}
	});
}
