/**
*@Desc: generate style drop down
*/
var siteUrl="http://worldwidechamp.com" ;
var siteUrl1="http://worldwidechamp.com" ;
var objRegistration = new clsRegistration();
function addContactsField(nFields, containerId,txtBox)
{
    var str;
    var n=nFields;
     if(n=="")
     {
        alert("Please enter how many contacts you want to enter");
        return false;
     }
    if(isNaN(n)==true)
    {
         alert("Please enter only number");
        return false;
    }
    intTotal = document.getElementById('hidTotal').value;
    intTotal1 = intTotal+n;
    str='<table width="100%"  border="0" cellspacing="0" cellpadding="0" align="center">';
    for(i=intTotal;i<intTotal1;i++)
    {
        str=str+'<tr class="infotext" valign="top"><td width="30"></td><td width="30"  align="center"><input type="checkbox" name="check'+i+'" id="check'+i+'" checked="checked"></td><td align="center"><input type="text" name="strName'+i+'"></td><td align="center"><input type="text" name="strEmail'+i+'"></td>';
        
        str=str+'</tr>';
    }
    str=str+'</table>';
    document.getElementById(containerId).innerHTML=str;
    document.getElementById(txtBox).disabled=true;
    document.getElementById("idGoBut").disabled=true;
}
/**
*@Desc Function is used to show login box
**/
function showLoginBox()
{
document.getElementById("loginerror").innerHTML="";
document.getElementById("txtUserName").value="";
document.getElementById("txtPassword").value="";
document.getElementById("login-box").style.display="";
}
function fnRemoveTeam()
{   
    if(confirm("Are you sure, Do you want to remove this team?")) 
    {
        document.getElementById("hiddTxt").value='D';
        document.frmTeamMembers.submit();
    }
}
function fnEditTime()
{
    if(document.getElementById("strTimePeriod").style.display=='none')
    {
       document.getElementById("strTimePeriod").style.display="";
       document.getElementById("hiddTxt").value="Y";
    }
    else
    {
       document.getElementById("strTimePeriod").style.display="none";
       document.getElementById("hiddTxt").value="N";
    }
}
function showQuickPick()
{
if (window.innerHeight )
{
    if(window.scrollMaxY)
    {    
        yWithScroll = window.innerHeight + window.scrollMaxY;
    }
    else
    {
        yWithScroll = window.innerHeight;
    }
    if(window.scrollMaxX)
    {
        xWithScroll = window.innerWidth + window.scrollMaxX; 
    }
    else
    {
        xWithScroll = window.innerWidth;
    }
}
else if (document.body.scrollHeight > document.body.offsetHeight)
{
    yWithScroll = document.body.scrollHeight;
    xWithScroll = document.body.scrollWidth;
} 
else 
{
    yWithScroll = document.body.offsetHeight;
    xWithScroll = document.body.offsetWidth;
}
    
    newyWithScroll=screen.height/7;
    newxWithScroll=screen.width/4-20; 
    
    var height2=newyWithScroll+"px";
    var width2=newxWithScroll+"px";   
    
    var height1=yWithScroll+"px";
    var width1=xWithScroll+"px"; 
    document.getElementById('overlay_quick').style.height=height1;
    document.getElementById('overlay_quick').style.width=width1;
    
    document.getElementById('quick-pick-box').style.top=height2;
    document.getElementById('quick-pick-box').style.left=width2;
    
    document.getElementById('v111').style.display='block';
    document.getElementById("quick-pick-box").style.display="";
}
function removeQuickPick()
{
document.getElementById("quick-pick-box").style.display="none";
document.getElementById('v111').style.display='none';
return false;
}
/**
*@Desc Function is used to link user name
**/
function fnUserClick(UserId,PairId)
{
    if(UserId!="")
    {
        window.location.href=siteUrl1+"/index.php?a=scorecard&uid="+UserId+"&pid="+PairId;
    }
}
/**
*@Desc Function is used to link rank
**/
function fnRankClick(ContestId)
{
    if(ContestId!="")
    {
        window.location.href="index.php?a=ranking&id="+ContestId;
    }
}
/**
*@Desc Function is used to hide login box
**/
function hideLoginBox()
{
document.getElementById("login-box").style.display="none";
}
/**
*@Desc Function is used to check login information
*@Created By Irshad Q.
**/
function fnLoginValidate()
{   
    if(document.getElementById("txtUserName").value=="")
    {
    alert('Enter the Username');
    document.getElementById("txtUserName").focus();
    return false;
    }
    if(document.getElementById("txtPassword").value=="")
    {
    alert('Enter the Password');
    document.getElementById("txtPassword").focus();
    return false;
    }
    return true; 
}

function fnOpenWindow(pic,m,n,sess)
{ 
    if(parseInt(sess)>0)
    {
        window.open(pic,"Gallery","height=" + m + ",width=" + n + ",menubar=0,resizable=0,scrollbars=1,status=0,titlebar=0,toolbar=0,left=160,top=100");
    }
    else
    { 
        window.location.href=siteUrl+"/index.php?a=signup";
        //alert("Please login");
    }
}

function fnOpenWindow1(pic,m,n,sess)
{ 
    window.open(pic,"Gallery","height=" + m + ",width=" + n + ",menubar=0,resizable=0,scrollbars=1,status=0,titlebar=0,toolbar=0,left=160,top=100");
}

// Request Recommendation
function fnRequestRecomm()
{  
    objRegistration.fnRequestRecomm();
}
// Received Recommendations
function fnReceivedRecomm(intRecId,del,totalrows,page)
{   
    if(del=='del')
    {
        if(confirm("Are you sure you want to delete this recommendation?"))
        {
            objRegistration.fnReceivedRecomm(intRecId,del);
        }
    }
    else
    {                 
        objRegistration.fnReceivedRecomm(intRecId,del,totalrows,page);
    }
}
// Send Recommendation
function fnSendRecomm(intRecId,del,totalrows,page)
{                  
    if(del=='del')
    {
        if(confirm("Are you sure you want to delete this recommendation?"))
        {
            objRegistration.fnSendRecomm(intRecId,del);
        }
    }
    else
    {
        objRegistration.fnSendRecomm(intRecId,del,totalrows,page);
    }
}
// Send Recommendation
function fnSendTeamRecomm(intRecId,del,totalrows,page)
{                  
    if(del=='del')
    {
        if(confirm("Are you sure you want to delete this recommendation?"))
        {
            objRegistration.fnSendTeamRecomm(intRecId,del);
        }
    }
    else
    {
        objRegistration.fnSendTeamRecomm(intRecId,del,totalrows,page);
    }
}
 function fnGetTeamList(str)
{  
    objRegistration.fnAutoFillTeam(str)    ;
}
function fnFillText(str)
{  
    if(str)
    {
        document.getElementById('team').value=str;
        document.getElementById('agDrop').style.display='none';
    }
}
/* Hover effect on buttons */

<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 window.isLoaded = true; 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
   // 
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0  
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
function fnDisMore(intId)
{
    if(intId==undefined || intId=="")
    {  
        document.getElementById("idCommMore").style.display="";
        document.getElementById("idCommLess").style.display="none";
    }
    else
    {
        idCommMoreC = "idCommMore"+intId;
        idCommLessC = "idCommLess"+intId;
        document.getElementById(idCommMoreC).style.display="";
        document.getElementById(idCommLessC).style.display="none";
    }
}
function fnDisLess(intId)
{
    if(intId==undefined || intId=="")
    {
        document.getElementById("idCommMore").style.display="none";
        document.getElementById("idCommLess").style.display="";
    }
    else
    {
        idCommMoreC = "idCommMore"+intId;
        idCommLessC = "idCommLess"+intId;
        document.getElementById(idCommMoreC).style.display="none";
        document.getElementById(idCommLessC).style.display="";
    }
}
function fncompSubmit(murl)
{
document.frmMoreComp.action=murl; 
document.frmMoreComp.submit(); 
}   
function expandSelect(id, size)
{
var select = document.getElementById(id);
select.size = size;
}
function fnChkDateTeam()
{
    toYearFrom = document.getElementById("txtYearFrom").value;
    toYearTo = document.getElementById("txtYearTo").value;
    toMonthFrom = document.getElementById("lstMonthFrom").value;
    toMonthTo = document.getElementById("lstMonthTo").value;
    
    if(toMonthFrom=="")
    {
        alert("Please select from month");
        document.getElementById("lstMonthFrom").focus();
        return false;
    }
    if(toYearFrom=='' || toYearFrom==0)
    {
        alert("Please select from year");
        document.getElementById("txtYearFrom").focus();
        return false;
    }
    if(document.getElementById("chkTime").checked==false)
    {
         if(toMonthTo=='')
        {
            alert("Please select to month");
            document.getElementById("lstMonthTo").focus();
            return false;
        }
        if(toYearTo=='' || toYearTo==0)
        {
            alert("Please select to year");
            document.getElementById("txtYearTo").focus();
            return false;
        }
    }
    if((toYearFrom>toYearTo && document.getElementById("chkTime").checked==false) || (toMonthFrom>toMonthTo && toYearFrom==toYearTo && document.getElementById("chkTime").checked==false))
    {
        alert("Please enter correct time period");
        return false;
    }
}
function isValidURL(url){
    var RegExp = /^[a-zA-Z0-9\-\.]+\.(com|org|net|mil|edu|COM|ORG|NET|MIL|EDU|co.in|co)$/;
    if(RegExp.test(url))
    {
        return true;
    }
    else
    {
        alert("Please enter a valid URL");
        return false;
    }
}

//====================== 8 Dec 08- common_ajax.js file contents(Swati) ==========================


// function of report abuse to video
function fnAbuse(intVideoId,intUserId)
{   
    if(intVideoId>0 && intUserId>0)
    {
        if(confirm("Please confirm that you wish to report this video to the administrator because you believe it contains content that is inappropriate for this site"))
        {
            objRegistration.fnAbuse(intVideoId,intUserId);
        }
    }
    else
    {
        alert("Please Login");
    }   
} 

// function of add to favorite
function fnFavorite(intVideoId,intUserId)
{   
    if(intVideoId>0 && intUserId>0)
    {
        objRegistration.fnFavorite(intVideoId,intUserId);
    }
    else
    {
        alert("Please Login");
    }
    
} 

function fnPlayVideo(intVideoId)
{   
    
    if(intVideoId>0)
    {
        objRegistration.fnLoadVideoPlaybox(intVideoId);
    }
} 

function fnMailTeam(intTeamId)
{   
    if(intTeamId>0)
    {
        objRegistration.fnMailTeam(intTeamId);
    }    
} 
function fnMailOrg(intOrgId)
{   
    if(intOrgId>0)
    {
        objRegistration.fnMailOrg(intOrgId);
    }    
}

function fnImportContacts(intVideoId,strSkip)
{  
    var radioLength = document.frmInviteFriend.account.length;
    for(var i = 0; i < radioLength; i++)
    {
        if(document.frmInviteFriend.account[i].checked==true)
        {
            strType = document.frmInviteFriend.account[i].value;
        }
    } 
    strEmail=document.getElementById("txtImportEmail").value ;
    strPassword=document.getElementById("txtImportPassword").value ;
    if(strEmail=="")
    {
        alert("Please enter email id");
        document.getElementById("txtImportEmail").focus();
        return false;
    }
    if(strPassword=="")
    {
        alert("Please enter password");
        document.getElementById("txtImportPassword").focus();
        return false;
    }
    if(strEmail!="" && strPassword!="")
    {        
        objRegistration.fnImportContacts(strEmail,strPassword,strType,intVideoId,strSkip);
        return false;
    } 
    
} 
function fnLogin()
{     
    var uName = document.getElementById("txtUserName").value; 
    var uPass = document.getElementById("txtPassword").value;
    if(uName=="")
    {
        alert("Please enter User name ");
        document.getElementById("txtUserName").focus(); 
        return false;
    }
    if(uPass=="")
    {
        alert("Please enter Password ");
        document.getElementById("txtPassword").focus(); 
        return false;
    }
    if(uPass!="" && uName!="")
    {
        objRegistration.fnLogin(uName,uPass);
        return false; 
    }
} 
function fnPagingCompetition(intEventID,intContestId,intJudgeId,strSort,strSortBy,rows_per_page,page)
{                        
        objRegistration.fnLoadPaging(page,intEventID,intContestId,intJudgeId,strSort,strSortBy,rows_per_page);  
}

function fnPagingCompetitionthis(intEventID,intContestId,intJudgeId,strSort,strSortBy,rows_per_page,page)
{ 
   
document.getElementById("allid1").style.display='block'  ;
 document.getElementById("allid2").style.display='block'  ;  
 document.getElementById("thiseventid1").style.display='none'  ; 
 document.getElementById("thiseventid2").style.display='none'  ;  
  
if(intEventID>0)
    {   
        objRegistration.fnLoadPaging(page,intEventID,intContestId,intJudgeId,strSort,strSortBy,rows_per_page);
   }

    
}

function fnPagingScorecard(intCompId,intPairId,intContestId,strSort,strSortBy,rows_per_page,page)
{
    if(intCompId>0)
    {
        objRegistration.fnLoadPagingScorecard(page,intCompId,intPairId,intContestId,strSort,strSortBy,rows_per_page);
    }
}
function fnPagingRanking(intContestId,page)
{
    if(intContestId==0)
    {
         window.location.href="index.php?a=ranking&page="+page;
    }
    else
    {
         window.location.href="index.php?a=ranking&id="+intContestId+"&page="+page;
    }
}  
  
/*Check user exist*/
function fnCheckUserExist(strUser)
{
//alert(strUser);
   objRegistration.fnCheckUser(strUser);
}

/*Check email exist*/
function fnCheckEmailExist(strEmail)
{
   
   objRegistration.fnCheckEmail(strEmail);
}

/*Check email exist*/
function fnCheckSecurityCode(strSecurity)
{

   objRegistration.fnCheckSecurity(strSecurity);
}


/*get Competitor Edit*/
function fnCompetitorEdit()
{

   objRegistration.fnCompetitorEdit();
}
/*get add team*/
function fnAddTeam(strTeamName)
{
    if(strTeamName=="")
    {
       objRegistration.fnAddTeam();
    }
    else
    {
       objRegistration.fnAddTeam(strTeamName);
    }
}
/*get add team*/
function fnAddOrg()
{
   objRegistration.fnAddOrg();
}
/*get Competitor Detail*/
function fnCompetitorDetail()
{
objRegistration.fnCompetitorDetail(); 
}
function fnCompProfile()
{
objRegistration.fnCompProfile(); 
}
/*get Approved/Unapproved Sports*/
function fnApprovedSport()
{
objRegistration.fnApprovedSport(); 
}

/*get Payment Summary*/
function fnPaymentSummary()
{
objRegistration.fnPaymentSummary(); 
}
/*get Paid Payment Report*/
function fnPaidPayment()
{
    objRegistration.fnPaidPayment(); 
}

/*get UnPaid Payment Report*/
function fnUnpaidPayment()
{
    objRegistration.fnUnpaidPayment(); 
}

/*Edits Judge Preferences*/
function fnPreferences()
{
    objRegistration.fnPreferences(); 
}


/*Edits Payment Settings*/
function fnPaymentSettings()
{
    objRegistration.fnPaymentSettings(); 
}

/*Edits Sports*/
function fnEditSports(sportid)
{
    objRegistration.fnEditSports(sportid); 
}

/*Edits Judge Credentials*/
function fnCredentials()
{
    objRegistration.fnCredentials(); 
}

/*Edits Competitor Credentials*/
function fnCredentialsComp()
{
    objRegistration.fnCredentialsComp(); 
}

/*Password edit*/
function fnPassEdit()
{
objRegistration.fnPassEdit(); 
}
/*get account balance*/
function fnAccountBalance()
{
objRegistration.fnAccountBalance(); 
}

/*get bonus package*/
function fnBonusPackage()
{
    objRegistration.fnBonusPackage(); 
}
/*Check user exist*/
function fnChangePassword(strOldPass,strNewPass)
{

   objRegistration.fnChangePassword(strOldPass, strNewPass);
}


/*Add partner*/
function fnAddPartner()
{
      objRegistration.fnAddPartner();
}

/*Check user exist*/
function fnInsertPartner(strUserName,strEmail)
{
   objRegistration.fnInsertPartner(strUserName,strEmail);
   return false;
}

/*Partner Status*/
function fnPartnerStatus()
{
      objRegistration.fnPartnerStatus();
}

function fnChangeStyle(intSportsId)
{
    
    //alert(intSportsId);
    if(intSportsId>0)
    {
        objRegistration.fnLoadStyleDropdown(intSportsId);
    }
    
}
function fnChangeType(intStyleId, intSportsId)
{ 
    if(intStyleId>0 && intSportsId>0)
    {
        objRegistration.fnLoadTypeDropdown(intSportsId, intStyleId);
    }
    else
    {
        alert("Please select Sports and Style.");
    }
} 
function fnChangeAge(intTypeId, intStyleId, intSportsId)
{ 

    if(intTypeId>0 && intStyleId>0 && intSportsId>0)
    {      
        objRegistration.fnLoadAgeDropdown(intTypeId, intStyleId, intSportsId);
    }
    else
    {
        alert("Please select Sports, Style and age.");
    }
} 
function fnChangeGender(intAgeId, intTypeId, intStyleId, intSportsId)
{ 

    if(intAgeId>0 && intTypeId>0 && intStyleId>0 && intSportsId>0)
    {      
        objRegistration.fnLoadGenderDropdown(intAgeId, intTypeId, intStyleId, intSportsId);
    }
    else
    {
        alert("Please select Sports, Style and age.");
    }
}

function fnChangeSkill(intGenderId,intAgeId, intTypeId, intStyleId, intSportsId)
{ 
   // alert("hello");
    if(intAgeId>0 && intTypeId>0 && intStyleId>0 && intSportsId>0 && intGenderId>0)
    {      
        objRegistration.fnLoadSkillDropdown(intGenderId,intAgeId, intTypeId, intStyleId, intSportsId);
        
    }
    else
    {
        alert("Please select Sports, Style and age.");
    }
}

function fnChangeAthlete(intSkillId, intGenderId,intAgeId, intTypeId, intStyleId, intSportsId)
{ 
   // alert("hello");
    if(intAgeId>0 && intTypeId>0 && intStyleId>0 && intSportsId>0 && intGenderId>0 && intGenderId>0)
    {      
        objRegistration.fnLoadAthleteDropdown(intSkillId,intGenderId,intAgeId, intTypeId, intStyleId, intSportsId);
        
    }
    else
    {
        alert("Please select Sports, Style and age.");
    }
}
function fnAthleteName(intAthleteId)
{ 
    if(intAthleteId>0)
    {      
        objRegistration.fnAthleteName(intAthleteId);
        
    }
    else
    {
        alert("Please select Sports, Style and age.");
    }
}

/*Add partner*/
function fnAddChild()
{
      objRegistration.fnAddChild();
}

/*Check user exist*/
function fnInsertChild(strUserName)
{
   objRegistration.fnInsertChild(strUserName);
}
/*Partner Status*/
function fnChildStatus()
{
      objRegistration.fnChildStatus();
}

/*for getting the tool tip content*/
function fnTooltipContent(intVideoId)
{
   objRegistration.fnTooltipContent(intVideoId);
}

/*Remove focus from anchore*/
function removeFocus(docObj)
{
    docObj.blur();
}

/**
@Desc : validating comma separated urls
*/
function validate_url(strUrl)
{
    var regex = /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/;  
    checkUrl = strUrl.replace(/^\s+|\s+$/g,"");
    if(regex.test(checkUrl)==false)
    {
        alert("\""+checkUrl+"\" is not a valid URL.\nPlease be sure to use the http:// prefix when typing a URL.");
        return false;
    }
    else{
        return true;
    }
}

/**
@Desc : validating comma separated urls in edit team module
*/
function fnValidate()
{
    var frm = document.frmCredentials;
    frm.txtUrl.value =  frm.txtUrl.value.replace(/^\s+|\s+$/g,"") ;
    if(frm.txtUrl.value!='')
    {
        var arrUrl = frm.txtUrl.value.split('\n');  
        var cntUrl = arrUrl.length;
        for(i=0; i<cntUrl; i++)
        {
            return validate_url(arrUrl[i]); 
        }
    }
} 

//====================================================================================

/**
*My Account Functions commonly used in Judge's and Competitor's My Account.
*/
/**
*@desc : Get Friends list through ajax
*/
function fnGetFriendList(intRowPerPage,intPage)
{
    if(intRowPerPage<=0 || intRowPerPage==undefined)
    {
        intRowPerPage=10;
    }
    
    if(intPage<=0 || intPage==undefined)
    {
        intPage=1;
    }
    objRegistration.fnMyFrined(intRowPerPage,intPage);
}
/*Show hid sublinks*/
function fnShowHideMenu(type)
{
    switch(type)
    {
        case 'mycomp' :  
            if(document.getElementById('myvideo').style.display=='none')
            {   
                document.getElementById('mycomp').style.backgroundImage='url('+siteUrl+'/images/arrow-blue-dn.png)';
                document.getElementById('myvideo').style.display='block';
            }
            else
            {        
                document.getElementById('mycomp').style.backgroundImage='url('+siteUrl+'/images/arrow-blue01.gif)';
                document.getElementById('myvideo').style.display='none';
            }
            break;     
        case 'mypeople' :  
            if(document.getElementById('mypeople').style.display=='none')
            {
                document.getElementById('myp').style.backgroundImage='url('+siteUrl+'/images/arrow-blue-dn.png)';   
                document.getElementById('mypeople').style.display='block';
            }
            else
            {
                document.getElementById('myp').style.backgroundImage='url('+siteUrl+'/images/arrow-blue01.gif)';   
                document.getElementById('mypeople').style.display='none';
            } 
            break;
        case 'mypro' :  
            if(document.getElementById('mydetail').style.display=='none')
            {
                document.getElementById('mypro').style.backgroundImage='url('+siteUrl+'/images/arrow-blue-dn.png)';   
                document.getElementById('mydetail').style.display='block';
            }
            else
            {
                document.getElementById('mypro').style.backgroundImage='url('+siteUrl+'/images/arrow-blue01.gif)';   
                document.getElementById('mydetail').style.display='none';
            }
            break; 
        case 'MyTeam' :  
            if(document.getElementById('team').style.display=='none')
            {
                document.getElementById('MyTeam').style.backgroundImage='url('+siteUrl+'/images/arrow-blue-dn.png)';   
                document.getElementById('team').style.display='block';
            }
            else
            {
                document.getElementById('MyTeam').style.backgroundImage='url('+siteUrl+'/images/arrow-blue01.gif)';   
                document.getElementById('team').style.display='none';
            }
            break;  
         case 'MyOrg' :  
            if(document.getElementById('org').style.display=='none')
            {
                document.getElementById('MyOrg').style.backgroundImage='url('+siteUrl+'/images/arrow-blue-dn.png)';   
                document.getElementById('org').style.display='block';
            }
            else
            {
                document.getElementById('MyOrg').style.backgroundImage='url('+siteUrl+'/images/arrow-blue01.gif)';   
                document.getElementById('org').style.display='none';
            }
            break;
         case 'recomm' :  
            if(document.getElementById('recommdetail').style.display=='none')
            {
                document.getElementById('recomm').style.backgroundImage='url('+siteUrl+'/images/arrow-blue-dn.png)';   
                document.getElementById('recommdetail').style.display='block';
            }
            else
            {
                document.getElementById('recomm').style.backgroundImage='url('+siteUrl+'/images/arrow-blue01.gif)';   
                document.getElementById('recommdetail').style.display='none';
            }
            break;
        default:
            break;
    }  
}

/**
* Get Teammates  list
*/
function fnMyTeamMate(intTeamId,intRowPage,intPage)
{
    if(intRowPage<=0 || intRowPage==undefined)
    {
        intRowPage=10;
    }
    
    if(intPage<=0 || intPage==undefined)
    {
        intPage=1;
    }
    objRegistration.fnTeamMate(intTeamId,intRowPage,intPage);
}
/**
* Get Team list of organization
*/
function fnMyOrgMate(intOrgId)
{
    objRegistration.fnMyOrgMate(intOrgId);
}
function fnRemoveFriend(intFrId, strStat)
{
    var cf=confirm("Are you sure you wish to remove this person from your circle of Friends?");
    if(cf==true)
    {
        objRegistration.fnDelFriend(intFrId, strStat);
        fnGetFriendList(); 
    }
}
/*Load team list*/
function fnMyTeam(intOrgId)
{
    if(intOrgId!="")
    {
        objRegistration.fnMyTeam(intOrgId);
    }
    else
    {
        objRegistration.fnMyTeam();
    }
}

//Send Friend request or approve Friend
function fnAddToFriend(intFId, chkSess)
{
    if(chkSess<=0)
    {
        alert("You must login to add this user.") ;
    }
    else 
    {
        var cf=confirm("Please confirm that you actually know this person. If you attempt to add people that you don't know, you can lose your ability to add friends without providing their email address.");
        if(cf==true)
        {
            objRegistration.fnAddToFriend(intFId);
        }  
    }
}
/**
* @desc : function to confirm freind request sent to user
*/
function fnConfirmFriend(intFId, chkSess)
{
     if(chkSess<=0)
    {
        alert("You must login to add this user.") ;
    }
    else 
    {
        objRegistration.fnAddToFriend(intFId);
    } 
}
//Load edit team tpl
function fnEditMyTeam(intTeamId)
{
    objRegistration.fnEditMyTeam(intTeamId);
}

//Load edit Organization tpl
function fnEditOrganization(intOrgId)
{
    objRegistration.fnEditOrganization(intOrgId);
}

/**
*@DESC: remove video
*/
/*get competition details*/
function fnRemoveVideo(intVideoId, strType)
{
    var confirstRmove = confirm("Are you sure, you wish to remove this video?");
    
    if(confirstRmove==true)
    {
        if(strType=='Favorite')
        {  
            objRegistration.fnRemoveVideo(intVideoId, 'Favorite');
        }
        else
        {
            objRegistration.fnRemoveVideo(intVideoId, '');
        }
    }
}

/**
*@desc: find friend link
*/
function fnFindFriend()
{
    objRegistration.fnFindFriend();
}
/**
*@desc: Change team's organization
*/
function fnChangeOrg()
{
    document.getElementById('displayOrg').style.display='Block';
}

function fnAddComment(intVideoId)
{  
    strComment=document.getElementById("taVideoComment").value ;
    if(strComment=="" || strComment==0)
    {
        alert("Please enter a comment");
        document.getElementById("taVideoComment").focus();
        return false;
    }
    if(strComment!="")
    {   
        objRegistration.fnAddComment(intVideoId,strComment);
        return false;
    } 
    
} 
function fnEditComment(inCommentId,intVideoId)
{  
    strComment=document.getElementById("taVideoComment").value ;
    if(strComment=="" || strComment==0)
    {
        alert("Please enter a comment");
        document.getElementById("taVideoComment").focus();
        return false;
    }
    if(strComment!="")
    {   
        objRegistration.fnEditComment(inCommentId,strComment,intVideoId);
        return false;
    } 
}
function fnJudgeProfile()
{
objRegistration.fnJudgeProfile(); 
}
function fnAddRef(strUpdate)
{
    if(strUpdate!="")
    {
       objRegistration.fnAddRef(strUpdate); 
    }
    else
    {
        objRegistration.fnAddRef(); 
    }
}

function fnAllVideoContest(intContestId, rows_per_pages,intSnNo1,vurl)
{
 document.getElementById("allid1").style.display='none'  ;
 document.getElementById("allid2").style.display='none'  ;
 document.getElementById("thiseventid1").style.display='block';
 document.getElementById("thiseventid2").style.display='block'; 
 objRegistration.fnAllVideoContest(intContestId, rows_per_pages); 
}

function fnMyNotifications()
{   
    objRegistration.fnMyNotifications();
} 

function fnSortVideoComp(intContestId, intCompId,intPairId, stype, rowsperpages, page)
{
    /**
    * @desc Setting default values on sorting
    */ 
    var sorder = document.getElementById('sorder').value;
    objRegistration.fnSortVideoComp(page,intCompId,intPairId,intContestId,stype,sorder,rowsperpages);
  
    if(sorder!='desc')
    {
        sorder='asc';
        document.getElementById('sorder').value='desc';
    }
    else
    {
        document.getElementById('sorder').value='asc';
    }
}

function fnAddVideoTitle(intVideoId)
{   
    if(intVideoId>0)
    {
        objRegistration.fnAddVideoTitle(intVideoId);
    }    
}
function removePhoto()
{   
    if(confirm("Are you sure, Do you want to remove your photo?")) 
    { 
        document.frmCredentials.method="Post";
        document.frmCredentials.action="index.php?a=edit_credentials&r=1";
        document.frmCredentials.submit();
    }
}
function removeTeamLogo(intTeamId)
{   
    if(confirm("Are you sure, Do you want to remove this team logo?")) 
    { 
        document.frmJudgeTeam.method="Post";
        document.frmJudgeTeam.action="index.php?a=edit_team_profile&r=1&tid="+intTeamId;
        document.frmJudgeTeam.submit();
    }
}

 // FIND friend OUTLOOK
 function fnShowDetails()
  {
        //alert(document.getElementById('instruct').style.display);
        if(document.getElementById('instruct').style.display=='none')
        {
            document.getElementById('instruct').style.display='block';
            document.getElementById('show_detail').innerHTML='Hide detailed instructions:';
        }
        else
        {            
            document.getElementById('instruct').style.display='none';
            document.getElementById('show_detail').innerHTML='Show detailed instructions:';
        }
  }
  function fnToggleDisply()
  {                            
        if(document.getElementById('rdOutLook').checked==true)
        {
            document.getElementById('displayOutLook').style.display=''; 
            document.getElementById('displayOutLook').focus();
            document.getElementById('displayOther').style.display='none';
        }
        else// if(document.getElementById('displayOutLook').style.display!='none')
        {
            document.getElementById('displayOutLook').style.display='none';
            document.getElementById('displayOther').style.display='';
            document.getElementById('displayOther').focus(); 
        }
  }
  function TestFileType( fileName, fileTypes ) 
  {
    if (!fileName || fileName.replace(/^\s+|\s+$/g,"")=="")
    {
        alert("Please upload file.");
        return false;
    }
    else
    {
        dots = fileName.split(".")
        //get the part AFTER the LAST period.
        fileType = "." + dots[dots.length-1];
        
        if (dots[dots.length-1]=='csv'){return true;}
        else {alert("Please only upload files that end in types: \n\n" + (fileTypes.join(" .")) + "\n\nPlease select a new file and try again.");return false;}
    }
  }
  //=======================================================================================================
  
function fnValidateTeamRecomm()
{
    if(document.getElementById("lstTeamList").value=="" || document.getElementById("lstTeamList").value==0)
    {
        alert("Please select team from team list");
        document.getElementById("lstTeamList").focus();
        return false;
    }
    if(document.getElementById("taMessage").value=="" || document.getElementById("taMessage").value==0)
    {
        alert("Please enter in recommendation message");
        document.getElementById("taMessage").focus();
        return false;
    }
}
function fnValidateRecomm()
{
    if(document.getElementById("lstJudgeList").value=="" || document.getElementById("lstJudgeList").value==0)
    {
        alert("Please select user from list");
        document.getElementById("lstJudgeList").focus();
        return false;
    }
    if(document.getElementById("taMessage").value=="" || document.getElementById("taMessage").value==0)
    {
        alert("Please enter in recommendation message");
        document.getElementById("taMessage").focus();
        return false;
    }
}
function fnValidateReqRecomm()
{  
    if(document.getElementById("txtSubject").value=="" || document.getElementById("txtSubject").value==0)
    {
        alert("Please enter subject of the mail");
        document.getElementById("txtSubject").focus();
        return false;
    }
    if(document.getElementById("taMessage").value=="" || document.getElementById("taMessage").value==0)
    {
        alert("Please enter message of the mail");
        document.getElementById("taMessage").focus();
        return false;
    }
}
function limitText(limitField, limitCount, limitNum) 
{
    if (limitField.value.length > limitNum) {
        limitField.value = limitField.value.substring(0, limitNum);
    } else {
        limitCount.innerHTML = limitNum - limitField.value.length;
    }
}

/** Function to refresh google ads  */


 var oXmlHttp;
 try {
            oXmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                oXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (err) {
                oXmlHttp = null;
            }
        }
        if(!oXmlHttp && typeof XMLHttpRequest != "undefined")
            oXmlHttp = new XMLHttpRequest();
        if (!oXmlHttp){
            this.failed = true; 
        }
oXmlHttp.onreadystatechange = function() {
     if (oXmlHttp.readyState == 4) {
          var storyDiv = document.getElementById(layerName);
          storyDiv.innerHTML = oXmlHttp.responseText;
          refreshAd();
      }
};  

 function refreshAd() { 
      var currentTime = new Date(); 
      google_ads_frame.location = "refresh_ads.php?s=" + currentTime.getTime();
}
/*==================================================================================*/

/** Function to load style list */
function fnLoadStyle(intSpid)   
{
    //alert(intSpid);
    //at_attach_h("parent_sport"+intSpid, "menu_child_style"+intSpid, "hover", "x", "pointer");
    
    objRegistration.fnLoadStyle(intSpid);  
    //document.getElementById("menu_child_style"+intSpid).innerHTML='<a href="#">Style1</a><a href="#">Style2</a><a href="#">Style3</a>';
    //at_attach_h("parent_sport"+intSpid, "menu_child_style"+intSpid, "hover", "x", "pointer");
}


