// SEARCH
function checkEnter(e){ //e is event object passed from function invocation 
	var characterCode //literal character code will be stored in this variable 
	
	if(e && e.which){ //if which property of event object is supported (NN4) 
		e = e; 
		characterCode = e.which; //character code is contained in NN4's which property 
	} 
	else{ 
		e = event; 
		characterCode = e.keyCode; //character code is contained in IE's keyCode property 
	} 
	
	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key) 
	//Action Goes Here 
	(document.getElementById('searchtext').value=='Search' || document.getElementById('searchtext').value=='')?alert('Please Enter the Search Word'):location.href='/SearchResults.aspx?search='+document.getElementById('searchtext').value;
	return false; 
	} 
	else{ 
		return true; 
	} 
}
// TOGGLE CONTAINERS
function toggleContent(obj) {
	$(obj).parent().next().slideToggle('slow');
	$(obj).toggleClass('expanded');
}
// TAB BLOCK
function tabBlock(name,startTab,count)
{
	
	this.name = name;
	this.tabs = new Array();
	this.pages = new Array();
	this.startTab = startTab;
	if (typeof this.startTab != 'undefined')
	{
		if (this.startTab < 0 && typeof count != 'undefined' && count != null && count > 0)
		{	
			this.startTab = ( Math.floor( Math.random() * count ) + 1 ) ;
		}
	}
	else
		this.startTab = 1;
	this.add=function(id,tabobjectid)
	{
		this.pages.push($jq('#'+id));
		this.tabs['T'+this.pages.length]=$jq('#'+tabobjectid);
		if (this.pages.length==this.startTab)
			this.show(this.startTab);
		else		
			this.hide(this.pages.length-1);
	}
	this.hide=function(index)
	{
		this.pages[index].css('display','none');
	}
	this.show=function(index)
	{
		for(var i=0;i<this.pages.length;i++)
		{
			if (i==index-1)
			{
				this.pages[i].css('display','block');
				if (typeof this.tabs['T'+(i+1)]!='undefined' && this.tabs['T'+(i+1)]!=null)
					this.tabs['T'+(i+1)].addClass('current');
			}
			else
			{
				this.hide(i);
				if (typeof this.tabs['T'+(i+1)]!='undefined' && this.tabs['T'+(i+1)]!=null)
					this.tabs['T'+(i+1)].removeClass('current');
			}
		}
	}
}
