//script for header navigation
var prev_link_id = '',prev_nav_id = '',global_prev_nav_id = '';
function invokeSubnavigation(thisid,action)
{

	var link_id = thisid.id;
	var nav_id = 'parent_'+link_id;
	if(action == 'onmouseover')
	{
		if(document.getElementById(nav_id))
		{
			document.getElementById(link_id).style.backgroundColor='#ffffff';
			document.getElementById(link_id).style.borderBottom='none';
			document.getElementById(nav_id).style.display = 'block';
		}
		if(document.getElementById(prev_nav_id) && (prev_nav_id != nav_id))
		{
			document.getElementById(prev_link_id).style.borderBottom='1px solid #BE2931';
			document.getElementById(prev_link_id).style.backgroundColor='#ffffff';
			document.getElementById(prev_nav_id).style.display = 'none';

		}
		prev_nav_id = nav_id;
		prev_link_id = link_id;		
		//alert(prev_nav_id+'-'+prev_link_id);
	}
	else
	{
		link_id = global_prev_nav_id;
		nav_id = 'parent_'+link_id;
		document.getElementById(link_id).style.backgroundColor='#ffffff';	
		document.getElementById(link_id).style.borderBottom='none';
		if(document.getElementById(prev_link_id) && (prev_link_id != link_id))
		{
			document.getElementById(prev_link_id).style.backgroundColor='#ffffff';
			document.getElementById(prev_link_id).style.borderBottom='1px solid #BE2931';
		}
		if(document.getElementById(nav_id))
			document.getElementById(nav_id).style.display = 'block';
		if(document.getElementById(prev_nav_id) && (prev_nav_id != nav_id))
			document.getElementById(prev_nav_id).style.display = 'none';

		prev_nav_id = nav_id;
		prev_link_id = link_id;

	}
	return;
}

function setNavigationDefault()
{
	var self_url = document.location.href;
        self_url = self_url.replace('http://entertainment.oneindia.in/','');
        var cat_names = self_url.split('/');
        var category = cat_names[0];
	global_prev_nav_id = category;
	if(document.getElementById(category))
	{

		invokeSubnavigation(document.getElementById(category),'onmouseover');
	}
	
}




function showPopup1 (targetObjectId, eventObj) {
    if(eventObj) {
    hideCurrentPopup();
    eventObj.cancelBubble = true;
	version=0
    if( changeObjectVisibility(targetObjectId, 'visible') ) {
        window.currentlyVisiblePopup = targetObjectId;
        return true;
    } else {
        return false;
    }
    } else {
    }
}


function isValid() {
 var mail=document.newsletterform.email.value;
 if (mail.indexOf(' ')==-1 
      && 0<mail.indexOf('@')
      && mail.indexOf('@')+1 < mail.length
 ) return true;
 else alert ('Invalid email address!')
 return false;
}




function selectnewsletter() 
{ 
document.newsletterform.email.select();
} 


function change_class(id, newClass) {
  identity=document.getElementById(id);
  identity.className=newClass;
}

	function show_tab(tab){

      var tabs = ["","top_cont_1","top_cont_2"];

        for(i=1; i < tabs.length; i++){
          var obj = document.getElementById(tabs[i]);
          change_class("ttab_nav_"+i, "tab_main_inactive")
          obj.style.display = "none";
        }
          
        var obj = document.getElementById("top_cont_"+tab);
        obj.style.display = "block";
        change_class("ttab_nav_"+tab, "tab_main_active")
      }
	  
	
	
	
	// for main changes
function change_class(id, newClass) {
  identity=document.getElementById(id);
  identity.className=newClass;
}

	function show_tab(tab){

      var tabs = ["","top_cont_reprbo_1","top_cont_reprbo_2","top_cont_reprbo_3"];

        for(i=1; i < tabs.length; i++){
          var obj = document.getElementById(tabs[i]);
          change_class("ttab_nav_reprbo_"+i, "tab_main_inactive_reprbo")
          obj.style.display = "none";
        }
          
        var obj = document.getElementById("top_cont_reprbo_"+tab);
        obj.style.display = "block";
        change_class("ttab_nav_reprbo_"+tab, "tab_main_active_reprbo")
      }
	  
	  
	  
	  //for reviews
	  
	 function change_class1(id, newClass) {
  identity=document.getElementById(id);
  identity.className=newClass;
}
	function show_tab1(tab){
      var tabs = ["","top_cont_rs_1","top_cont_rs_2","top_cont_rs_3","top_cont_rs_4","top_cont_rs_5"];
        for(i=1; i < tabs.length; i++){
          var obj = document.getElementById(tabs[i]);
          change_class("ttab_nav_rev_"+i, "tab_main_inactive_reviews_sub")
          obj.style.display = "none";
        }
        var obj = document.getElementById("top_cont_rs_"+tab);
        obj.style.display = "block";
        change_class("ttab_nav_rev_"+tab, "tab_main_active_reviews_sub")
      }

	  
	  //for previews
	 function change_class2(id, newClass) {
  identity=document.getElementById(id);
  identity.className=newClass;
}
	function show_tab2(tab){
      var tabs = ["","top_cont_pre_1","top_cont_pre_2","top_cont_pre_3","top_cont_pre_4","top_cont_pre_5"];
        for(i=1; i < tabs.length; i++){
          var obj = document.getElementById(tabs[i]);
          change_class("ttab_nav_pre_"+i, "tab_main_inactive_preview_sub")
          obj.style.display = "none";
        }
        var obj = document.getElementById("top_cont_pre_"+tab);
        obj.style.display = "block";
        change_class("ttab_nav_pre_"+tab, "tab_main_active_preview_sub")
      }
	  
	  // for box office
	  
	  function change_class3(id, newClass) {
  identity=document.getElementById(id);
  identity.className=newClass;
}
	function show_tab3(tab){
      var tabs = ["","top_cont_bo_1","top_cont_bo_2","top_cont_bo_3","top_cont_bo_4","top_cont_bo_5"];
        for(i=1; i < tabs.length; i++){
          var obj = document.getElementById(tabs[i]);
          change_class("ttab_nav_boxo_"+i, "tab_main_inactive_bo_sub")
          obj.style.display = "none";
        }
        var obj = document.getElementById("top_cont_bo_"+tab);
        obj.style.display = "block";
        change_class("ttab_nav_boxo_"+tab, "tab_main_active_bo_sub")
      }
	
	
	
	
	
	
	


function change_class(id, newClass) {
  identity=document.getElementById(id);
  identity.className=newClass;
}

    function show_tab(tab){

      var tabs = ["","top_cont_1","top_cont_2"];

        for(i=1; i < tabs.length; i++){
          var obj = document.getElementById(tabs[i]);
          change_class("ttab_nav_"+i, "tab_main_inactive_bb")
          obj.style.display = "none";
        }
          
        var obj = document.getElementById("top_cont_"+tab);
        obj.style.display = "block";
        change_class("ttab_nav_"+tab, "tab_main_active_bb")
      }
	  


	  
	  
	  
	  
	  
	  
	  
	  function change_class_click(id, newClass) {
  identity=document.getElementById(id);
  identity.className=newClass;
}

	function show_tab_click(tab){

var tabs = ["","top_cont_click1","top_cont_click2","top_cont_click3"];

        for(i=1; i < tabs.length; i++){
          var obj = document.getElementById(tabs[i]);
          change_class_click("ttab_nav_click"+i, "tab_main_inactive_click")
          obj.style.display = "none";
        }
          
        var obj = document.getElementById("top_cont_click"+tab);
        obj.style.display = "block";
        change_class_click("ttab_nav_click"+tab, "tab_main_active_click")
      }
	   
	  
// Script For new Right starts

var right_cur_id,right_pre_id;

function showRightSlide( id )
{
	var content_slide = '';
	var bg = '',arrow = '';
	var tab_id = '';

	content_slide = "rightslide_";
	tab_id = "clicktab_";
	bg = "bg_";
	arrow = "arrow_";

        right_cur_id = id;
        if(document.getElementById(content_slide+right_cur_id))
        {
                document.getElementById(content_slide+right_cur_id).style.display = 'block';
		document.getElementById(bg+right_cur_id).className = "display_bg";
		document.getElementById(arrow+right_cur_id).className = "display_arrow";

        }
        if( right_cur_id != right_pre_id )
        if(document.getElementById(content_slide+right_pre_id))
        {
                document.getElementById(content_slide+right_pre_id).style.display = 'none';
		document.getElementById(bg+right_pre_id).className = "normal_bg";
		document.getElementById(arrow+right_pre_id).className = "normal_arrow";
        }

        else
        {
                right_pre_id = '1';
                if( right_cur_id != right_pre_id )
                {
                        document.getElementById(content_slide+right_pre_id).style.display = 'none';
			document.getElementById(bg+right_pre_id).className = "normal_bg";
			document.getElementById(arrow+right_pre_id).className = "normal_arrow";
                }

        }


        right_pre_id = right_cur_id;

        return;
}

function invokeDidUMiss( category_id ) // for the category_id
{
       var pageURL = "/scripts/cms/getArticleDetails.php?category_id="+category_id+"&type=did-u-miss";
       var status = AjaxRequest.get(
               {
                       'url':pageURL
                       ,'onSuccess':function(req){
                                       content = req.responseText;
					if( content.length > 0 )
					{
						document.getElementById('did-u-miss').innerHTML = content;
					}
                                       
                               }
                       ,'onError':function(req){ document.getElementById('did-u-miss').innerHTML = '';}
               }
       );

	return;

}


function invokeOnLine( html_id )
{
	if(document.getElementById(html_id))
		html_id = html_id;
	else
		html_id = html_id.id;


	var index = document.getElementById(html_id).selectedIndex;
	var story_tag = document.getElementById(html_id).options[index].text;
	var pageURL = "/scripts/cms/getArticleDetails.php?tag_name="+story_tag+"&type=latest-story";
	var status = AjaxRequest.get(
			{
			'url':pageURL
			,'onSuccess':function(req){
			content = req.responseText;
			if( content.length > 0 )
			{
			document.getElementById('latest_story').innerHTML = content;
			}

			}
			,'onError':function(req){ document.getElementById('latest_story').innerHTML =''; }
			}
			);


	return;
}
