function verticalRotator(name,parentid,listHeight,detailHeight,timercount,pausecount,currentClass,rotateClass,slideSpeed)
{
	this.name = name;
	this.initialized = false;
	this.currentIndex = 0;
	this.slideSpeed = slideSpeed;
	this.listItems = new Array();
	this.detailItems = new Array();
	this.currentClass = currentClass;
	this.rotateClass=rotateClass;
	this.timer = false;
	this.timercount = timercount;
	this.pausecount = pausecount;
	this.parent = $jq('#'+parentid);
	this.listHeight=listHeight;
	this.detailHeight=detailHeight;
	this.load = function(startIndex,listName,divName)
	{
		var i = startIndex;
		var x = document.getElementById(listName+i);
		var y = document.getElementById(divName+i);
		while (typeof x!='undefined'&&x!=null && typeof y!='undefined' && y!=null)
		{
			this.listItems.push($jq(x));
			this.detailItems.push($jq(y));
			i++;
			x = document.getElementById(listName+i);
			y = document.getElementById(divName+i);
		}
		
		this.init();
	}
	this.init = function()
	{
		if (this.count()>0)
		{
			this.parent.css('height',this.count()*this.listHeight+this.detailHeight);
			this.detail(0);
		}
		else
		{
			this.parent.css('height',0);			
		}
		this.initialized=true;
		this.start();
	}
	this.start = function()
	{
		this.play(this.timercount);
	}
	this.play = function(duration)
	{
		this.pause();
		this.timer=setTimeout(this.name+'.rotate();',duration);
	}
	this.delay = function()
	{
		this.play(this.pausecount);
	}
	this.pause = function()
	{
		if (this.timer)
			clearTimeout(this.timer);
	}
	this.rotate = function()
	{
		if (this.currentIndex+1<this.count())
			this.detail(this.currentIndex+1);
		else
			this.detail(0);
		this.start();
	}
	this.detail = function(index)
	{
		if (index<this.count()&&index>=0)
		{
			if (index!=0)
			{
				this.listItems[index].addClass(this.rotateClass);
			}
			if (this.initialized)
			{
				this.listItems[this.currentIndex].removeClass(this.currentClass);
				this.listItems[this.currentIndex].removeClass(this.rotateClass);
			}
			for (var i=0;i<this.count();i++)
			{
				if (i!=index)
					this.detailItems[i].slideUp(this.slideSpeed);
			}
			if (index==0)
			{
				this.listItems[index].addClass(this.rotateClass);
			}
			if (this.initialized)
				this.detailItems[index].slideDown(this.slideSpeed,eval('function callback() {'+this.name+'.listItems[index].addClass('+this.name+'.currentClass)}'));
			this.currentIndex=index;
		}
		return false;
	}
	this.count = function()
	{
		return this.listItems.length;
	}
}
function tabBlock(name,defaultId)
{
	this.name = name;
	this.tabs = new Array();
	this.pages = new Array();
	this.tabs['T1']=$jq('#'+defaultId);
	this.add=function(id)
	{
		this.pages.push($jq('#'+id));
		if (this.pages.length==1)
			this.show(1);
		else		
			this.hide(this.pages.length-1);
	}
	this.hide=function(index)
	{
		this.pages[index].css('display','none');
	}
	this.show=function(index,obj)
	{
		if (typeof obj != 'undefined' && obj!=null)
		{
			this.tabs['T'+index]=$jq(obj);
		}

		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');
			}
		}
	}
}

// PRINTING FUNCTIONALITY FOR ARTICLES
var srcvalue = '';
var counter = 0;
var timer;
function printcontent(panename) {
	if (panename==null||panename=='')
	panename = 'ContentPane'
	myRef = window.open('/print.aspx','mywin','left=20,top=20,width=700,height=700,toolbar=1,resizable=1,scrollbars=yes');
	srcvalue = document.getElementById('dnn_' + panename).innerHTML;
	counter = 10;
	waitfortarget();
}

function waitfortarget() {
	counter--;
	if (!myRef.document.getElementById('dnn_ContentPane'))
	{
	//DO NOTHING
		if (counter > 0) {
			timer=setTimeout("waitfortarget()", 1500);
		}
		else {
			alert('Unable to load article. Please try again later.');
		}
	}
	else {
	donetarget();
	}
}
function donetarget() {
	myRef.document.getElementById('dnn_ContentPane').innerHTML = srcvalue;
	myRef.print();
}
function ratings(rateing_id,rating_class)
{
    document.getElementById('rate').className="rating "+rating_class+"star";
    var value='';
    switch(rating_class)
        {
            case"one":
            value=1;
            break;
            case"two":
            value=2;
            break;
            case"three":
            value=3;
            break;
            case"four":
            value=4;
            break;
            case"five":
            value=5;
            break;
        }
    document.getElementById('rateIt').value=value;
    document.getElementById('comment').focus();
}