﻿// JScript File

window.onload=function(){
  var lnk = document.links;
  for(var i=0;i<lnk.length;i++){
    lnk[i].onclick = function(){this.blur()};
  }
}


//===========================================
// My Journal
//===========================================


var potMyJournalPath = '/site/web/user/myjournal/'

function potMyJournalShow() {
    ajaxgetdata(potMyJournalPath + 'ajax_show.cnx?show=all', '', 'potJournalContOut','potJournalContOut', 1)
}

//===========================================
// Friends Section
//===========================================

function potFriendRequest(fx_id) {
    ajaxgetdata('/site/web/friends/ajax_requestfriend.cnx?friendrequest=add&fx_id=' + fx_id, '', 'potFriendArea'+ fx_id, 'potFriendArea'+ fx_id, 1)    
}
function potFriendApproveRequest(fx_id) {
    ajaxgetdata('/site/web/friends/ajax_requestfriend.cnx?friendapprove=add&fx_id=' + fx_id, '', 'potFriendArea'+ fx_id, 'potFriendArea'+ fx_id, 1)    
}
function potFriendDenyRequest(fx_id) {
    ajaxgetdata('/site/web/friends/ajax_requestfriend.cnx?frienddeny=add&fx_id=' + fx_id, '', 'potFriendArea'+ fx_id, 'potFriendArea'+ fx_id, 1)    
}

//===========================================
// Menu
//===========================================


var mmen_cur;
var mmen_curitem = '';
var mmen_stillshow = 0;
var mmen_curitemt = ''

function mmenover(fx_men) {
    if (mmen_curitemt!='') {
        mmenhide(mmen_curitemt);
    }        
    mmen_curitemt = fx_men;
    clearTimeout(mmen_cur);
    mmen_stillshow = 1;
    mmen_curitem = document.getElementById('mainhov_' + fx_men)    
    mmen_cur = setTimeout('mmenshow(\'' + fx_men + '\') ', 50);
}

function mmenshow(fx_men) {
    if (mmen_stillshow==1) {            
        mmen_curitem.className='sc_men';           
    }        
}

function mmenout(fx_men) {  
    clearTimeout(mmen_cur); 
    mmen_cur = setTimeout('mmenhide(\'' + fx_men + '\') ', 200);       
}

function mmenhide(fx_men) {  
    clearTimeout(mmen_cur);
    if (mmen_curitem!=null) {
        mmen_curitem.className='sc_out';           
    }        
    mmen_stillshow = 0;
}

function mmenhovto() {
    clearTimeout(mmen_cur);
}

function mmenclearcur() {
    mmenout(mmen_curitemt);
}

function p3VidCatPlayItGo(fx_title) {

    var so = new SWFObject('/site/web/video/player/Mgplayer5.swf', 'Test', '330', '272', '8', '#ffffff');
    so.addVariable('flvPath', '/site/web/video/player/p3-bike.flv');
    so.addVariable('flvTitle', '  ' + fx_title);
    so.write('p3VideoPlayItPlayerCont');
    
}

var potSessionTimeoutWarning = 1000 * 60 * 30
var potTimeoutForce

function potAskTimeout() {
    //potTimeoutForce = setTimeout('top.location=\'/index.htm?logout=true\'', 5000)
    if (confirm('Your sesssion is about to Timeout. Click OK to continue your session or Cancel to sign-out immediately.')) {
        ajaxgetdata('/site/content/keepalive.cnx?show=all', '', 'cnxrec','cnxrec', 1);
        setTimeout('potAskTimeout()', potSessionTimeoutWarning);
        //potTimeoutForce.clear();
    } else {
        top.location='/index.htm?logout=true'
    }
}





