//script for newsletter subscription



function check(){
    var f = document.newsletter_subscribeform;
    var n = f.elements.length;
    for(i=0;i<n;i++) {
        if((f.elements[i].type == "text") && (f.elements[i].value.match(/^\s*$/))){
            alert('Please enter correct emailid without special charecters');
            return false;
        }
    }
        if(!f.email.value.match(/^[\w\_\-\.]+\@[\w\_\-\.]+\.[\w\_\-\.]+$/)){
            alert('Please enter correct email id');
            return false;
        }
            return true;
}


function checkById(){
        if(!document.getElementById('email').value.match(/^[\w\_\-\.]+\@[\w\_\-\.]+\.[\w\_\-\.]+$/)){ 
            alert('Please enter correct email id');
            return false;
        }
            return true;
}


function postform(act,form){
   form.action1.value=act;
   form.method='post';
   if(check()){
      form.submit();
      return true;
   }else{
      return false;
   }
}

function postformById(act,form){
   form.action1.value=act;
   form.method='post';
   if(checkById()){
      form.submit();
      return true;
   }else{
      return false;
   }
}

function selecttext()
{
document.newsletter_subscribeform.email.select()
}
//script for newsletter subscription
function selectTextById()
{
	if(document.getElementById('email').value == 'Enter email id')
		document.getElementById('email').select()
}


//news letter script


var prev_slide_id = 0;
function showHomePageSlide( slide_id )
{
	if(prev_slide_id == 0 )
	{
		document.getElementById('section1').style.display = 'none';
	}
	if( slide_id != prev_slide_id )
	{
		if(document.getElementById(slide_id))
		{
			document.getElementById(slide_id).style.display = 'block';
		}
		if(document.getElementById(prev_slide_id))
		{
			document.getElementById(prev_slide_id).style.display = 'none';
		}
	}
	prev_slide_id = slide_id;
}

// script for slide starts

function ManageTabPanelDisplay() {

var idlist = new Array('thatscricket_tab1focus','thatscricket_tab2focus','thatscricket_tab3focus','thatscricket_tab4focus','thatscricket_tab1ready','thatscricket_tab2ready','thatscricket_tab3ready','thatscricket_tab4ready','thatscricket_content1','thatscricket_content2','thatscricket_content3','thatscricket_content4');

if(arguments.length < 1) { return; }
for(var i = 0; i < idlist.length; i++) {
   var block = false;
   for(var ii = 0; ii < arguments.length; ii++) {
      if(idlist[i] == arguments[ii]) {
         block = true;
         break;
         }
      }
   if(block) { document.getElementById(idlist[i]).style.display = "block"; }
   else { document.getElementById(idlist[i]).style.display = "none"; }
   }
}
// script for slide ends

// 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 #394CB5';
			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 #394CB5';
		}
		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://thatscricket.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 placeLeftImage()
{
        var adcontent='';
        if(document.getElementById('left_ad_below_img'))
        {
                adcontent=document.getElementById('left_ad_below_img').innerHTML;
                if(document.getElementById('article_newsletter'))
                        document.getElementById('article_newsletter').innerHTML= adcontent;
        }
        return;
}



function changeFontSize(type){
        var tar_class;
        switch(type){
            case 'small':
                tar_class = 'small';
                break;
            case 'medium':
                tar_class = 'medium';
                break;
            case 'large':
                tar_class = 'large';
                break;
        }
        document.getElementById('story').className=type;
    }


	
var upnext_cat_id = 1;
function navigatePrevStories(navigation,record_id)
{
        var self_url = document.location.href;
        var pageURL = "/scripts/cms/getArticleDetails.php?record_id="+record_id+"&type=prev_story&source_url="+self_url;
        var status = new AjaxRequest.get(
               {
                       'url':pageURL,
                       'onSuccess':function(req2){
                                        var content = req2.responseText;
                                        if( content.length > 0 )
                                        {
                                                if(document.getElementById('previous_story'))
                                                   document.getElementById('previous_story').innerHTML = content;
                                        }

                               },
                       'onError':function(req2){
                                                if(document.getElementById('previous_story'))
                                                        document.getElementById('previous_story').innerHTML = 'Server is busy. Try later!';
                                        }
               }
        );

        return;
}

function navigateNextStories(navigation,record_id)
{
        var self_url = document.location.href;
        var pageURL = "/scripts/cms/getArticleDetails.php?record_id="+record_id+"&type=next_story&source_url="+self_url;
        var status = new AjaxRequest.get(
               {
                       'url':pageURL,
                       'onSuccess':function(req1){
                                        var content = req1.responseText;
                                        if( content.length > 0 )
                                        {
                                                if(document.getElementById('next_story'))
                                                        document.getElementById('next_story').innerHTML = content;
                                        }

                               },
                       'onError':function(req1){
                                                if(document.getElementById('next_story'))
                                                        document.getElementById('next_story').innerHTML = 'Server is busy. Try later!';
                                        }
               }
        );

        return;
}
	
	
	

// JavaScript Document

function selectname()
{
document.loginForm.login.select()
}
//-->
function dologin(form,login_url)
{
	loginname = form.login.value.split("@");
	if(loginname[1])
		form.login.value=loginname[0];
}

function parse( )
{
  var regexS = "[\\?&]"+q+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );
  if( results == null )
    return "";
  else
    return results[1];
}


var cur_id,pre_id;
var right_cur_id,right_pre_id;
var pre_color = '';

function showSlide( id)
{
	var content_slide = '';
	var tab_id = '';
	var cur_class = '',pre_class = '';

	content_slide = "contentslide_";
	tab_id = "linktab_";
	cur_class = "onclick_red";
	pre_class = "onclick_blue";

        cur_id = id;
        if(document.getElementById(content_slide+cur_id))
        {
                document.getElementById(content_slide+cur_id).style.display = 'block';
                document.getElementById(tab_id+cur_id).className = cur_class;

        }
        if( cur_id != pre_id )
        if(document.getElementById(content_slide+pre_id))
        {
                document.getElementById(content_slide+pre_id).style.display = 'none';
                document.getElementById(tab_id+pre_id).className = pre_class;
        }

        else
        {
                pre_id = '1';
                if( cur_id != pre_id )
                {
                        document.getElementById(content_slide+pre_id).style.display = 'none';
                        document.getElementById(tab_id+pre_id).className = pre_class;
                }

        }


        pre_id = cur_id;

        return;
}
function showRightSlide( id,cur_color,new_color,default_color )
{
	var color = '';
        var content_slide = '';
        var bg = '',arrow = '';
        var tab_id = '';
        content_slide = "rightslide_";
        tab_id = "clicktab_";
        bg = "bg_";
        arrow = "arrow_";
        color = 'color_';
	
	if(pre_color == '')
		pre_color = default_color;

        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).style.backgroundColor = new_color;
                document.getElementById(arrow+right_cur_id).style.color = '#FFFFFF';
                document.getElementById(arrow+right_cur_id).style.backgroundColor = new_color;
		document.getElementById(arrow+right_cur_id).style.backgroundImage = "url(/img/arrow-down1.gif)";
		document.getElementById(arrow+right_cur_id).style.backgroundRepeat = 'no-repeat';
		document.getElementById(arrow+right_cur_id).style.backgroundPosition = 'left center';
		document.getElementById(color+right_cur_id).style.backgroundColor = new_color;
        }
        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).style.backgroundColor = cur_color;
                document.getElementById(arrow+right_pre_id).style.backgroundColor = cur_color;
                document.getElementById(color+right_pre_id).style.backgroundColor = pre_color;                
		document.getElementById(arrow+right_pre_id).style.backgroundImage = "url(/img/brn-arrow-side1.gif)";
                document.getElementById(arrow+right_pre_id).style.color = '#AB2E36';
		document.getElementById(arrow+right_pre_id).style.backgroundPosition = 'left center';
		document.getElementById(arrow+right_pre_id).style.backgroundRepeat = 'no-repeat';
        }
        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).style.backgroundColor = cur_color;
		        document.getElementById(arrow+right_pre_id).style.backgroundColor = cur_color;
		        document.getElementById(color+right_pre_id).style.backgroundColor = pre_color;       
			document.getElementById(arrow+right_pre_id).style.backgroundImage = "url(/img/brn-arrow-side1.gif)";
                	document.getElementById(arrow+right_pre_id).style.color = '#AB2E36';
			document.getElementById(arrow+right_pre_id).style.backgroundRepeat = 'no-repeat';
			document.getElementById(arrow+right_pre_id).style.backgroundPosition = 'left center';
                }

        }

        right_pre_id = right_cur_id;
	pre_color = new_color;

        return;
}


function invokeDidUMiss( category_id,category_name ) // for the category_id
{
	upnext_cat_id = category_id;
	return;

       var pageURL = "/scripts/cms/getArticleDetails.php?category_id="+category_id+"&type=did-u-miss&category_name="+category_name;
       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 showRelatedTopics()
{
	if(document.getElementById('tags_container'))
	{
		document.getElementById('tags_container').style.display = 'none';
		var tag_output = document.getElementById('tags_container').innerHTML;

		if(document.getElementById('tag_output'))
		{
			document.getElementById('tag_output').innerHTML = tag_output;
		}
	}
}

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 self_url = window.location.href;
        var category_name = self_url.split('/')[3];

	var pageURL = "/scripts/cms/getArticleDetails.php?tag_name="+story_tag+"&type=latest-story&tag_index="+index+"&category_name="+category_name;
	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;
}





function showTopics()
{
        var body_content = '';
        var new_content = '', patt = '';
        var topics = '',tag_arr = '',story_content = '';
        body_content = document.getElementsByTagName('div');
        for( var x in body_content )
        {
                if( body_content[x].className == 'article_middle_width' )
                {
                        story_content = body_content[x].innerHTML;
                        var strpos = story_content.indexOf('Tags:');
                        var nst = parseInt(strpos)+13;
                        if(strpos == -1 )
                        {
                                strpos = story_content.indexOf('Topics:');
                                nst = parseInt(strpos)+15;
                        }

                        var endpos = story_content.indexOf("</p>",nst);
                        filter_content = strip_tags(story_content.substring(nst,endpos));
                        tag_arr = filter_content.split(',');
                        for( var tag in tag_arr )
                        {
                                patt = trim(tag_arr[tag]);
                                patt = '/'+patt+'/gi';

                                if( story_content.match(eval(patt)) && story_content.match(eval(patt)).length > 1 )
                                {
					return;
					var tag_val = trim(tag_arr[tag]).replace(/\s+/gi,'-');
                                        patt = trim(tag_arr[tag]);
                                        patt = '/'+patt+'/i';

                                        new_content = '<span style="color:blue;"><a href="/search.html?topic='+tag_val+'" style="text-decoration:none;">'+trim(tag_arr[tag])+'</a></span>';

                                        story_content = story_content.replace(eval(patt),new_content);
                        		body_content[x].innerHTML = story_content; //filter_content;
                                }
                        }
                }
        }
}
// Javascript Trim() function
function trim(str){
    if (str == null){return ("");}
          return str.replace(/(^\s+)|(\s+$)/g,"");
}
//                //Strip html tags
function strip_tags( str ){
return str.replace(/<\/?[^>]+>/gi, '');
}
//
// Function to submit article vote ends

function activateTab(id, mod, no_tabs) {
    for (var i=1; i<=no_tabs; i++) {
        if  (p_o(mod+"_tc"+i)) {
            if (id == i) {
                p_o(mod+"_tc"+i).style.display = "block";
                p_o(mod+"_t"+i).className= "active";
            } else {
                p_o(mod+"_tc"+i).style.display = "none";
                p_o(mod+"_t"+i).className = "";
            }
        }
    }
}

var toFcs=null;
function p_o(o){return document.getElementById(o);}
function showTab(did,cid,cback){
    if(did==null)return false;
    var div=p_o(did);
    var tab=p_o(cid);
    if(tab==null)return false;
    var tabs=div.childNodes;
    for(var i=0;i<tabs.length;i++){
        if(tabs[i].nodeType==1&&tabs[i]!=tab){
            tabs[i].className='dn';
        }
    }
    tab.className='di';
    if(cback!=null)eval(cback);
    fcs();
}
function mkTab(did,cid,htm){
    var div=p_o(did);
    if(div==null)return;
    var newT=false;
    var tab=p_o(cid);
    if(!tab){
        tab=document.createElement('div');
        tab.setAttribute('id',cid);
        newT=true;
    }
    tab.className='dn';
    tab.innerHTML=htm;
    if(newT)div.appendChild(tab);
}
function allLI(arg) {
    if (p_o(arg)) {
        if (tablisttag==null)tablisttag='li';
        var x = p_o((arg)).getElementsByTagName(tablisttag).length;
        while (x>0) {
            if (p_o((arg+x)))p_o((arg+x)).className="";
            if (p_o((arg+'a'+x)))p_o((arg+'a'+x)).className="";
            x--;
        }
    }
}
function selTab(arg,i){
    if(arg!=null){
        allLI(arg);
        lidx = (arg +i);
        liadx = (arg+'a'+i);
    }
    if(arg == 'r'){
        p_o(lidx).className="curr";
    }else if(arg!=null){
        if (p_o(lidx))p_o(lidx).className="over";
        if (p_o(liadx)){
            if(dlscheme[i]){
                p_o(liadx).className="sel "+ dlscheme[i];
            }else{
                p_o(liadx).className="sel";
            }
        }
    }
}
function pGet(url,i,arg,id,cback,frce,fcsId){
    var cid=id+i;
    toFcs=fcsId;
    if((frce!=null&&frce)||showTab(id,cid,cback)==false){
        var uid=(new Date()).getTime();
        url+='&uid='+uid+'&cid='+cid;
        if(arg!=null)url+='&targ='+arg;
        if(i!=null)url+='&tid='+i;
        if(cback!=null)url+='&cback='+escape(cback);
    }else{
        selTab(arg,i);
    }
}
function fcs(id){
    if(id==null){
        if(toFcs==null)return;
        id=toFcs;
    }
    var o=p_o(id);
    toFcs=null;
    if(!o)return;
    if(o.getAttribute("tabIndex")==null){
        switch(o.nodeName.toLowerCase()){
            case 'a':
            case 'body':
            case 'button':
            case 'frame':
            case 'iframe':
            case 'img':
            case 'input':
            case 'object':
            case 'select':
            case 'textarea':
                break;
            default:
                o.setAttribute("tabIndex","-1");
                break;
        }
    }
    if(o.focus){
        if(document.all){
            o.focus();
            o.focus(); 
        }else{
            setTimeout('p_o("' + o.id + '").focus()', 0);
        }
    }
}
function ae(o,et,fn){
    var x;
    if(x=o.addEventListener)x(et,fn,0);
    else if(x=o.attachEvent){
        o['e'+et+fn]=fn;
        o[et+fn]=function(){o['e'+et+fn](window.event);}
        x('on'+et,o[et+fn]);
    }
}
function omo(id){
    s_objectID=id;
}

var colorscheme='';
var dlscheme = new Array();
var c=0;
var tkr='';
var dlini=false;
var to=null;
var pto=null;
var dlnum=1;
var nDls=1;
var dlnext = new Array();
var dldur=80;
var dllast;
var qfcs;
var troflags = new Array();
var dlpops = new Array();
var pd;
var psed=false;
var fitab='';
var pctrl_flag = 1;

function dlinit(){
    if(dlini)return;
    dlini=true;
    to=setTimeout('dlgo()',getdldur(dlnum));
    if(p_o('pt'+dlnum))pt();
}
function pt(){
    if(!pd)return;
    c++;
    if(c==pd.length)c=0;
    pto=setTimeout('pt()',3000);
}
function dlf(){
    if(pctrl_flag == 1) {
        p_o('dlpi').className="dlpi";
        pctrl_flag = 0;
    } else
        psed = true;
    return dlgo('FWD');
}
function dlb(){return dlgo('BAK')}
function dlgo(typ,num){
    var fcsId='dlC';
    dlini=true;
    dllast=dlnum;
    switch(typ){
        case 'NUM':
            if(dlnum==num)return false;
            clrT();
            dlnum=num;
            psed=true;
            break;
        case 'BAK':
            clrT();
            dlnum--;
            psed=true;
            break;
        case 'FWD':
            clrT();
            dlnum++;
            break;
        default:
            if(!psed) dlnum++;
            fcsId=null;
            break;
    }
    if(dlnum>nDls){
        dlnum=1;
    }else if(dlnum<1){
        dlnum=nDls;
    }
    if(nDls!=1){
        var pUrl = '';
        if(dlpops['dl'+dlnum]) {
            pUrl += '&dlitem='+dlpops['dl'+dlnum];
        }
        pGet('',dlnum,'dlt','dlC','dlc()',null,fcsId);
    }

    if (p_o("dyn_sqrblock")) {
        for (var i=1; i<=nDls; i++) {
            if (p_o("dl_sqr"+i)) {
                if (i == dlnum)
                    p_o("dl_sqr"+i).style.background = "#FFF";
                else
                    p_o("dl_sqr"+i).style.background = "#BABABA";
            }
        }
    }
    setPse();
    return false;
}
function dlc() {
    dlteaser();
    dlcnt();
    if(!psed){
        to=setTimeout('dlgo()',getdldur(dlnum));
    }
}
function dlcnt() {
    if (p_o('dlcount')) {
        p_o('dlcount').innerHTML = dlnum + '/' + nDls;
    }
}
function dlteaser() {
    if (p_o('dlnext')) {
        if (dlnum == nDls) {
            nextDL = 1;
        } else {
            nextDL = dlnum + 1;
        }
        if (dlnext[nextDL]) {
            p_o('dlnext').innerHTML = dlnext[nextDL];
        } else {
            p_o('dlnext').innerHTML = '';
        }
    }
}
function dlblr() {
    qfcs=0;
}
function dlfcs() {
    qfcs=1;
}
function dlp(){
    if(psed){
        psed=false;
        to=setTimeout('dlgo()',getdldur(dlnum));
    }else{
        psed=true;
        clrT();
    }
    setPse();
    return false;
}
function setPse(){
    if(!p_o('dlpi'))return;
    if(psed){
        p_o('dlpi').className="dlpi_off";
    }else{
        p_o('dlpi').className="dlpi";
    }
}





function track(id,once) {
    if(!(o=p_o(id)))return;
    if(once && troflags[id]){
        return;
    }
    var d=o.innerHTML;
    var urls=d.split(",");
    if(once)troflags[id] = 1;
}
function clrT(){
    if(to){
        clearTimeout(to);
    to=null;
    }
}

ae(window,'load',dlinit);

function getdldur(dlnum) {
    if (o=p_o('dlcyc'+dlnum)) {
        return (o.innerHTML * 1500);
    }
    return dldur;
}


  
	

			

function getUserCityAndCountry(sub_frm)
{
        var self_url = document.location.href;
        var pageURL = "/scripts/cms/getArticleDetails.php?type=get-city";
        var status = new AjaxRequest.get(
               {
                       'url':pageURL,
                       'onSuccess':function(req2){
									var content = req2.responseText;
									content_arr = content.split("-!@#-");
									city = content_arr[0];
									country = content_arr[1];
									document.getElementById('newsletter_city').value = city;
									document.getElementById('newsletter_country').value = country;
									sub_frm.submit();
                               },
                       'onError':function(req2){}
               }
        );

        return false;
}

			




// JavaScript Document

/* common js*/
function isValid() {
 var mail=document.form1.email.value;
 if (mail.indexOf(' ')==-1 
      && 0<mail.indexOf('@')
      && mail.indexOf('@')+1 < mail.length
 ) return true;
 else alert ('Invalid email address!')
 return false;
}

function selectname() 
{ 
document.loginForm.login.select()
} 
function dologin(form,login_url)
{
	loginname = form.login.value.split("@");
	if(loginname[1])
		form.login.value=loginname[0];
}

function selecttext() 
{ 
document.form1.email.select()
} 

/* poll js*/
function vote()
	{
	var doc = document.poll;
	var check = false;
	for(i=0;i<doc.options.length;i++)
	{

		if(doc.options[i].checked)
		{
		check = true;
		break;
		}
	}

	if(check)
	{
	window.open("http://polls.oneindia.in/polls.php?submit=submit&catid="+doc.catid.value+"&question="+doc.question.value+"&options="+doc.options[i].value,"poll","width=450,height=300,scrollbars=1;")
	return false;
	}
	else{
	alert("Please choose an option");
	return false;
	}
	return false;
	}
	
	
	
	
	
// OLD JS CAN BE DELETED AFTER LIVE


/* script js*/

// scorecard functions
function fopen4() {
window.open('http://thatscricket.oneindia.in/data/score_data/Aus-Ind-2004-01-09.html','','height=500,width=500,scrollbars');
}

// scorecard functions
function fopen3() {
window.open('http://thatscricket.oneindia.in/data/score_data/Ind-Eng-2002-09-05.html','','height=500,width=500,scrollbars');
}

// dream team contest
function fopen5() {
window.open('http://thatscricket.oneindia.in/specials/wc2003/rules.html','','height=480,width=520,scrollbars');
}

function fopen6() {
window.open('http://thatscricket.oneindia.in/specials/wc2003/prizes.html','','height=300,width=350,scrollbars');
}

// drop down for series on right
function Links(cname) 
{
if(cname=="forthtest")
{
if (document.forth.forthtest.options[document.forth.forthtest.selectedIndex].value != "") 
{location = document.forth.forthtest.options[document.forth.forthtest.selectedIndex].value;}
}

if (cname == "forthloi") {
if (document.fifth.forthloi.options[document.fifth.forthloi.selectedIndex].value != "") 
{location = document.fifth.forthloi.options[document.fifth.forthloi.selectedIndex].value;}
}
if (cname == "recenttest") {
if (document.recent.recenttest.options[document.recent.recenttest.selectedIndex].value != "") 
{location = document.recent.recenttest.options[document.recent.recenttest.selectedIndex].value;}
}
if (cname == "recentloi") {
if (document.recent1.recentloi.options[document.recent1.recentloi.selectedIndex].value != "") 
{location = document.recent1.recentloi.options[document.recent1.recentloi.selectedIndex].value;}
}
if (cname == "archives") {
if (document.archive.archives.options[document.archive.archives.selectedIndex].value != "") 
{location = document.archive.archives.options[document.archive.archives.selectedIndex].value;}
}

}
//-------------------------------------Captain/Non captain------------------------------------------------------
function getPlayers() {
	
	var cid = window.document.getElementById('country').value;
	alert("hi");
	window.document.location.href=window.document.location.href+"?cid="+cid;
}

//-------------------------------------Team stats------------------------------------------------------

function getCountry(url)
{
	var con = window.document.getElementById('coun').value;
	alert('hi');
	window.document.location.href=url+"?cid="+con;
}
//------------------------------------------------------------------------------------------------------

function check()
{
	var Email= document.subscribe.emailID.value;
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(Email))
  	{
	   	return true;
  	}
  	else
  	{
   		alert("Enter valid Email ID");
		return false;
  	}
}



/* all- scripts*/

function cricterm(termfile){
               window.open('http://thatscricket.oneindia.in/cricket-info/' + termfile, 'Terms','height=400,width=450,scrollbars,scrollbars,resizable=yes,scrollbars=yes');
        }

		
		
		
		
		
// Ball By Ball Pop up
function openWin( windowURL, windowName, windowFeatures ) 
{
	return window.open( windowURL, windowName, windowFeatures ) ;
}

function check()
{
	var Email= document.subscribe.emailID.value;
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(Email))
  	{
	   	return true;
  	}
  	else
  	{
   		alert("Enter valid Email ID");
		return false;
  	}
}







function check() 
{ 
var newslet = document.subscribe; 
if (newslet.emailID.value=="") 
 { 
    alert("Please enter your Name") 
    newslet.emailID.focus(); 
    return false; 
  } 
    else if (newslet.emailID.value=="") 
    { 
    alert("Enter your E-mail ID") 
    newslet.emailID.focus(); 
    return false; 
 } 
    else 
if((newslet.emailID.value.indexOf('.',0)=="-1")||(newslet.emailID.value.indexOf('@',0)=="-1")) 
{ 
 alert("Invalid E-Mail Address") 
    newslet.emailID.focus(); 
    return false; 
} 
} 

function addDomain(){document.loginForm.login.value=document.loginForm.login1.value+'@'+document.loginForm.domain.value;}



function selectname()
{
document.loginForm.login.select()
}


function dologin(form,login_url)
{
	loginname = form.login.value.split("@");
	if(loginname[1])
		form.login.value=loginname[0];
}




function validate_gsearch()

  {
   if(document.gsearch.q.value=="")
   {
    window.alert("Please enter the Keyword");
    document.gsearch.q.focus();
    return false;
   }

   return true;
  }



function parse( )
{
  var regexS = "[\\?&]"+q+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );
  if( results == null )
    return "";
  else
    return results[1];
}

function popup(p1,p2,p3)
{
 window.open(p1,p2,p3);
}

function activateTab(id, mod, no_tabs) {
    for (var i=1; i<=no_tabs; i++) {
        if  (p_o(mod+"_tc"+i)) {
            if (id == i) {
                p_o(mod+"_tc"+i).style.display = "block";
                p_o(mod+"_t"+i).className= "active";
            } else {
                p_o(mod+"_tc"+i).style.display = "none";
                p_o(mod+"_t"+i).className = "";
            }
        }
    }
}
function p_o(o){return document.getElementById(o);}	
	
	
function ManageTabPanelDisplay1() {
var idlist1 = new Array('wc2011_tab1focus','wc2011_tab2focus','wc2011_tab1ready','wc2011_tab2ready','wc2011_content1','wc2011_content2');
if(arguments.length < 1) { return; }
for(var i = 0; i < idlist1.length; i++) {
   var block = false;
   for(var ii = 0; ii < arguments.length; ii++) {
      if(idlist1[i] == arguments[ii]) {
         block = true;
         break;
         }
      }
   if(block) { document.getElementById(idlist1[i]).style.display = "block"; }
   else { document.getElementById(idlist1[i]).style.display = "none"; }
   }
}

