function changeTab(id)
{
  var tabNo=3;
  var tabArray=new Array();
  tabArray[1]="tab1";
  tabArray[2]="tab2";
  tabArray[3]="tab3";
   var tabContent=new Array();
  tabContent[1]="content1";
  tabContent[2]="content2";
  tabContent[3]="content3";
  
  for(i=1; i<=tabNo; i++)
  {
    if(i==id)
	{
	  
	  removeClass(document.getElementById(tabArray[i]),"rTb_deselect1");
	  removeClass(document.getElementById(tabArray[i]),"rTb_deselect2");
	  removeClass(document.getElementById(tabArray[i]),"rTb_active1");
	  if(tabNo==i)
	  {
	    
		document.getElementById(tabArray[i]).className="rTb_active1";
		addClass(document.getElementById(tabArray[i]),"rTb_active1");
		//alert(document.getElementById(tabArray[i]).className);
	  }	
	  else
	  {
		document.getElementById(tabArray[i]).className="rTb_active1";
		addClass(document.getElementById(tabArray[i]),"rTb_active1");
		//alert(document.getElementById(tabArray[i]).className);
	  }
	 document.getElementById(tabContent[i]).style.display="inline";
	 document.getElementById(tabContent[i]).style.backgroundColor="#fff";
	  
	}
	else
	 {
	   removeClass(document.getElementById(tabArray[i]),"rTb_deselect1");
	   removeClass(document.getElementById(tabArray[i]),"rTb_deselect2");
	   removeClass(document.getElementById(tabArray[i]),"rTb_active1");
	  if(tabNo==i)
	  {
	    addClass(document.getElementById(tabArray[i]),"rTb_deselect2");
		document.getElementById(tabArray[i]).className="rTb_deselect2";
		//alert(document.getElementById(tabArray[i]).className)
	  }
	  else
	  {
	    addClass(document.getElementById(tabArray[i]),"rTb_deselect1");	
		document.getElementById(tabArray[i]).className="rTb_deselect1";
		//alert(document.getElementById(tabArray[i]).className)
	  }	
		document.getElementById(tabContent[i]).style.display="none";
		document.getElementById(tabContent[i]).style.backgroundColor="#fff";
	 }
  }
}

function hasClass(ele,cls) {
return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));

}



function addClass(ele,cls) {

if (!this.hasClass(ele,cls)) ele.className += " "+cls;

}



function removeClass(ele,cls) {

if (hasClass(ele,cls)) {

var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');

ele.className=ele.className.replace(reg,' ');

}

}


function entity_tab(entity_id,entityname,entityimg,url_entityname)
{		
	document.getElementById("entity_name").innerHTML= "<strong>"+entityname+"</strong> <font color='#dc7608' style='font-size:10px; font-family:Tahoma; padding-left:5px;'><a href='http://www.moneycontrol.com/profile/"+url_entityname+"/"+entity_id+"' target='_blank' style='color:#dc7608; text-decoration:none; font-size:10px; font-family:Tahoma;'>view profile</a></font>";		
	buttonOne = new Image(65, 65);
       buttonOne.src = 'http://img1.moneycontrol.com/images/entitygame/small/'+entityimg+'_65.jpg';
	document.getElementById("entity_image").src = buttonOne.src;		
	document.getElementById("entityid").value =entity_id;		
}


function votewiki(newsid,vote)
{
	entid=document.getElementById("entityid").value;
	document.getElementById("vote").value=vote;
	document.wikivote.action = "http://www.moneycontrol.com/entitygame/homepage.php";
	document.wikivote.submit();		
}


