﻿// JScript File
//---------------------------------------------------------------------------------------------------
//Master JS file for site consolidated from smaller scripts
//consolidated by D.F. on 08.14.2007 
//scripts written by combination of 3rd party companies, DynamicDrive.com,  Michael C., Monoj K., Andrew P.
//---------------------------------------------------------------------------------------------------

//---------------From default.js-------------------------------------------------------------------//
var iw = 0;
var ih = 0;




function HideRequiredFieldValidator(ValidatorId)
{
    var Validator = document.getElementById(ValidatorId);
    if(Validator != null)
    {
        Validator.style.visibility = "hidden";
    }
}

// event handler called on ajax end request
function EndRequestHandler(sender, args)
{
	if(document.getElementById("txtchkfocus") != null)
	{
	    var _chkTest = document.getElementById("txtchkfocus").value;
	    if(_chkTest != "")
	    {
	        var _Name = document.getElementById(_chkTest).name;
	        window.location="#" + _Name;
	    }
	
	}
    if( args.get_error() )
    {
        alert(args.get_error().message + '||description:' + args.get_error().description);		        
        args.set_errorHandled( true );
    }    
 }



    function resetStyle(inputType)
    {
        var count=document.getElementsByTagName(inputType);
        for(var i=0;i<count.length;i++)
        {
            if(window.attachEvent)
            {//Attach to onpropertychange event in IE
                count[i].attachEvent('onpropertychange',resetBC);
            }
            else
            {//Apply the style reset onload
                resetOther(count[i]);
            }
        }
    }
   
    function resetOther(El)
    {
        if(El.style.backgroundColor!='')
            El.style.backgroundColor='';
    }
    function resetBC()
    {
        if(event.srcElement.style.backgroundColor!='')
            event.srcElement.style.backgroundColor='';
    }

function beginRequestHandle(sender, Args)
{
    document.getElementById('contentProgressIndicator').style.visibility="visible"; 
    if(document.getElementById('wrap'))
    {
        document.getElementById('wrap').className = 'Progress';
    }  
}
function endRequestHandle(sender, Args)
{
    document.getElementById('contentProgressIndicator').style.visibility="hidden";
    // call function to remove yellow background from text boxes and select controls
   
    //D.F. - netrasoft do we still need this...it gets hung on some postbacks
    //resetStyle('input');
    //resetStyle('select');
    //-----------------------------------------------------------------------------
    if(document.getElementById('wrap'))
    {
        document.getElementById('wrap').className = 'Normal';
    }    
   
    
}
function changeeffect(_DivId)
{
    Effect.Combo(_DivId, {duration: .2});
}
        
function getPopup(pname,path,lwidth, lheight )
{
    var posX = ((screen.availWidth/2)-(lwidth/2));
    var posY = ((screen.availHeight/2)-(lheight/2));
    window.open(path,pname,'width=' + lwidth + ',height=' + lheight + ',scrollbars=yes,status=no,toolbar=no,menubar=no,location=no,directories=no,left=' + posX + ',top=' + posY);
}

function getPopup2(pname,path,lwidth, lheight )
{
    var posX = ((screen.availWidth/2)-(lwidth/2));
    var posY = ((screen.availHeight/2)-(lheight/2));
    window.open(path,pname,'location=no,scrollbars=no,status=no,toolbar=no,menubar=no,directories=no,width=' + lwidth + ',height=' + lheight + ',left=' + posX + ',top=' + posY);
    //window.open(path,pname,'width=' + lwidth + ',height=' + lheight + ',scrollbars=0,status=0,toolbar=0,menubar=0,location=0,directories=0,left=' + posX + ',top=' + posY);
}


function getPopup3(pname,path)
{ 
    window.open(path,pname,'scrollbars=yes,status=yes,toolbar=yes,menubar=yes,location=yes,directories=yes,resizable=yes'); //
}


function ToggleLessMoreText(str,divLess_Id,divMore_Id)
{
    var divLess = document.getElementById(divLess_Id);
    var divMore = document.getElementById(divMore_Id);
    if(divLess != null && divMore != null)
    {
        if(str == "more")
        {
            divMore.style.display = "";
            divLess.style.display = "none";
        }
        else if(str == "less")
        {
            divMore.style.display = "none";
            divLess.style.display = "";
        }
    }
}





function loadNewControl(ctl)
{
     var theBtn;    
   
   
   /* var hfIsFacebook = document.getElementById('hfIsFacebook');
   
    if(hfIsFacebook)
    {
        if(hfIsFacebook.value == 'true')
        {
            var hfFacebookFinishedLink = document.getElementById('hfFacebookFinishedLink');           
            top.location = hfFacebookFinishedLink.value;
        }
    }*/
   
    theBtn = document.getElementById('updateControlContentBtn');  
    hf = document.getElementById('controlToLoadHF');
    if(hf)
    {
        hf.value = ctl; 
    }
   
    if(theBtn)
    {
         //alert('hf _ value:' + hf.value);
         window.scroll(0, 0); 
         theBtn.click();
        
    } 
    else
    {
        window.location = './Default.aspx?action=home';
    }   
    //updateControlContent \
    return false;
}



function loadNewControlFB(ctl)
{
     var theBtn;    
   
    theBtn = document.getElementById('updateControlContentBtn');  
    
    
    hf = document.getElementById('controlToLoadHF');
    if(hf)
    {
        hf.value = ctl; 
    }
   
    if(theBtn)
    {
         //alert('hf _ value:' + hf.value);
         window.scroll(0, 0); 
         theBtn.click();
        
    }
    
    //now trying ot set focus to top
    if(document.getElementById('topAnchor'))
    {document.getElementById('topAnchor').focus();}
    
    //updateControlContent \
    return false;
}




// new function a.powell 11.06.2008
function scrollToTop()
{
    //now trying ot set focus to top
    if(document.getElementById('topAnchor'))
    {document.getElementById('topAnchor').focus();}
    //else {alert('topAnchor element not found');}
}

function clickButton(theBtnId)
{
    var theBtn;
    theBtn = document.getElementById(theBtnId);
    
    if(theBtn)
    {
        window.scroll(0, 0);
        theBtn.click();
    }
    return false;      
}





function breadCrumbClick(listingsPage, scat_seq_id)
{
    var theBtn;    
   
    theBtn = document.getElementById('breadcrumbBtn');  
    hf = document.getElementById('controlToLoadHF');
    
    hf.value = listingsPage; 
    
   
    if(theBtn)
    {
         //alert('hf _ value:' + hf.value);         
         theBtn.click();
    } 
    else
    {
        window.location = './Default.aspx?action=home';
    }   
}

var _btnSave;
var _previouslySubmittedDiv;
var _txtUrl;
var _selectedCategoryLbl;
var _txtLinkTilte;
var _txtLinkDescription;
var _lastNodeSelectedHF;
var _headerStatus;
var _encouragedSpan;
var _txtTag;
var _catSelectedTextHF;
var _areaSelectedHF;
var _goToStoryLnk;

var _pnlTab4;
var _aTab4;
var _pnlTab3;
var _aTab3;
var _pnlTab2;
var _aTab2;
var _pnlTab1;
var _aTab1;

var _duplicateHF;

//d.f. 5.12.08 - missing functions
function SelectStoryCategoryGetIds(SelectedArea, SelectedAreaName,SelectedNodeText, SelectedNodeValue, SelectedNodeId, baseOfClientIds)
{
    
    var saveBtnClientId = baseOfClientIds + 'btnSave';
    var UrlClientId = baseOfClientIds + 'txtUrl';
    var selectedCategoryLbl =  baseOfClientIds + 'selectedCategoryLbl';
    var encouragedSpan = baseOfClientIds + 'UcTags1_encouragedSpan';
    
    _pnlTab4 = $get(baseOfClientIds + 'pnlTab4');
    _aTab4 = $get(baseOfClientIds + 'aTab4');
    _pnlTab3 = $get(baseOfClientIds + 'pnlTab3');
    _aTab3 = $get(baseOfClientIds + 'aTab3');
    _pnlTab2 = $get(baseOfClientIds + 'pnlTab2');
    _aTab2 = $get(baseOfClientIds + 'aTab2');
    _pnlTab1 = $get(baseOfClientIds + 'pnlTab1');
    _aTab1 = $get(baseOfClientIds + 'aTab1');    
    
    _duplicateHF = $get(baseOfClientIds + 'duplicateHF');
    
    
    mt_highlightSelectedSS(SelectedNodeId, baseOfClientIds);
    SelectStoryCategory(SelectedArea, SelectedAreaName, SelectedNodeText, SelectedNodeValue, saveBtnClientId, UrlClientId, selectedCategoryLbl, SelectedNodeId, encouragedSpan)
    
    var tmp = document.getElementById(baseOfClientIds + "selcatlink"); 
    overlayclose(baseOfClientIds + "storysubmittreemenuholder");    
    return false;
}

function mt_highlightSelectedSS(selectedId, baseOfIds)
{
    var _lnk = selectedId;
    var containingDiv = $get(baseOfIds + "topicPnl");
    var lastLinkHF = $get(baseOfIds + "lastNodeSelectedHF");
    if(lastLinkHF.value != "")
    {
        lastSelected = $get("mt_" + lastLinkHF.value + "SS_ma");
        if(lastSelected)
        {
            lastSelected.parentNode.style.backgroundColor = "#E5E7E8";
            lastSelected.style.textDecoration='none';
        }
    }    
        
    var theLink = $get(_lnk);
    if(theLink && containingDiv)
    {
        theLink.parentNode.style.backgroundColor = "#dee0e2";
        var pos1 = containingDiv.scrollTop;
        theLink.focus();
        var pos2 = containingDiv.scrollTop;
        if(pos2 > pos1)
        {
            containingDiv.scrollTop = pos2 + 125;
        }
        theLink.style.textDecoration='underline';
        theLink.blur();
    }
}

function selectLastSelected(lastSelected, par1, par2, par3)
{
    overlay(par1, par2, par3); 
    var hf = $get(lastSelected);
    var selectedNodeId = "mt_" + hf.value + "SS_ma";
    var _lnk = selectedNodeId;
    var theLink = $get(_lnk);
    return false;
}

//Sets the session state value.
function SelectStoryCategory(SelectedArea, SelectedAreaName, SelectedNodeText, SelectedNodeValue, submitStoryCtl_saveBtnClientId, submitStoryCtl_UrlClientId, submitStoryCtl_selectedCategoryLbl, SelectedNodeId, encouragedSpan) 
{
    var baseString = submitStoryCtl_UrlClientId.replace('txtUrl', '');
    _btnSave = $get(submitStoryCtl_saveBtnClientId);
    _previouslySubmittedDiv = $get(baseString + 'previouslySubmittedDiv');
    _goToStoryLnk = $get(baseString + 'goToStoryLnk');
    _txtUrl = $get(submitStoryCtl_UrlClientId);
    _selectedCategoryLbl = $get(submitStoryCtl_selectedCategoryLbl);
    _txtLinkTilte = $get(baseString + 'txtLinkTilte');
    _txtLinkDescription = $get(baseString + 'txtLinkDescription');
    _lastNodeSelectedHF = $get(baseString + 'lastNodeSelectedHF');
    _catSelectedTextHF = $get(baseString +'catSelectedTextHF');
    _areaSelectedHF = $get(baseString + 'areaSelectedHF');
    _lastNodeSelectedHF.value = SelectedNodeValue;
    _catSelectedTextHF.value = SelectedNodeText; //SelectedAreaName + ' :: ' + SelectedNodeText;
    _areaSelectedHF.value = SelectedArea;
    _headerStatus = $get(baseString + 'titleH2');
    _encouragedSpan = $get(encouragedSpan);
    _txtTag = $get(encouragedSpan.replace('encouragedSpan', 'txtTag'));
    PageMethods.SelectStoryCategory(SelectedArea + '~' + SelectedAreaName + '~' + SelectedNodeText + '~' + SelectedNodeValue  + '~' + _txtUrl.value, OnSucceeded, OnFailed);
}
function OnSucceeded(result, userContext, methodName) 
{   
    if (methodName == "RateStory")
    {}
    else if(methodName == "SelectStoryCategory")
    {
        var parser = result.split('~~');
        var status = parser[0];
        var url = parser[1];
        var title = parser[2];
        var desc = parser[3];
        var text = parser[4];
        var tagList = parser[5];
        _selectedCategoryLbl.innerHTML = _catSelectedTextHF.value;
        var aTag = "<a id=\"@id\" class=\"@class\" href='#' onclick=\"javascript:TaggingAppendToList(this, '" + _txtTag.id + "');return false;\">@text</a>";
        var tagParser = tagList.split(', ');
        var encouragedInnerHtml = "";
        
        for(var i = 0; i < tagParser.length; i++)
        {
            var newTag = aTag.replace("@id", tagParser[i] + "_tag");
            newTag = newTag.replace("@text", tagParser[i]);           
            var assignedTags = ", " + _txtTag.value + ", ";
            if(assignedTags.indexOf(', ' + tagParser[i] + ', ') == -1)
            {
                newTag = newTag.replace("@class", "tagunSelected");
            }
            else
            {
                newTag = newTag.replace("@class", "tagSelected");
            }
            
            encouragedInnerHtml = encouragedInnerHtml + newTag + ", ";
        }
        if(encouragedInnerHtml.length > 3)
        {
            encouragedInnerHtml = encouragedInnerHtml.substring(0, encouragedInnerHtml.length - 3);
        }
     
    }
}


var _votesLbl;
var _mytrybeRatingLbl;
var _userRatingLbl;
var _rankValueTB;
var _myTrybeValueHF;
var _slider;
var _otherUserTB;

/* MC 11.23.7 - shorter scripts for ranker added */
/* StoryRankerMouseOver */
function SRMO(rtlId,rnk)
{
     var genderLit = $get(rtlId.replace('rankTextLBL', 'genderLit'));
     var otherRankingTextLBL = $get(rtlId.replace('rankTextLBL', 'otherRankingTextLBL'));
     //genderLit.style.display="none";
     //otherRankingTextLBL.style.display="none";
     
    var resout = "";
    switch (rnk)
    {
            case 1:
            resout = 'I hate';
            break;
            
            case 2:
            resout = 'I dislike';
            break;
            
            case 3:
            resout = 'I dislike a bit';
            break;
            
            case 4:
            resout = 'I\'m neutral';
            break;
            
            case 5:
            resout = 'I like a bit';
            break;
            
            case 6:
            resout = 'I like';
            break;
            
            case 7:
            resout = 'I love';
            break;
    }   
   
     $get(rtlId).innerHTML = resout;
     
     return false;
}

function histalert()
{
    alert("You can only rerank stories on your \'My History\' page");
    return false;
}

function SWLogin()
{
    return SWCtrl('login.ascx');
}

function SWCtrl(pagectrl)
{
    loadNewControl(pagectrl); 
    window.scroll(0, 0);
    return false;
}


function RS(nodeClicked)
{
    var prefix = nodeClicked.id.substring(0,nodeClicked.id.lastIndexOf("fsl"));
    var storyId = prefix + 'storyidHF';
    var votesId = prefix + 'votesLBL';
    var mytrybeRatingId = prefix + 'theirRankTextLBL';
    var userRatingId = prefix + 'rankTextLBL';
    var rankValueId = prefix + 'rankValueTB';
    var MyTrybeValueHFId = prefix + 'MytrybeValueHF';
    var sliderBarId = prefix + 'sliderbarId';
    var otherUserTbId = prefix +'otherUsersRankingTB';
    RateStoryJS(nodeClicked, storyId, votesId, mytrybeRatingId, userRatingId, rankValueId, MyTrybeValueHFId, sliderBarId, otherUserTbId);    
    
    nodeClicked.blur();
    return false;
    
}

//Sets the session state value.
function RateStoryJS(nodeClicked, storyId, votesId, mytrybeRatingId, userRatingId, rankValueId, myTrybeValueHF, sliderBarId, otherUserTbId) 
{
    var parentBaseOfSrc = window.location.href;
    parentBaseOfSrc = parentBaseOfSrc.replace('http://', '');
   
    var parentSrcArray = parentBaseOfSrc.split('/');
    var urlBase;

    var storyHF = $get(storyId);
    _votesLbl = $get(votesId);
    _mytrybeRatingLbl = $get(mytrybeRatingId);
    _userRatingLbl = $get(userRatingId);
    _rankValueTB = $get(rankValueId);
    _myTrybeValueHF = $get(myTrybeValueHF);
    _otherUserTB = $get(otherUserTbId);
    
    //instead of updating db then the front end stat controls//going to update the front end controls then go to the DB
    var voteCount = parseInt(_votesLbl.innerHTML);
    var oldVoteCount = voteCount;           //I want this so calucations can be done over agian server side, reason is listed below on call to server side function
    var newRating = parseInt(nodeClicked.id.substring(nodeClicked.id.lastIndexOf("fsl") + 3, nodeClicked.id.length));
    var oldRating = _rankValueTB.value;
    
    var mytryberank = parseInt(_myTrybeValueHF.value);
    var oldmytryberank = mytryberank; //I want this so calucations can be done over agian server side, reason is listed below on call to server side function
    var OtherUsersRank = parseInt(_otherUserTB.value);
    var UsersRank = newRating;
    
    //now that old rating has been captured we can set the new rating
    _rankValueTB.value = newRating;
    
    var thesum = (mytryberank * voteCount) + newRating;
       
    if (oldRating == 0)
    {
        voteCount++;
        
        // //D.F. I was trying to change the average dynamically but for now have decided simpler not to.
        var tmpRnk = thesum / voteCount;  
        mytryberank = Math.round(tmpRnk, 0);
    }
    else
    {
        thesum = (mytryberank * voteCount) + newRating - oldRating;  //only counting the users rerank as new rank by subracting old the old rank frpm the sum while adding the new rank
        var tmpRnk = thesum / voteCount;
        mytryberank = Math.round(tmpRnk, 0);
    }
    
    if(mytryberank < 1)
    {mytryberank = 1;}
    if(mytryberank > 7)
    {mytryberank = 7;}
        
    _votesLbl.innerHTML = voteCount;
    _myTrybeValueHF.value = mytryberank;
    
    if(OtherUsersRank != 0)
    {
        /*------------------------------------------------------------------------------------------------*/
        var genderLit = $get(rankValueId.replace('rankValueTB', 'genderLit'));
        var otherRankingTextLBL = $get(rankValueId.replace('rankValueTB', 'otherRankingTextLBL'));
        if(OtherUsersRank == newRating)
        {            
             
             genderLit.style.display="none";
             otherRankingTextLBL.style.display="none";
             
             if (newRating != "4")
             {
                _userRatingLbl.innerHTML = "We BOTH " + ratingToWords(_rankValueTB.value);
             }
             else
             {
               _userRatingLbl.innerHTML = "We BOTH are " + ratingToWords(_rankValueTB.value);
             }     
        }
        else
        {
            genderLit.style.display="inline";
            otherRankingTextLBL.style.display="inline";
            if (newRating != "4")
            {
               _userRatingLbl.innerHTML = "I " + ratingToWords(_rankValueTB.value);
            }
            else
            {
               _userRatingLbl.innerHTML = "I'm " + ratingToWords(_rankValueTB.value);
            }    
        }
        /*------------------------------------------------------------------------------------------------*/
    }
    else
    {    
        _mytrybeRatingLbl.innerHTML = ratingToWords(mytryberank + "");
    }
    
    //ToDo:Update stats

    var baseOfId = nodeClicked.id.substring(0, nodeClicked.id.lastIndexOf("fsl") + 3);
    
    //alert('baseofid:' + baseOfId);
    
    for(var i = 1; i < 8; i++)
    {
        $get(baseOfId + i).className = 'fslst' + i;
    } 
    
    //need to set both faces now...if they are on same node then a conjoined face   
    //alert("_votesLbl.display == 'none': " + _votesLbl.style.display);
    if(_votesLbl.style.display == "none")
    {
         nodeClicked.className = 'userselectedsliderstep' +_rankValueTB.value;
    }
    else if (OtherUsersRank == 0)
    {
        if(UsersRank == mytryberank)
        {
            nodeClicked.className = 'cojoinedsliderstep' + _rankValueTB.value;
        }
        else
        {
             $get(baseOfId + mytryberank).className = 'communitysliderstep' + mytryberank;
             nodeClicked.className = 'userselectedsliderstep' + _rankValueTB.value;
        }
    }
    else if(OtherUsersRank != 0)
    {        
        if (UsersRank == OtherUsersRank)
        {
            nodeClicked.className = 'cojoinedsliderstep' + _rankValueTB.value;
        }  
        else if (UsersRank != OtherUsersRank)
        {
            nodeClicked.className = 'userselectedsliderstep' +_rankValueTB.value;
            
            //$get(baseOfId + mytryberank).className = 'communitysliderstep' + mytryberank;
            $get(baseOfId + OtherUsersRank).className = 'othersliderstep' + _otherUserTB.value;
       
        }                
    }
  
    
    var upcomingTab = $get('DCPT_topmenu_newsites_link');
    
    var partnerId = $get('hfPartnerID');    
    var fpStatus = 'N';
    
    if(upcomingTab)
    {
        if(upcomingTab.className == '')
        {
            fpStatus = 'Y';
        }
    }
    PageMethods.RateStory(storyHF.value + '?' + nodeClicked.id + '?' + oldRating + '?' + oldVoteCount + '?' + _mytrybeRatingLbl.innerHTML + '?' + oldmytryberank + '?' + fpStatus + '?' + partnerId, OnSucceeded, OnFailed);
}

function OnFailed(error, userContext, methodName) 
{
    if(error !== null) 
    {
         alert(" An error occurred: " +  error.get_message());
    }
}

function RSA(nodeClicked)
{
    var prefix = nodeClicked.id.substring(0,nodeClicked.id.lastIndexOf("fsl"));
    
    //alert('prefix is ' + prefix);
    
    var userRatingId = prefix + 'rankTextLBL';
    var rankValueId = prefix + 'rankValueTB';
    
    RateStoryAlreadyAdded(nodeClicked, userRatingId, rankValueId);
    nodeClicked.blur();
    return false;
}



//Sets the session state value.
function RateStoryAlreadyAdded(nodeClicked, userRatingId, rankValueId) 
{
    _userRatingLbl = $get(userRatingId);
    _rankValueTB = $get(rankValueId);   
    _rankValueTB.value = parseInt(nodeClicked.id.substring(nodeClicked.id.lastIndexOf("fsl") + 3, nodeClicked.id.length));
     var baseOfId = nodeClicked.id.substring(0, nodeClicked.id.lastIndexOf("fsl") + 3);
    
    for(var i = 1; i < 8; i++)
    {
        var tmp = baseOfId + i;
        $get(tmp).className = 'fslst' + i;
    } 
    
    nodeClicked.className = 'userselectedsliderstep' + _rankValueTB.value;
}

function RSA(nodeClicked, parentUsersRankTB)
{
    var prefix = nodeClicked.id.substring(0,nodeClicked.id.lastIndexOf("fsl"));
    
    //alert('prefix is ' + prefix);
    
    var userRatingId = prefix + 'rankTextLBL';
    var rankValueId = prefix + 'rankValueTB';
    
    RateStoryAlreadyAdded(nodeClicked, userRatingId, rankValueId,  parentUsersRankTB);
    nodeClicked.blur();
    return false;
}

function RateStoryAlreadyAdded(nodeClicked, userRatingId, rankValueId, parentUsersRankTB) 
{
    
    var otherTb = $get(parentUsersRankTB);
        
    _userRatingLbl = $get(userRatingId);
    _rankValueTB = $get(rankValueId);  
    _rankValueTB.value = parseInt(nodeClicked.id.substring(nodeClicked.id.lastIndexOf("fsl") + 3, nodeClicked.id.length));
    
    if(otherTb)
    {
        otherTb.value = _rankValueTB.value;
    }
    
     var baseOfId = nodeClicked.id.substring(0, nodeClicked.id.lastIndexOf("fsl") + 3);
    
    for(var i = 1; i < 8; i++)
    {
        var tmp = baseOfId + i;
        $get(tmp).className = 'fslst' + i;
    } 
    
    nodeClicked.className = 'userselectedsliderstep' + _rankValueTB.value;
}


function resetUserText(ctlToResetId, rankValueId)
{
    var resetValue = $get(rankValueId).value;
    
    var tmp = $get(ctlToResetId);
    
    //alert('the id:' + rankValueId.replace('rankValueTB', 'otherUsersRankingTB'));
    var otherUserRankTB = $get(rankValueId.replace('rankValueTB', 'otherUsersRankingTB'));
   
    
    
    
    var otherValue = otherUserRankTB.value;
    //alert('other value is: ' + otherValue);
    var resetString = "<font color='black'> rate it </font>";
    
    
    if(otherValue == "0")
    { 
        if(resetValue != "0")
        { 
            if (resetValue != "4")
            {
                resetString = "I " + ratingToWords(resetValue);
            }
            else
            {
                resetString = "I'm " + ratingToWords(resetValue);
            } 
        }
    }
    else 
    {
         var genderLit = $get(rankValueId.replace('rankValueTB', 'genderLit'));
         var otherRankingTextLBL = $get(rankValueId.replace('rankValueTB', 'otherRankingTextLBL'));
         genderLit.style.display="inline";
         otherRankingTextLBL.style.display="inline";
         
                 
         if(resetValue != "0")
            {
            if(resetValue == otherValue)
            {
                 
                 
                 genderLit.style.display="none";
                 otherRankingTextLBL.style.display="none";
                 
                 if (resetValue != "4")
                 {
                    resetString = "We BOTH " + ratingToWords(resetValue);
                 }
                 else
                 {
                    resetString = "We BOTH are " + ratingToWords(resetValue);
                 }     
            }
            else
            {
                 
                if (resetValue != "4")
                 {
                    resetString = "I " + ratingToWords(resetValue);// + ",";
                 }
                 else
                 {
                    resetString = "I'm " + ratingToWords(resetValue);//+ ",";
                 }    
            }
        }
        
    }
     
    tmp.innerHTML= resetString; 
    //tmp.className ='userratingR';
}

function ratingToWords(rating)
{
     switch (rating)
        {
            case "7":
                return "love";
            case "6":
                return "like";
            case "5":
                return "like a bit";
            case "4":
                return "neutral";
            case "3":
                return "dislike a bit";
            case "2":
                return "dislike";
            case "1":
                return "hate";
            default:
                return "";
        }
}


//---------------End storyRating.js--------------------------------------------------------------------//

//---------------From BlogStory.js-------------------------------------------------------------------/

function ValidateText(objcntrl)
  {
    var vRx = new RegExp("<(.|\n)+?>", "ig");
    if (vRx.test(objcntrl.value)==true) return false;
    else return true;
  }
        
function doStrip(objText, objLink)
{
    var objTextCtrl= document.getElementById(objText);
    var objLinkCtrl= document.getElementById(objLink);
    var vRx = new RegExp("<(.|\n)+?>", "ig");
    objTextCtrl.value=trim(objTextCtrl.value.replace(/<(.|\n)+?>/ig ,""));
    if (vRx.test(objTextCtrl.value)==true)
        {objLinkCtrl.style.display="block"; return;}
    else 
        {objLinkCtrl.style.display="none";}
}

function doStrip(objText)
{
    var objTextCtrl= document.getElementById(objText);
    var vRx = new RegExp("<(.|\n)+?>", "ig");
    objTextCtrl.value=trim(objTextCtrl.value.replace(/<(.|\n)+?>/ig ,""));
    return false;
}

// Removes leading whitespaces
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}

function ValidateTitle(sender, e)
{
    //var strLinkTitle= sender.getAttribute("LinkRef");
    var objTitle=  document.getElementById(sender.controltovalidate);
    var cntrlNm= new String();
    cntrlNm=document.getElementById(sender.controltovalidate).id;
    cntrlNm= cntrlNm.substring(0,cntrlNm.lastIndexOf("_")+1) + "lnkErrTitle";
    var objLinkTitle= document.getElementById(cntrlNm);
    
    if (ValidateText(objTitle)==true)
        {
            objLinkTitle.style.display="none";
            e.IsValid = true;
         
        }
        else
        {
             objLinkTitle.style.display="block";
             objLinkTitle.onclick =function(){doStrip(objTitle.id ,cntrlNm);};
             e.IsValid = false;
         
      
        }
}

function ValidateDescription(sender, args)
{ 
    //var strLinkDesc= sender.getAttribute("LinkRef");
    var objDesc=  document.getElementById(sender.controltovalidate);
    var cntrlName= new String();
    cntrlName=document.getElementById(sender.controltovalidate).id;
    cntrlName= cntrlName.substring(0,cntrlName.lastIndexOf("_")+1) + "lnkErrDesc";
    var objLinkDesc= document.getElementById(cntrlName);
  
   
    if (ValidateText(objDesc)==true)
        { 
            objLinkDesc.style.display="none";
            args.IsValid = true;
            
        }
        else
        { 
             objLinkDesc.style.display="block";
             objLinkDesc.onclick =function(){doStrip(objDesc.id ,cntrlName);};
             args.IsValid = false;
         
        

             
        }
}

function ValidateText(objcntrl)
  {
    var vRx = new RegExp("<(.|\n)+?>", "ig");
    if (vRx.test(objcntrl.value)==true) return false;
    else return true;
  }
        
function doStrip(objText, objLink)
{
    var objTextCtrl= document.getElementById(objText);
    var objLinkCtrl= document.getElementById(objLink);
    var vRx = new RegExp("<(.|\n)+?>", "ig");
    objTextCtrl.value=objTextCtrl.value.replace(/<(.|\n)+?>/ig ,"");
    if (vRx.test(objTextCtrl.value)==true)
        {objLinkCtrl.style.display="block"; return;}
    else 
        {objLinkCtrl.style.display="none";}
}

function safeclosewin()
{
 var safeua = window.navigator.appVersion;
 var safemsie = safeua.indexOf ( "MSIE " );

 if (safemsie == -1 )
    {
            self.opener = this;
   setTimeout('self.close()',500);
 }
 else
 {
 var safeversion = safeua.substring(safemsie+5,safemsie+6);
  if (safeversion >= "7")
  {
   window.open('','_self');
   window.close();
  }
   else
  {
   self.opener = this;
   setTimeout('self.close()',500);
  }
 }
}    

var maxAllowed = 3;
var current = 0;
function ToggleImage(id, baseImage ,marked, counterId, maxAllowedId)
{	
	obj = document.getElementById(id);
	baseImage = document.getElementById(id);
	marked = document.getElementById(marked);
	//alert('hi from toggle image');
	if(obj)
	{
	    
		if(obj.style.display == "" || obj.style.display == "block")
		{
			obj.style.display = "none";		
			current = current - 1;
			marked.value = "no";			
		}
		else
		{
		    if(current == maxAllowed)
		    {
		         document.getElementById(counterId).innerHTML = "0";
		         return;
		    }
		    current = current + 1;
			obj.style.display = "";
			marked.value = "yes";
			
			obj.style.top = -500;
	    }
	    //var maxAllowed = parseInt(document.getElementById(maxAllowedId).value);
	    document.getElementById(counterId).innerHTML = (maxAllowed - current).toString();
	}
		
} 
 


var imageToSet = 1; 
function image_removal(obj, hiddenField_Id, imagesOrder)
{
    var hiddenField = document.getElementById(hiddenField_Id);
    obj.src = "../art/spacer.gif";
    hiddenField.value = "";
    if(imagesOrder < imageToSet)
    {imageToSet = imagesOrder;}
}

function image_selected(obj, height, width)
{
   var imageToFill = document.getElementById('Tabs_pnlPictures_image' + imageToSet);
   var imageData = document.getElementById('Tabs_pnlPictures_imageData' + imageToSet);
  
   //alert(height + '||' + width);
   //alert('imageData: ' + imageData +'imageToFill is: ' + imageToFill + '|| new source is: ' + obj.src + ' vs. value: ' + obj.src.value);
   
   imageToFill.src = obj.src;
   imageToFill.width = obj.width;
   imageToFill.height = obj.height;
   imageData.value = obj.src + '|' + height + '|' + width;
   
   //alert(imageData.value);
   
   if(imageToSet < 3)
   {imageToSet = imageToSet + 1;}
   else
   {imageToSet = 1;}
}

function over_img(obj)
{
    obj.style.border='3px solid #515151';
}

function out_img(obj)
{
    obj.style.border='3px solid #fff';
}

function goToStory(goToUrl)
{
      //alert('goToUrl: ' + goToUrl);
      story_window=window.open("../" + goToUrl, 'story_window', 'width=1000,height=900,toolbar=yes, location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes, resizable=yes');
      story_window.focus();
      this.window.close();
}


/**DHTML textbox character counter (IE4+) script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/) */

function charCounter(taObj, charactersLeftId, max) { 
	var charCounter = document.getElementById(charactersLeftId);
	if (taObj.value.length>=max) taObj.value=taObj.value.substring(0,max);
	if (charCounter) charCounter.innerHTML=max-taObj.value.length;
}

//var strControlId = "<%=txtTag.ClientID%>";
var mArray= new Array();
var mArrayId = new Array();
function GetTheIndex(strTag)
{
    nIndex = -1;
    for(i = 0 ; i < mArray.length; i++)
    {
        if(trim(mArray[i]) == strTag)
        {
            nIndex= i;
            break;
        }
    }   
    return nIndex; 
}
//modified D.F. to store string list in hidden field

function DisplayTheArray(txtTagId)
{
    var objCtrl = document.getElementById(txtTagId);
       
  
    if(objCtrl)
    {
        SortTheArray();
        str = "";
      
        for(i = 0 ; i < mArray.length; i++)
        {
            //str += "<a href=javascript:RemoveTag('" + mArray[i] + "')>" + mArray[i] + "</a> "; //replaced when moved tags to inside a textbox
                                                                                              //may want to eventually have same functionarly at least for the tag list so clicking on tag a second time RemoveTags it
            str += mArray[i] + ", ";                   
        }
       objCtrl.value = ltrimChar(str, ","); 
        objCtrl.value = rtrimChar(objCtrl.value, ",");
        objCtrl.value = trim(objCtrl.value);
                    
    }
}

function SortTheArray()
{
    for (i=0; i< mArray.length -1; i++)
    {
        for (j=0; j<mArray.length -1 -i; j++)        
        {
            if (mArray[j+1] < trim(mArray[j])) 
            {  /* compare the two neighbors */
                  tmp = trim(mArray[j]);         /* swap a[j] and a[j+1]      */
                  mArray[j] = mArray[j+1];
                  mArray[j+1] = tmp;
                  
                  tmp = mArrayId[j];
                  mArrayId[j] = mArrayId[j+1];
                  mArrayId[j+1] = tmp;
            }
        }
    }  
}

function RemoveTag(tagTxtId, strTag)
{
    nCt = 0;
    tempArray = new Array();
    tempArrayId = new Array();
    
    for(i = 0 ; i < mArray.length ; i++)        
    {
        if(trim(mArray[i]) != strTag)
        {
           
            tempArray[nCt] = trim(mArray[i]);
            tempArrayId[nCt] = mArrayId[i];   
             nCt++;           
        }
    }        
    mArray = tempArray;
    mArrayId = tempArrayId;
    DisplayTheArray(tagTxtId);
}

function TaggingAppendToList(tagCtl, theTb)
{
    RefreshTheArray(theTb);
    var theTxt = tagCtl.innerHTML.replace('&amp;', '&');
    //alert(theTxt);
    strTag = rtrimChar(theTxt, ',');
    strTag = trim(theTxt);
    nIndex = GetTheIndex(theTxt);
    //alert(strTag);
       
    if(nIndex != -1)
    {
         RemoveTag(theTb, strTag);  
         tagCtl.className = 'tagunSelected';             
    }          
    else
    {
        tagCtl.className = 'tagSelected';
     
        mArray[mArray.length] = strTag;                
        //mArrayId[mArrayId.length] = Id;
        DisplayTheArray(theTb);
    }  
    tagCtl.blur();
    return false;
}

function RefreshTheArray(txtTagId)
{
    var objCtrl = document.getElementById(txtTagId);
    
    objCtrl.value = trim(objCtrl.value);
    mArray = objCtrl.value.split(",");
    
}

 var isSubmit = false;

function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}

function trimChar(str, chars) {
    return ltrim(rtrim(str, chars), chars);
}

function ltrimChar(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrimChar(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

//---------------End addStory.js--------------------------------------------------------------------//


//---------------From taggingComponentScript.js-------------------------------------------------------------------//

var mArray= new Array();
var mArrayId = new Array();
function GetIndex(strTag)
{
    nIndex = -1;
    for(i = 0 ; i < mArray.length; i++)
    {
        if(trim(mArray[i]) == strTag)
        {
            nIndex= i;
            break;
        }
    }   
    return nIndex; 
}
//modified D.F. to store string list in hidden field

function DisplayArray(strControlId, hdnSubmit)
{
    var objCtrl = document.getElementById(strControlId);
    
    
    ctrl = document.getElementById(hdnSubmit);
    
  
    if(objCtrl)
    {
        SortArray();
        str = "";
        ctrl.value = '';
        for(i = 0 ; i < mArray.length; i++)
        {
            //str += "<a href=javascript:Remove('" + mArray[i] + "')>" + mArray[i] + "</a> "; //replaced when moved tags to inside a textbox
                                                                                              //may want to eventually have same functionarly at least for the tag list so clicking on tag a second time removes it
            str += mArray[i] + ",";
            if(ctrl)
            {
                ctrl.value += mArray[i] + ",";
            }          
            //alert('mArray[i] currently is: ' + mArray[i]);     
            //alert('ctrl.value currently is: ' + ctrl.value);            
        }
        
        objCtrl.value = ltrimChar(str, ","); 
        objCtrl.value = rtrimChar(objCtrl.value, ",");
        objCtrl.value = trim(objCtrl.value);
        
         
    }
}

function SortArray()
{
//alert(mArray);
    for (i=0; i< mArray.length -1; i++)
    {
        for (j=0; j<mArray.length -1 -i; j++)        
        {
            if (mArray[j+1] < trim(mArray[j])) 
            {  /* compare the two neighbors */
                  var tmpz = trim(mArray[j]);         /* swap a[j] and a[j+1]      */
                  mArray[j] = mArray[j+1];
                  mArray[j+1] = tmpz;
                  
                  tmpz = mArrayId[j];
                  mArrayId[j] = mArrayId[j+1];
                  mArrayId[j+1] = tmpz;
            }
        }
    }  
}

function Remove(strTag, strControlId, hdnSubmit)
{
    nCt = 0;
    tempArray = new Array();
    tempArrayId = new Array();
    //strTag= strTag + ",";
     //alert(strTag);
    
    for(i = 0 ; i < mArray.length ; i++)        
    {
        if(trim(mArray[i]) != strTag)
        {
           
            tempArray[nCt] = trim(mArray[i]);
            tempArrayId[nCt] = mArrayId[i];   
             nCt++;           
        }
    }        
    mArray = tempArray;
    mArrayId = tempArrayId;
    DisplayArray(strControlId, hdnSubmit)
}

function AppendToList(tagCtlId, strTag, strControlId, hdnSubmit)
{
    RefreshArray(strControlId);
    strTag= rtrimChar(strTag, ',');
    strTag= trim(strTag);
    //alert("'" + strTag + "'");
    nIndex = GetIndex(strTag);
    //alert(nIndex);
       
    var tagCtl = document.getElementById(tagCtlId);
    
    if(nIndex != -1)
    {
         Remove(strTag, strControlId, hdnSubmit);   
         
         tagCtl.className = 'tagunSelected';     
   
    }          
    else
    {
        tagCtl.className = 'tagSelected';
        
        mArray[mArray.length] = strTag;                
        //mArrayId[mArrayId.length] = Id;
        DisplayArray(strControlId, hdnSubmit)
    }  
    tagCtl.blur();
    //alert('tagCtl: ' + tagCtl + '|| tagCtls class: ' + tagCtl.className);
     
}

function RefreshArray(strControlId)
{
    var objCtrl = document.getElementById(strControlId);
    
    objCtrl.value = trim(objCtrl.value);
    
    mArray = objCtrl.value.split(",");
   //alert(mArray);
    //var objCtrl = document.getElementById(txtTagId);
    //objCtrl.value = trim(objCtrl.value);
    //mArray = objCtrl.value.split(",");
   
}

 var isSubmit = false;

function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}

//---------------End taggingComponentScript.js--------------------------------------------------------------------//

//---------------From sliderComponentScript.js-------------------------------------------------------------------//
// JScript File

var imageRotateThread;

function RotateImage()
{
        //alert('slideshows on page: ' + slideShowArray.length);
        
        if ( typeof(slideShowArray) == 'undefined' )
        {
            //alert('slideShowArray is not defined yet.');
            return;
        }
    
        for(j = 0; j < slideShowArray.length; j++)
        {
            if(document.getElementById(slideShowArray[j]))
            {
                var theImages = document.getElementById(slideShowArray[j]).getElementsByTagName("img");
                
                //alert('imageslength: ' +theImages.length);
                
                var theImgToShowId = "";
                
                var tmp;
                for(i = 0; i<theImages.length;i++)
                {            
                    if(theImages[i].style.display == "block")
                    { 
                        theImages[i].style.display="none";
                        if(i >= (theImages.length - 1))
                        {
                            theImages[0].style.display = "block";
                        }
                        else
                        {
                            theImages[i + 1].style.display = "block";
                        }
                        break;               
                    }
                }
                
                //alert('after for: imgToShowId: ' + theImgToShowId);
                //alert('imgToShow: ' +document.getElementById(theImgToShowId)); 
                if(document.getElementById(theImgToShowId))
                {
                    //alert('here2');
                    document.getElementById(theImgToShowId).style.display = "block";
                }
                
                //alert('last selected image: '+tmp.id+'||last selected image.display: '+tmp.style.display+'||image selected: '+document.getElementById(theImgToShowId).id+'|| image selected.display: '+document.getElementById(theImgToShowId).style.display);
            }
        }
    	
	    // Calling RotateImage() and setting time interval. You can change the rotation time here.
        
	    if(typeof slidedelay == 'undefined')
        {
            imageRotateThread = setTimeout("RotateImage()",4000)
        }
        else
        {
            imageRotateThread = setTimeout("RotateImage()",slidedelay)
        }

	

	
}

function start_slider(){
    //alert('in start slider, typeof(imageRotateThread) = ' + typeof(imageRotateThread));
    if( typeof(imageRotateThread) != 'undefined')  //hack solution to make sure it is initialized
    {
        clearTimeout(imageRotateThread);
    }
    RotateImage()
}

//---------------End sliderComponentScript.js--------------------------------------------------------------------//

//---------------From StoryEmailDropDown.js-------------------------------------------------------------------//

function StoryEmailDropDownSwitchPanels(ObjType,ObjType2,aType,aType2)
{
    document.getElementById(ObjType).style.display = "";
    document.getElementById(aType).className = "selected";
    document.getElementById(ObjType2).style.display = "none";
    document.getElementById(aType2).className = "";
}

function StoryEmailDropDownSwitchPanelsOld(ObjType,ObjType2,ObjType3,aType,aType2,aType3)
{
    document.getElementById(ObjType).style.display = "";
    document.getElementById(aType).className = "active";
    document.getElementById(ObjType2).style.display = "none";
    document.getElementById(aType2).className = "";
    document.getElementById(ObjType3).style.display = "none";
    document.getElementById(aType3).className = "";
}

function StoryEmailDropDownSwitchPanelsNew(ObjType,ObjType2,ObjType3,ObjType4,aType,aType2,aType3,aType4)
{
    document.getElementById(ObjType).style.display = "";
    document.getElementById(aType).className = "selected";
    document.getElementById(ObjType2).style.display = "none";
    document.getElementById(aType2).className = "";
    document.getElementById(ObjType3).style.display = "none";
    document.getElementById(aType3).className = "";
    
    if(document.getElementById(ObjType4) && document.getElementById(aType4))
    {
        document.getElementById(ObjType4).style.display = "none";
        document.getElementById(aType4).className = "";
    }
}

    function ValidateInvitations(_Type,_Obj,_Email1,_Email2,_Email3,_Email4,_Email5,_Email6,_Email7,_Email8,_Email9,_Email10,_lblInv,_txtTest,v)
        {
        var _Counter = 0;
        if(document.getElementById(_Email1).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email2).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email3).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email4).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email5).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email6).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email7).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email8).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email9).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email10).value != "")
        {
        _Counter = _Counter + 1;
        }
        var chkAll = document.forms.item(0).elements;
        var Selection = 0;
        for (i = 0; i < chkAll.length; i++)
            {
                if (chkAll.item(i).type == "checkbox")
                {
                    if(chkAll.item(i).checked == true)
                    {
                    
                    if(_Counter == 10)
                    {
                     if(_Type == 0)
                    {
                    _Obj.value = "";
                    }
                    else
                    {
                   _Obj.checked = false;
                    }
                    }
                    else
                    {
                    _Counter = _Counter + 1;
                    }
                    }
                }
            }
            document.getElementById(_lblInv).innerHTML = 10 - _Counter;
            if(document.getElementById(_txtTest) != null)
            {
                document.getElementById(_txtTest).value = 10 - _Counter;
            }
            
        }

        function ValidateForm(_Email1,_Email2,_Email3,_Email4,_Email5,_Email6,_Email7,_Email8,_Email9,_Email10,_lblFormerror,_lblFormerror2,vldtRequired,vldtInvalidEmail,vldtInvalidHtml)
        {
         var _Counter = 0;
        if(document.getElementById(_Email1).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email2).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email3).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email4).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email5).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email6).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email7).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email8).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email9).value != "")
        {
        _Counter = _Counter + 1;
        }
        if(document.getElementById(_Email10).value != "")
        {
        _Counter = _Counter + 1;
        }
        var chkAll = document.forms.item(0).elements;
        for (i = 0; i < chkAll.length; i++)
            {
                if (chkAll.item(i).type == "checkbox")
                {
                    if(chkAll.item(i).checked == true)
                    {
                    _Counter = _Counter + 1;
                    }
                }
            }
            _Return = true;
            if(_Counter == 0)
            {
            
            //document.getElementById(_lblFormerror).innerHTML = "Enter an email address.";
            //document.getElementById(_lblFormerror2).innerHTML = "Select an email address.";
            DisplayValidatorEmailIt(vldtRequired);
            _Return = false;
            }
            else
            {
            var _Validateemail = 0;
            if(document.getElementById(_Email1).value != "")
            {
            if(!echeck(document.getElementById(_Email1).value))
				{
				_Validateemail = 1;
				//document.getElementById("row1").innerHTML = "*";
				_Return = false;
				}
				else
				{
				//document.getElementById("row1").innerHTML = "";
				}
				}
				 if(document.getElementById(_Email2).value != "")
                {
				 if(!echeck(document.getElementById(_Email2).value))
				{
				_Validateemail = 1;
				//document.getElementById("row2").innerHTML = "*";
				_Return = false;
				}
				else
				{
				//document.getElementById("row2").innerHTML = "";
				}
				}
				 if(document.getElementById(_Email3).value != "")
            {
				 if(!echeck(document.getElementById(_Email3).value))
				{
				_Validateemail = 1;
				//document.getElementById("row3").innerHTML = "*";
				_Return = false;
				}
				else
				{
				//document.getElementById("row3").innerHTML = "";
				}
				}
				 if(document.getElementById(_Email4).value != "")
            {
				 if(!echeck(document.getElementById(_Email4).value))
				{
				_Validateemail = 1;
				//document.getElementById("row4").innerHTML = "*";
				_Return = false;
				}
				else
				{
				//document.getElementById("row4").innerHTML = "";
				}
				}
				 if(document.getElementById(_Email5).value != "")
            {
				 if(!echeck(document.getElementById(_Email5).value))
				{
				_Validateemail = 1;
				//document.getElementById("row5").innerHTML = "*";
				_Return = false;
				}
				else
				{
				//document.getElementById("row5").innerHTML = "";
				}
				}
				 if(document.getElementById(_Email6).value != "")
            {
				 if(!echeck(document.getElementById(_Email6).value))
				{
			    _Validateemail = 1;
				//document.getElementById("row6").innerHTML = "*";
				_Return = false;
				}
				else
				{
				//document.getElementById("row6").innerHTML = "";
				}
				}
            
             if(document.getElementById(_Email7).value != "")
            {
				 if(!echeck(document.getElementById(_Email7).value))
				{
			    _Validateemail = 1;
				//document.getElementById("row7").innerHTML = "*";
				_Return = false;
				}
				else
				{
				//document.getElementById("row7").innerHTML = "";
				}
				}
            
             if(document.getElementById(_Email8).value != "")
            {
				 if(!echeck(document.getElementById(_Email8).value))
				{
				_Validateemail = 1;
				//document.getElementById("row8").innerHTML = "*";
				_Return = false;
				}
				else
				{
				//document.getElementById("row8").innerHTML = "";
				}
				}
            
            if(document.getElementById(_Email9).value != "")
            {
				 if(!echeck(document.getElementById(_Email9).value))
				{
			_Validateemail = 1;
				//document.getElementById("row9").innerHTML = "*";
				_Return = false;
				}
				else
				{
				//document.getElementById("row9").innerHTML = "";
				}
				}
            
             if(document.getElementById(_Email10).value != "")
            {
				 if(!echeck(document.getElementById(_Email10).value))
				{
				_Validateemail = 1;
				//document.getElementById("row10").innerHTML = "*";
				_Return = false;
				}
				else
				{
				//document.getElementById("row10").innerHTML = "";
				}
				}
				if(_Validateemail == 1)
				{
				//document.getElementById(_lblFormerror).innerHTML = "&nbsp;Invalid email format";
				//document.getElementById(_lblFormerror2).innerHTML = "&nbsp;Invalid email in Tab1";
				DisplayValidatorEmailIt(vldtInvalidEmail);
				}else
				{
				    //d.f. 01.30.2008 - //second thought was the problem is incorrect call to validatetext  //first thought was overzealous validation that i beleive is being done with inline javascript anyway, so for now am commentint out this section
				 
				    ///// Validate Html Tags
				    var _Validatehtml = 0;
                    if(document.getElementById(_Email1).value != "")
                    {
                        if(!ValidateText(document.getElementById(_Email1)))
				        {
				        _Validatehtml = 1;
				        _Return = false;
				        }
				    }
				    
				    if(document.getElementById(_Email2).value != "")
                    {
                        if(!ValidateText(document.getElementById(_Email2)))
				        {
				        _Validatehtml = 1;
				        _Return = false;
				        }
				    }
				    
				    if(document.getElementById(_Email3).value != "")
                    {
                        if(!ValidateText(document.getElementById(_Email3)))
				        {
				        _Validatehtml = 1;
				        _Return = false;
				        }
				    }  
				    if(document.getElementById(_Email4).value != "")
                    {
                        if(!ValidateText(document.getElementById(_Email4)))
				        {
				        _Validatehtml = 1;
				        _Return = false;
				        }
				    }
				    if(document.getElementById(_Email5).value != "")
                    {
                        if(!ValidateText(document.getElementById(_Email5)))
				        {
				        _Validatehtml = 1;
				        _Return = false;
				        }
				    }
				    if(document.getElementById(_Email6).value != "")
                    {
                        if(!ValidateText(document.getElementById(_Email6)))
				        {
				        _Validatehtml = 1;
				        _Return = false;
				        }
				    }
				    if(document.getElementById(_Email7).value != "")
                    {
                        if(!ValidateText(document.getElementById(_Email7)))
				        {
				        _Validatehtml = 1;
				        _Return = false;
				        }
				    }
				    if(document.getElementById(_Email8).value != "")
                    {
                        if(!ValidateText(document.getElementById(_Email8)))
				        {
				        _Validatehtml = 1;
				        _Return = false;
				        }
				    }
				    if(document.getElementById(_Email9).value != "")
                    {
                        if(!ValidateText(document.getElementById(_Email9)))
				        {
				        _Validatehtml = 1;
				        _Return = false;
				        }
				    }
				    if(document.getElementById(_Email10).value != "")
                    {
                        if(!ValidateText(document.getElementById(_Email10)))
				        {
				        _Validatehtml = 1;
				        _Return = false;
				        }
				    }    
				        
			            if(_Validatehtml == 1)
			            {
			            //document.getElementById(_lblFormerror).innerHTML = "&nbsp;Invalid email format";
			            //document.getElementById(_lblFormerror2).innerHTML = "&nbsp;Invalid email in Tab1";
			            DisplayValidatorEmailIt(vldtInvalidHtml);
			            }
				
				    ///////////End Validate Hmtl Tags
				  
				}
            }
            
            
            //alert('return is: ' + _Return);
            if(_Return == false){
                return false;
            }
            else
            {
                return true;
            }
}
      
      function DisplayValidatorEmailIt(Id)
        {
            document.getElementById(Id).style.display = ""; 
            if (document.getElementById("divtop"+Id )) { document.getElementById("divtop"+Id).style.top = (-1 * document.getElementById("divtop"+Id).offsetHeight) + "px"; }
        }    
        
	function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
//		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
//		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
//		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
//		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
//		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
//		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
//		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function SelectAll()
{
     var _Counter = 0;
         var _Return = true;
         var chkAll = document.forms.item(0).elements;
         //document.forms.item(0).elements;
        var Selection = 0;
          if(document.getElementById("chkSelectAll").checked == true)
            {
            _Counter = _Counter + 1
            }
        for (i = 0; i < chkAll.length; i++)
            {
            _Counter = _Counter + 1
            }
            if(_Counter > 10 && document.getElementById("chkSelectAll").checked == true)
            {
            alert("You cannot select more than 10 email addresses.");
            document.getElementById("chkSelectAll").checked = false;
            }
            else
            {
        for (i = 0; i < chkAll.length; i++)
            {
            if(document.getElementById("chkSelectAll").checked == true)
            {
                if (chkAll.item(i).type == "checkbox")
                {
                    chkAll.item(i).checked = true;
                }
            }
            else
            {
                if (chkAll.item(i).type == "checkbox")
                {
                    chkAll.item(i).checked = false;
                }
            }
            }
            }
}
//---------------End StoryEmailDropDown.js--------------------------------------------------------------------//


//---------------loader.js-----------------------------------------------------------------------------//
// JScript File

/***********************************************
* Dock Content script- Created by and Ãƒâ€šÃ‚Â© Dynamicdrive.com
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full script
***********************************************/

 function FloatTopLeft(id)
{
    //Set the start X and Y position for division
    var startX = 622, startY = 10;
    var ns = (navigator.appName.indexOf("Netscape") != -1);
    
    //alert(id);
    var d = document;
    var px = document.layers ? "" : "px";
    function ml(id)
    {
        var el=d.getElementById?d.getElementById(id):d.all
        ?d.all[id]:d.layers[id];
        
        if(d.layers)el.style=el                    
        el.sP=function(x,y)
        {
            this.style.left=x+px;this.style.top=y+px;
        };
        el.x = startX; el.y = startY;                        
        return el;
    }
       
        window.stayTopLeft=function()
        {
            var pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
            var dY = (pY > startY) ? pY : startY;
            ftlObj.y += (dY - ftlObj.y)/8 + 1;
            ftlObj.sP(ftlObj.x, ftlObj.y);
            setTimeout("stayTopLeft()", 20);
        }
    ftlObj = ml(id);
    stayTopLeft();
}
            
           





//---------------end loader.js-------------------------------------------------------------------------//

//---------------from surveySlider.js------------------------------------------------------------------//
// JScript File

//should be tied to onlclick of node

function choiceClicked(nodeClicked, baseNode,txtId, lblId, valId, theValue)
{
    //set answer value
    //--------------------------------------------------
    document.getElementById(valId).value = theValue; 
    //-------------------------------------------------- 
    
    //change text being shown
    //--------------------------------------------------  
    document.getElementById(txtId).value = theValue;
    document.getElementById(lblId).innerHTML = theValue;
    //-------------------------------------------------- 
    
    //reset display with new node selected
    //--------------------------------------------------
    //reset other nodes class to "surveyNode" 
    var tmp = document.getElementById(baseNode);
    var baseId = tmp.id;
    tmp.className = 'surveyOnlyNode DivStyle';
    
    for(var i = 2; i < 22; i++)
    {
        tmp = document.getElementById(baseId + i);
        tmp.className = 'surveyOnlyNode DivStyle';
    }
    //set class of selected node appropriately        
    nodeClicked.className = 'surveyOnlyNodeSelected DivStyle';
    //alert('nodeClicked is: ' + nodeClicked);
    //alert('nodeClicked class: ' + nodeClicked.className);
    //----------------------------------------------------
}

function choiceClickedFilter(nodeClicked, baseNode,txtId, lblId, valId, theValue)
{
    //set answer value
    //--------------------------------------------------
    document.getElementById(valId).value = theValue; 
    //-------------------------------------------------- 
    
    //change text being shown
    //--------------------------------------------------  
    document.getElementById(txtId).value = theValue;
    document.getElementById(lblId).innerHTML = theValue;
    //-------------------------------------------------- 
    
    //reset display with new node selected
    //--------------------------------------------------
    //reset other nodes class to "surveyNode" 
    var tmp = document.getElementById(baseNode);
    var baseId = tmp.id;
    tmp.className = 'surveyNode DivStyle';
    
    for(var i = 2; i < 22; i++)
    {
        tmp = document.getElementById(baseId + i);
        tmp.className = 'surveyNode DivStyle';
    }
    //set class of selected node appropriately        
    nodeClicked.className = 'surveyNodeSelected DivStyle';
    //alert('nodeClicked is: ' + nodeClicked);
    //alert('nodeClicked class: ' + nodeClicked.className);
    //----------------------------------------------------
}

//should be tied to mouseover of node
//old signature (nodeOver, baseNode,txtId, lblId, valId, theValue)
 
function choiceOver(txtId, lblId, theValue)
{
    //change text being shown
    document.getElementById(lblId).innerHTML = theValue;
    document.getElementById(txtId).value = theValue;
        
    //var tmp = document.getElementById(baseNode);
    //var baseId = tmp.id;
}

//should be tied to mouseout not of nodes but of slider div
function sliderOut(basenode, txtId, lblId, valId)
{
     //set answer value
    //--------------------------------------------------
    var lastValue = document.getElementById(valId).value; 
    var lastValueInt = 0;
    if(lastValue != "")
    {
       lastValueInt = parseInt(lastValue);
    }
    //-------------------------------------------------- 
    
    //change text being shown
    //--------------------------------------------------  
    if(lastValue != "")// && lastValue != "0")
    {
    document.getElementById(txtId).value = lastValue;
    document.getElementById(lblId).innerHTML = lastValue;  
    }
    else
    {
        document.getElementById(txtId).value = "Rate It!";
        document.getElementById(lblId).innerHTML = "Rate It!";
    }
          
    lastValueInt = lastValueInt + 11;
    var idOfNode = basenode;
    if(lastValueInt != 1)
    {
        idOfNode = idOfNode + lastValueInt;
    }          
    document.getElementById(idOfNode).className = 'surveyOnlyNodeSelected DivStyle';
}

function sliderOutFilter(basenode, txtId, lblId, valId)
{
     //set answer value
    //--------------------------------------------------
    var lastValue = document.getElementById(valId).value; 
    var lastValueInt = 0;
    if(lastValue != "")
    {
       lastValueInt = parseInt(lastValue);
    }
    //-------------------------------------------------- 
    
    //change text being shown
    //--------------------------------------------------  
    if(lastValue != "")// && lastValue != "0")
    {
    document.getElementById(txtId).value = lastValue;
    document.getElementById(lblId).innerHTML = lastValue;  
    }
    else
    {
        document.getElementById(txtId).value = "Rate It!";
        document.getElementById(lblId).innerHTML = "Rate It!";
    }
          
    lastValueInt = (lastValueInt + 5) / 5;
    var idOfNode = basenode;
    if(lastValueInt != 1)
    {
        idOfNode = idOfNode + lastValueInt;
    }          
    document.getElementById(idOfNode).className = 'surveyNodeSelected DivStyle';
}


//---------------end surveySlider.js-------------------------------------------------------------------//



//---------------------------appended script ----------------------------------------------------------//

/***********************************************
* Drop Down/ Overlapping Content- Ãƒâ€šÃ‚Â© Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/


function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobjstr, opt_position){
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}

function HideAllMenues(baseId)
{
    var divTop = document.getElementById(baseId + "divTop");
    var divBehaviour = document.getElementById(baseId + "divBehaviour");
    var divFriend = document.getElementById(baseId + "divFriend");
    var divFashion = document.getElementById(baseId + "divFashion");
    var divNamed = document.getElementById(baseId + "divName");
    if(divTop != null && divBehaviour != null && divFriend != null && divFashion != null && divNamed != null)
    {
        divTop.style.display = "none";
        divBehaviour.style.display = "none";
        divFriend.style.display = "none";
        divFashion.style.display = "none";
        divNamed.style.display = "none";
    }
}



function mt_togsel(idval,menuid,catpath,hl)
{
    mt_tog(idval,hl);
    mt_sel(menuid,catpath,idval,0);
}

/** MT Menu Nav Tree Scripts **/
function mt_highlightSelected(idval)
{
     /* toggle submenu */
    var _lnk = 'mt_' + idval + '_ma';
    
    //alert('in highlight: ' + idval);
        
    var theLink = $get(_lnk);
    
    if(theLink && $get('tagsDiv').style.display != 'none')
    {
        //theLink.parentNode.style.backgroundColor = "#dee0e2";
        theLink.parentNode.style.color = "#353B3D";
        theLink.parentNode.style.fontFamily = "Arial";
        theLink.parentNode.style.fontSize = "12";
        
        
        //SCROLL POSITIONING STUFF ('STUFF' IS MY 2ND FAVORITE TECHNICAL TERM, RIGHT UNDER 'MAGIC')
        var pos1 = $get("topicPnl").scrollTop;
        
        
        if(theLink.focus()){};
       
        var pos2 = $get("topicPnl").scrollTop;
       
        //alert('pos1 = ' + pos1 + '||pos2' + pos2);
        
        if(pos2 > pos1)
        {
            $get("topicPnl").scrollTop = pos2 + 125;
        }
        
        theLink.style.textDecoration='none';
        theLink.style.color ='#00c9fe';
        theLink.style.fontFamily = "Arial";
        theLink.style.fontSize = "12";
            
        theLink.blur();
    }
            
}

function mt_tog(idval,hl)
{
    /* toggle submenu */
    var sm = 'mt_' + idval + '_sm';
    var imgpl = 'mt_' + idval + '_img';
	var _lnk = 'mt_' + idval + '_ma';
    var smobj = $get(sm);
    
    if ( smobj )
    {
        //expand
        if ( smobj.style.display == "none" )
        {
            smobj.style.display = "block";
            if ( hl == 1 )
            {
                $get(imgpl).src = 'images/colbl.gif';            
            }
            else
            {
                $get(imgpl).src = 'images/col.gif';
            }
           
			if($get(_lnk).parentNode.parentNode != null)
			{
				$get(_lnk).parentNode.parentNode.nodeName;
			}			
        }
        else
        {
            //collapse
            smobj.style.display = "none";
            $get(imgpl).src = 'images/exp.gif';
        }           
    } 
}

function mt_open(idval,hl)
{
    /* toggle submenu */
    var sm = 'mt_' + idval + '_sm';
    var imgpl = 'mt_' + idval + '_img';
	var _lnk = 'mt_' + idval + '_ma';
    var smobj = $get(sm);
    
    if ( smobj )
    {
        //expand
        if ( smobj.style.display == "none" )
        {
            smobj.style.display = "block";
            if ( hl == 1 )
            {
                $get(imgpl).src = 'images/colbl.gif';            
            }
            else
            {
                $get(imgpl).src = 'images/col.gif';
            }
           
			if($get(_lnk).parentNode.parentNode != null)
			{
				$get(_lnk).parentNode.parentNode.nodeName;
			}			
        }               
    }  
}

function mt_highlightParentOrLeaf(idval)
{
    /* try leaf, then parent */
    var imgpl = 'mt_' + idval + '_limg';
    if ( $get(imgpl) )
    {
        $get(imgpl).src = 'images/noexp_1.gif';
    }
    else
    {
        imgpl = 'mt_' + idval + '_img';
        if ( $get(imgpl) )
        {
            $get(imgpl).src = 'images/colbl.gif';
        }
    }
}

function mt_sel(menuid,catpath,lidval,hl)
{
    if ( hl == 1 )
    {
         var imgpl = 'mt_' + lidval + '_limg';
         $get(imgpl).src = 'images/noexp_1.gif';
    }
    __doPostBack(menuid, catpath);
}

/* email dropdown functions */
function EmailDropDownGoToStep2()
{
    var tblstep1 = document.getElementById("tblstep1");
    var tblstep2 = document.getElementById("tblstep2");
    var btnadd = document.getElementById("btnadd");
     var btnadd2 = document.getElementById("btnadd2");
    if(tblstep1 != null && tblstep2 != null && btnadd != null && btnadd2 != null)
    {
        btnadd.style.display = "";
         btnadd2.style.display = "";
        tblstep2.style.display = "";
        tblstep1.style.display = "none";
    }
    return false;
}



function relativeToggleImgIndicated(theCtl, theGivenId, ctlToToggleId, imgToToggleId)
{
    var genId = theCtl.id.replace(theGivenId, ctlToToggleId);
    var ctlToToggle = $get(genId);
    var imgToToggle = $get(theCtl.id.replace(theGivenId, imgToToggleId));
    
    if(ctlToToggle.style.display == 'none')
    {
    ctlToToggle.style.display = 'block';
    imgToToggle.src = "images/arrow_users_down.gif";
    }
    else
    {
    ctlToToggle.style.display = 'none';
    imgToToggle.src = "images/arrow_users_right.gif";
    }
    
    return false;   
}

function SwapAddSiteImage(_img,_path)
{
document.getElementById(_img).src = "images/" + _path;
}

function SwapPartnerAddSiteImage(_img,_path)
{
    document.getElementById(_img).src = "../images/" + _path;
}

function postionControlStories(parentId, childId)
{
    var p = $get(parentId);
    var c = $get(childId);
   
    var parser = childId.split('_');
    var containerPrefix = parser[0] + '_' + parser[1] + '_';
   
    if($get(containerPrefix + 'mapitDiv'))
    {
        $get(containerPrefix + 'mapitDiv').style.display = "none";
        $get(containerPrefix + 'emailitDiv').style.display = "none";
        $get(containerPrefix + 'blogDiv').style.display = "none"; 
        $get(containerPrefix + 'taggingDiv').style.display = "none";
    }
    
   
    
    c.style.display = "block";
    p.style.display = "block";
    p.appendChild(c);
}





function resetUserFilterCtls()
{
//the two search tb's
var tb1 = $get('userSearchTB');
if(tb1){tb1.value = '';}
var tb2 = $get('userQuickSearchTB');
if(tb2){tb2.value = '';}

//sex
$get('rbSex_0').checked = true;
$get('rbSex_1').checked = false; 
$get('rbSex_2').checked = false;


//Age
$get('age1DDL').selectedIndex = 0;
$get('age2DDL').selectedIndex = 0;

//Interested In
$get('rbInterestedin_0').checked = true;
$get('rbInterestedin_1').checked = false;
$get('rbInterestedin_2').checked = false;
$get('rbInterestedin_3').checked = false;


//similarity
var slid = $get('Slider1_rankValue');
if(slid)  //d.f. we are in trybe mode so reset as needed
{
    slid.value= 0;
    $get('Slider1_rankTXT').value = 0;
    $get('Slider1_rankLbl').innerHTML = '0';

    $get('Slider1_node').className = 'surveyNodeSelected';
    $get('Slider1_node2').className = 'surveyNode';
    $get('Slider1_node3').className = 'surveyNode';
    $get('Slider1_node4').className = 'surveyNode';
    $get('Slider1_node5').className = 'surveyNode';
    $get('Slider1_node6').className = 'surveyNode';
    $get('Slider1_node7').className = 'surveyNode';
    $get('Slider1_node8').className = 'surveyNode';
    $get('Slider1_node9').className = 'surveyNode';
    $get('Slider1_node10').className = 'surveyNode';
    $get('Slider1_node11').className = 'surveyNode';
    $get('Slider1_node12').className = 'surveyNode';
    $get('Slider1_node13').className = 'surveyNode';
    $get('Slider1_node14').className = 'surveyNode';
    $get('Slider1_node15').className = 'surveyNode';
    $get('Slider1_node16').className = 'surveyNode';
    $get('Slider1_node17').className = 'surveyNode';
    $get('Slider1_node18').className = 'surveyNode';
    $get('Slider1_node19').className = 'surveyNode';
    $get('Slider1_node20').className = 'surveyNode';
    $get('Slider1_node21').className = 'surveyNode';

    //ovearll checkbox
    $get('chkSimilarity_0').checked = false;

}


//relationshiop
$get('chkRelationShip_0').checked = false;
$get('chkRelationShip_1').checked = false;
$get('chkRelationShip_2').checked = false;
$get('chkRelationShip_3').checked = false;
$get('chkRelationShip_4').checked = false;
$get('chkRelationShip_5').checked = false;

//looking for
$get('chkLookingFor_0').checked = false;
$get('chkLookingFor_1').checked = false;
$get('chkLookingFor_2').checked = false;
$get('chkLookingFor_3').checked = false;
$get('chkLookingFor_4').checked = false;

//personal
var p = $get('interestsTB');
if(p)
{
    p.value = 'Interests...';
    $get('occupationTB').value = 'Occupation...';
    $get('educationTB').value = 'Education...';
}

return false;
}
function LoadFlash(){                                    
    <!--
    // -----------------------------------------------------------------------------
    // Globals
    // Major version of Flash required
    var requiredMajorVersion = 8;
    // Minor version of Flash required
    var requiredMinorVersion = 0;
    // Minor version of Flash required
    var requiredRevision = 0;
    // -----------------------------------------------------------------------------
    // -->
    <!--
    // Version check based upon the values entered above in "Globals"
    var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

    // Check to see if the version meets the requirements for playback
    if (hasReqestedVersion) {
    AC_FL_RunContent(
    "src", "flash/intro_final",
    "width", "240",
    "height", "236",
    "align", "middle",
    "id", "detectionExample",
    "quality", "high",
    "bgcolor", "#262E31",
    "name", "detectionExample",
    "allowScriptAccess","sameDomain",
    "type", "application/x-shockwave-flash",
    'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
    "pluginspage", "http://www.adobe.com/go/getflashplayer"
    );
    } else {  // flash is too old or we can't detect the plugin
    var alternateContent = '<div id="signup" ><h1></h1><p>A Flash plugin is required to view this movie.</strong></p><p> Click <b><a id="A1" class="learn" target="_blank" href="http://www.adobe.com/products/flashplayer/" target="_blank" >here</a></b> to get it.</p><p style="color: #b3b0b0; padding-top: 65px;"> Or click <a id="A1" class="learn" href="javascript:loadslideshow();" style="color: #b3b0b0;"> here</a> to view a slideshow.</p></div>';
    document.getElementById('flashcontainer').innerHTML=alternateContent;  // insert non-flash content
    }
}

function Topicstoprowhover(_obj,_lbl)
{
 document.getElementById(_obj).className = "Mytopicsrowhover";
 document.getElementById(_lbl).style.display="";
}

function Topicstoprowout(_obj,_lbl)
{
 document.getElementById(_obj).className = "Mytopicsrow1";
 document.getElementById(_lbl).style.display="none";
}

function Topicstoprowclick(_obj,_lbl)
{
 if(!document.getElementById(_lbl).checked)
 {
	 document.getElementById(_lbl).checked = true;
	 setTimeout("__doPostBack('" + _lbl  + "','')", 0)
 }
 else
 {
	 document.getElementById(_lbl).checked = false;
	 setTimeout("__doPostBack('" + _lbl  + "','')", 0)
 }
}

function Topicssubtoprowhover2(_obj)
{
 _obj.className = "Mytopicssubrowhover";
}
function Topicssubtoprowout2(_obj)
{
_obj.className = "Mytopicssubrow1";
}

function loadslideshow()
{
    var _signup=document.getElementById('signup');
	var _slideshow=document.getElementById('show3');
	if(_slideshow!=null && _signup!=null)
	{
		_slideshow.style.display='block';
		_signup.style.display='none';
		new inter_slide(slides3);
	}
}
var preload_ctrl_images=true;
var previmg='images/left.gif';
var stopimg='images/stop.gif';
var playimg='images/play.gif';
var nextimg='images/right.gif';

var slides3=[]; //THIRD SLIDESHOW
//configure the below images and descriptions to your own, note optional links, target and window specifications. 
slides3[0] = ["images/img_9.gif", ""];
slides3[1] = ["images/img_1.gif", ""];
slides3[2] = ["images/img_2.gif", ""];
slides3[3] = ["images/img_3.gif", ""];
slides3[4] = ["images/img_4.gif", ""];
slides3[5] = ["images/img_5.gif", ""];
slides3[6] = ["images/img_6.gif", ""];
slides3[7] = ["images/img_7.gif", ""];
slides3[8] = ["images/img_8.gif", ""];
//optional properties for these images:
slides3.image_controls=1; //use images for controls
slides3.button_highlight='#cccccc'; //onmouseover background-color for image buttons (requires image_controls=1)
slides3.specs='width=236, height=250' //global specifications for this show's new window(s)
slides3.manual_start=1; //start show in manual mode (stopped)
slides3.delay=5000;

function setIframeHeight(_obj,_height)
{
    document.getElementById("ifrPhoto2").style.height = _height + 105 + "px";
}

function OpenParentRegister()
{
    return loadNewControl('register.ascx');
}

function Showoverviewpopup()
{
lwidth = 248;
lheight = 252;
path="overviewvideo.aspx";
pname="popup";
    var posX = ((screen.availWidth/2)-(lwidth/2));
    var posY = ((screen.availHeight/2)-(lheight/2));
    window.open(path,pname,'width=' + lwidth + ',height=' + lheight + ',scrollbars=no,status=no,toolbar=no,menubar=no,location=no,directories=no,left=' + posX + ',top=' + posY);
}

function showrankerdiv(rankerdiv)
{
    document.getElementById(rankerdiv).style.display = 'block';   
}
function Hiderankerdiv(rankerdiv)
{
    document.getElementById(rankerdiv).style.display = 'none';
}

function RSP(nodeClicked)
{
    var prefix = nodeClicked.id.substring(0,nodeClicked.id.lastIndexOf("fsl"));
    var prefix2 = nodeClicked.id.substring(0,nodeClicked.id.lastIndexOf("wr")) + 'wr_';
    var userRatingId = prefix + 'rankTextLBL';
    var rankValueId = prefix + 'rankValueTB';
    var votesLBL = prefix + 'votesLBL';
    RateStoryAlreadyAdded(nodeClicked, userRatingId, rankValueId);
        
    var rating = parseInt(nodeClicked.id.substring(nodeClicked.id.lastIndexOf("fsl") + 3, nodeClicked.id.length));   
    nodeClicked.blur();
    
    var ratingHF = document.getElementById(prefix2 + 'ratingVal');
    var goToHF = document.getElementById(prefix2 + 'goToHF');
    
    var theCategory = document.getElementById(prefix2 + 'theCategory');
    var theUrl = document.getElementById(prefix2 + 'theUrl');
    
    ratingHF.value = rating;
        
    
        
    var btn = document.getElementById(prefix2 + 'rateItBtn');
    if(btn)
    {
        btn.click();
    }
        
    resetUserText(votesLBL, rankValueId);
    
    return false; 
}
    
    function showdummyrankerdiv2()
    {
        document.getElementById("rankerdiv").style.display = '';
    }
    
    function Hidedummyrankerdiv()
    {
        document.getElementById("rankerdiv").style.display = 'none';
    }
    
function RSA_New(nodeClicked, _value)
{
    var prefix = nodeClicked.id.substring(0,nodeClicked.id.lastIndexOf("fsl"));
    var userRatingId = prefix + 'rankTextLBL';
    var rankValueId = prefix + 'rankValueTB';
        
    var rankerdiv = $get(prefix + 'rankerdiv2');
    var dummyuserranker = $get(prefix + 'dummyuserranker');
    var rankertext = $get(prefix + 'rankertext');
    var imgRankerimage = $get(prefix + 'imgRankerimage');
  
    RateStoryAlreadyAdded_New(nodeClicked, userRatingId, rankValueId);
       
    nodeClicked.blur();
    rankerdiv.style.display= "none";
   
    if(dummyuserranker.value == "0")
    {   
       rankertext.innerHTML = parseInt(rankertext.innerHTML) + 1;
       imgRankerimage.src = "./rankerImages/dummyranker" + _value + ".gif";
       dummyuserranker.value = "1"; 
    }
    else
    {
        imgRankerimage.src = "./rankerImages/dummyranker" + _value + ".gif";
    }        
    
    return false;
}

function RateStoryAlreadyAdded_New(nodeClicked, userRatingId, rankValueId) 
{
    _userRatingLbl = $get(userRatingId);
    _rankValueTB = $get(rankValueId);   
    _rankValueTB.value = parseInt(nodeClicked.id.substring(nodeClicked.id.lastIndexOf("fsl") + 3, nodeClicked.id.length));
     var baseOfId = nodeClicked.id.substring(0, nodeClicked.id.lastIndexOf("fsl") + 3);
    
    for(var i = 1; i < 8; i++)
    {
        var tmp = baseOfId + i;
        $get(tmp).className = 'fslst' + i;
    } 
}

function SRMO_New(rtlId,rnk)
{
     var genderLit = $get(rtlId.replace('rankTextLBL', 'genderLit'));
     var otherRankingTextLBL = $get(rtlId.replace('rankTextLBL', 'otherRankingTextLBL'));
     genderLit.style.display="none";
     otherRankingTextLBL.style.display="none";
     
    var resout = "";
     switch (rnk)
    {
            case 1:
            resout = 'I hate';
            break;
            
            case 2:
            resout = 'I dislike';
            break;
            
            case 3:
            resout = 'I dislike a bit';
            break;
            
            case 4:
            resout = 'I\'m neutral';
            break;
            
            case 5:
            resout = 'I like a bit';
            break;
            
            case 6:
            resout = 'I like';
            break;
            
            case 7:
            resout = 'I love';
            break;
    }
     $get(rtlId).innerHTML = resout;
     
     return false;
}

function RS_New(nodeClicked)
{
    var prefix = nodeClicked.id.substring(0,nodeClicked.id.lastIndexOf("fsl"));
    var storyId = prefix + 'storyidHF';
    var votesId = prefix + 'votesLBL';
    var mytrybeRatingId = prefix + 'theirRankTextLBL';
    var userRatingId = prefix + 'rankTextLBL';
    var rankValueId = prefix + 'rankValueTB';
    var MyTrybeValueHFId = prefix + 'MytrybeValueHF';
    var sliderBarId = prefix + 'sliderbarId';
    var otherUserTbId = prefix +'otherUsersRankingTB';
    return false;
    
}

function resetUserText_New(ctlToResetId, rankValueId)
{
    var resetValue = $get(rankValueId).value;    
    var tmp = $get(ctlToResetId);    
    var otherUserRankTB = $get(rankValueId.replace('rankValueTB', 'otherUsersRankingTB'));
    var otherValue = otherUserRankTB.value;
    var resetString = "Rate It";
    resetString = resetValue;
    if(resetValue != 0)
    {
      
    }
        if(otherValue == "0")
    { 
        if(resetValue != "0")
        { 
            if (resetValue != "4")
            {
                resetString = "I " + ratingToWords(resetValue);
            }
            else
            {
                resetString = "I'm " + ratingToWords(resetValue);
            } 
        }
    }
    else 
    {
         var genderLit = $get(rankValueId.replace('rankValueTB', 'genderLit'));
         var otherRankingTextLBL = $get(rankValueId.replace('rankValueTB', 'otherRankingTextLBL'));
         genderLit.style.display="inline";
         otherRankingTextLBL.style.display="inline";
         
                 
         if(resetValue != "0")
            {
            if(resetValue == otherValue)
            {
                 
                 
                 genderLit.style.display="none";
                 otherRankingTextLBL.style.display="none";
                 
                 if (resetValue != "4")
                 {
                    resetString = "We BOTH " + ratingToWords(resetValue);
                 }
                 else
                 {
                    resetString = "We BOTH are " + ratingToWords(resetValue);
                 }     
            }
            else
            {
                 
                if (resetValue != "4")
                 {
                    resetString = "I " + ratingToWords(resetValue) + ",";
                 }
                 else
                 {
                    resetString = "I'm " + ratingToWords(resetValue) + ",";
                 }    
            }
        }
        
    }
     if(resetString == "0")
     {
        resetString = "Rate It";
     }
    tmp.innerHTML= resetString; 
    
function ratingToWords(rating)
{
     switch (rating)
        {
            case "7":
                return "love";
            case "6":
                return "like";
            case "5":
                return "like a bit";
            case "4":
                return "neutral";
            case "3":
                return "dislike a bit";
            case "2":
                return "dislike";
            case "1":
                return "hate";
            default:
                return "";
        }
}
}

    function Hidedummyrankerdiv()
    {document.getElementById("rankerdiv").style.display = 'none';}
    
    function showdummyrankerdiv2()
    {document.getElementById("rankerdiv").style.display = '';}
    
    function Hidedummyrankerdiv_new(id)
    {document.getElementById(id).style.display = 'none';}
    
     function showdummyrankerdiv2_new(id)
    {document.getElementById(id).style.display = '';}
    
    
    
function ChangeImage(CTRL, Src)
{
    CTRL.style.background = Src;
}

function ShowDiv(theCtl, theGivenId, ctlToToggleId)
{
    var genId = theCtl.id.replace(theGivenId, ctlToToggleId);
    var ctlToToggle = $get(genId);
    
    if(ctlToToggle.style.display == 'none')
    {ctlToToggle.style.display = 'block';}
    else
    {ctlToToggle.style.display = 'none';}
    
    return false;    
}
 
 function CallMe()
 {     
     //var ctrl = document.getElementById(src);
     // call server side method
     //document.getElementById("testform1").submit();
     //__doPostBack('lnkRefreshButton','');
     //alert('in callme()');
    
    
    /*var hfIsFacebook = document.getElementById('hfIsFacebook');
   
    if(hfIsFacebook)
    {
        if(hfIsFacebook.value == 'true')
        {
            var hfFacebookFinishedLink = document.getElementById('hfFacebookFinishedLink');           
            top.location = hfFacebookFinishedLink.value;
        }
    }*/
    
    var btn = document.getElementById('lnkRefreshButton');
    if(btn)
    {
        //alert('button found');
        btn.click();
    }
 }
 
 function CallMe2()
 {      
    var btn = document.getElementById('lnkRefreshButton');
    if(btn)
    {
        btn.click();
    }
 }
 
 function CallMe(action)
 {  
    //alert('in callme(action)');
    var hfFacebookFinishedLink = document.getElementById('hfFacebookFinishedLink');           
    top.location = hfFacebookFinishedLink.value + '&action=' + action;   
 }
 
 function redirectAndPersistQueryString(newCtl)
    {    
        return loadNewControlFB(newCtl);
        
        /*  d.f. this javascript could be useful for client side redirects      
        var newLocation = 'mUserWidget.aspx';        
        var queryStr = window.location.search;        
        
        if(queryStr.indexOf("&ctl") > -1)
        {
            queryStr = queryStr.substring(0, queryStr.indexOf("&ctl"));
        }  
        window.location = newLocation + queryStr + '&ctl=' + newCtl;
                
        return false; */
    }
    
    function activateStepsToggle(base, turnon, count)
    {
        for(var i= 1; i <= count; i++)
        {
            document.getElementById(base + i).style.display = 'none';
        } 
        
        document.getElementById(base + turnon).style.display = 'block';
        
        return false;
    }
    
    function Toggle(ctlId)
    {    
        //alert('hiya from single param toggle');   
        var ctl = document.getElementById(ctlId);
        if(ctl.style.display == 'none')
        {
            ctl.style.display = '';
        }
        else
        {
            ctl.style.display = 'none';
        }        
    }
    
    function ToggleOff(ctlId)
    {
        var ctl = document.getElementById(ctlId);
        ctl.style.display = 'none';       
    }
    
    
    
    
    
    /*
    
    hfLoginAction
loginGear
divLoginHeader
ltrDetailsLoginReg
     */
     function ShowLoginModal(loginAction, headerText, subHeaderText)
     {
        var hfLoginAction = $get('hfLoginAction');
        var loginGear = $get('loginGear');
        var divLoginHeader = $get('divLoginHeader');
        var ltrDetailsLoginReg = $get('ltrDetailsLoginReg');
        //var divIntallOptions = $get('divIntallOptions');
        
        var divLogin = $get('divLogin');
        var divPopupReg = $get('divPopupReg');
        
        //set post login action
        hfLoginAction.value = loginAction;
        
        
        
        
        //Set Header Copy
        divLoginHeader.innerHTML = headerText;
        
        //Set subheader copy
        ltrDetailsLoginReg.innerHTML = subHeaderText;
        
        $find('mdlTryItHelp').show();
        
        //set visibility of gear as needed
        loginGear.style.display = 'none';
        
        
        if(loginAction == 'getWidget')
        {
            loginGear.style.display = 'block';
            
            if(divLogin)
            {divLogin.style.display = 'block';}
            
            if(divPopupReg)
            {divPopupReg.style.display = 'none';}
            
            //divIntallOptions.style.display = 'block';
        }
        else
        {
        
            //divIntallOptions.style.display = 'none';
            
            if(divLogin)
                divLogin.style.display = 'block';
            
            
            var userTB = $get('LoginBasic1_userID');
            //alert(userTB);
            if(userTB)
            {userTB.focus();}
            
            if(divPopupReg)
             divPopupReg.style.display = 'none';
        }
        
        return false;
        
     }

function muwCloseLearnMore()
{
    var hfIsUserless = $get('hfIsUserless');
    if(hfIsUserless && hfIsUserless.value == 'true')
    {
        $find('mdlHelp').hide();
        $find('mdlTryItHelp').show();
    }
    else
    {
        $find('mdlHelp').hide();
    }
    return false;
    
}


function suClickButton(newcat, btnId, hfId)
{
    var theBtn;     
   
    //D.F. THIS OUGHT TO BE DYNAMIC VS HARDCODED DCPT_  10.30.08
    theBtn = document.getElementById(btnId);  
    hf = document.getElementById(hfId);
    
    if(hf)
    {
        hf.value = newcat; 
    }
   
    if(theBtn)
    {
         //alert('hf _ value:' + hf.value);        
         theBtn.click();
        
    } 
      
    return false;
}

    
    
    //---------------loader.js-----------------------------------------------------------------------------//
// JScript File

/***********************************************
* Dock Content script- Created by and Ãƒâ€šÃ‚Â© Dynamicdrive.com
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full script
***********************************************/

var offsetfromedge=0      //offset from window edge when content is "docked". Change if desired.
var dockarray=new Array() //array to cache dockit instances
var dkclear=new Array()   //array to cache corresponding clearinterval pointers

function dockit(el, duration){
this.source=document.all? document.all[el] : document.getElementById(el);
this.source.height=this.source.offsetHeight;
this.docheight=truebody().clientHeight;
this.duration=duration;
this.pagetop=0;
this.elementoffset=this.getOffsetY();
dockarray[dockarray.length]=this;
var pointer=eval(dockarray.length-1);
var dynexpress='dkclear['+pointer+']=setInterval("dockornot(dockarray['+pointer+'])",100);';
dynexpress=(this.duration>0)? dynexpress+'setTimeout("clearInterval(dkclear['+pointer+']); dockarray['+pointer+'].source.style.top=0", duration*1000)' : dynexpress;
eval(dynexpress);
}

dockit.prototype.getOffsetY=function(){
var totaloffset=parseInt(this.source.offsetTop);
var parentEl=this.source.offsetParent;
while (parentEl!=null){
totaloffset+=parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function dockornot(obj){
obj.pagetop=truebody().scrollTop;
if (obj.pagetop>obj.elementoffset) //detect upper offset
obj.source.style.top=obj.pagetop-obj.elementoffset+offsetfromedge+"px";
else if (obj.pagetop+obj.docheight<obj.elementoffset+parseInt(obj.source.height)) //lower offset
obj.source.style.top=obj.pagetop+obj.docheight-obj.source.height-obj.elementoffset-offsetfromedge+"px";
else
obj.source.style.top=0;
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
//---------------end loader.js-------------------------------------------------------------------------//
    
    
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();