/*document.body.style.scrollbarFaceColor="#8080FF";
document.body.style.scrollbarArrowColor="#8080FF";
document.body.style.scrollbarTrackColor="#8080FF";
document.body.style.scrollbarShadowColor="#8080FF";
document.body.style.scrollbarHighlightColor="#8080FF";
document.body.style.scrollbar3dlightColor="#8080FF";
document.body.style.scrollbarDarkshadowColor="#8080FF";
*/


/***********************************************
* Disable Text Selection script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function disableSelection(target){
if (typeof target.onselectstart!="undefined") //IE route
	target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
	target.style.MozUserSelect="none"
else //All other route (ie: Opera)
	target.onmousedown=function(){return true}
target.style.cursor = "default"
}


function EnableSelection(target) {
    if (typeof target.onselectstart != "undefined") //IE route
        target.onselectstart = function() { return true }
    else if (typeof target.style.MozUserSelect != "undefined") //Firefox route
        target.style.MozUserSelect = "all"
    else //All other route (ie: Opera)
        target.onmousedown = function() { return true }
    target.style.cursor = "default"
}

function checkIt(string) {
    var detect = navigator.userAgent.toLowerCase();
    place = detect.indexOf(string) + 1;
    thestring = string;

    return place;
}


function redirect(parmStr, win) {
    var path;
    path = 'http://www.theswingsite.com';
    path = 'http://localhost/theswingsite';
    top.window.location.href = path + parmStr;
    //window.open( path + parmStr, "DisplayWindow");
}

//checks all DataGrid CheckBoxes with the given name with the givenvalue
function CheckAllDataGridCheckBoxes(aspCheckBoxID, checkVal) {  //re = new RegExp(':' + aspCheckBoxID + '$')  //generated control name starts with a colon
    re = new RegExp(aspCheckBoxID + '$')
    for (i = 0; i < document.forms[0].elements.length; i++) {
        elm = document.forms[0].elements[i]
        if (elm.type == 'checkbox') {
            if (re.test(elm.name)) {

                elm.checked = checkVal

            }
        }
    }
}

function refreshFrame(hide) {
    if (parent.frames.length > 1)   //ONLY REFRESH IN FRAMES
    {
        var defaultrows = '114,86%,0,0';
        var hiddenrows = '76px,*,0,0';

        var theframe = parent.document.getElementById('framed');

        if (hide == 1) {
            if (screen.width < 1024) {
                parent.topFrame.document.location.href = 'headerbardiscreet-lowres.aspx'
            }
            else {
                parent.topFrame.document.location.href = 'headerbardiscreet.aspx'
            }
            theframe.rows = hiddenrows;

        }
        else {
            if (screen.width < 1024) {
                parent.topFrame.document.location.href = 'headerbar-lowres.aspx'
            }
            else {
                parent.topFrame.document.location.href = 'headerbar.aspx'
            }
            theframe.rows = defaultrows;
        }
        if (parent.bottomFrame.document != null) {
            parent.bottomFrame.document.location.href = 'BottomFrame.aspx';
            //alert('include restart1a');
        }
    }
}

function ImFrame(hide) {
    if (parent.frames.length > 1)   //ONLY REFRESH IN FRAMES
    {
        var defaultcols = '100%,*';
        var hiddencols = '80%,20%';

        parent.IMFrame.document.location.href = 'WhosIming.aspx';

        var theframe = parent.document.getElementById('framed');
        var theIM = parent.document.getElementById('IM');
        //alert('rows = ' + theIM.cols);


        if (hide == 1) {
            theIM.cols = hiddencols;
            if (parent.IMFrame.document.ChatBlazerIM) {

                //parent.IMFrame.document.ChatBlazerIM.width = 220;
                //parent.IMFrame.document.ChatBlazerIM.height = 360;
            }
        }
        else {
            theIM.cols = defaultcols;
            //parent.IMFrame.document.ChatBlazerIM.width = 1;
            //parent.IMFrame.document.ChatBlazerIM.height = 1;
        }
    }
}


function ImFrameWidth(hide) {
    if (parent.frames.length > 1)   //ONLY REFRESH IN FRAMES
    {
        var defaultcols = '80%,20%';
        var hiddencols = '60%,40%';

        parent.IMFrame.document.location.href = 'WhosIming.aspx';

        var theframe = parent.document.getElementById('framed');
        var theIM = parent.document.getElementById('IM');
        if (hide == 1) {
            theIM.cols = hiddencols;
        }
        else {
            theIM.cols = defaultcols;
        }
    }
}


function AnyInput_KeyDown(evt, target) {
    var keyCode =
               document.layers ? evt.which :
               document.all ? event.keyCode :
               document.getElementById ? evt.keyCode : 0;

    if (keyCode == 13) {
        __doPostBack(target, '');
        return false;
    }
    else {
        return true;
    }
}


function checkKP(e) {
    ns4 = (document.layers) ? true : false
    ie4 = (document.all) ? true : false
    var key;
    if (ie4)
        key = window.event.keyCode;
    else
        key = e.which;
    if (event.ctrlKey)
        if ((key == 65) || (key == 67) || (key == 97) || (key == 99))
        event.returnValue = false;
}

function NoRight(e) {
    if ((navigator.appName == 'Opera') && (e.which == 3 || e.which == 2 || e.which == 19)) {
        var targ
        if (!e) var e = window.event
        if (e.target) targ = e.target
        else if (e.srcElement) targ = e.srcElement
        if (targ.nodeType == 3) // defeat Safari bug
            targ = targ.parentNode
        var tname
        tname = targ.tagName;
        if (tname != "TEXTAREA" && tname != "INPUT")  {
            document.oncontextmenu = new Function("return false")
            return false;
        }
        else
            document.oncontextmenu = new Function("return true")
            return true;
    }
    if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2 || e.which == 19)) {
        if (e.target.tagName != "TEXTAREA" && e.target.tagName != "INPUT") {
            document.oncontextmenu = new Function("return false")
            return false;
        }
        else {
            document.oncontextmenu = new Function("return true")
            return true;
        }
    }
    else
        if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
        var targ
        if (!e) var e = window.event
        if (e.target) targ = e.target
        else if (e.srcElement) targ = e.srcElement
        if (targ.nodeType == 3) // defeat Safari bug
            targ = targ.parentNode;
        var tname;
        tname = targ.tagName;
        if (tname != "TEXTAREA" && tname != "INPUT") {
            document.oncontextmenu = new Function("return false")
            return false;
        }
        else {
            document.oncontextmenu = new Function("return true")
            return true;
        }
    }
}


function NoDrag(e) {
    return false;
}

try {
    //document.onkeydown = checkKP;   this is used for ctrl-c and other things
    document.ondrag = new Function("return false")
    document.ondragstart = new Function("return false")
    //document.onmousedown=new   Function("return false")
    document.onmouseup = NoRight;
    //document.oncontextmenu = new Function("return false")
    if (document.layers) window.captureEvents(Event.MOUSEDOWN);
    if (document.layers) window.captureEvents(Event.MOUSEUP);
}
catch (err) {
}



//function hidestatus() {
//    window.status = ''
//    return true
//}

if (document.layers)
    document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

//document.onmouseover = hidestatus
//document.onmouseout = hidestatus

//document.onmouseover = setTimeout("hidestatus", 300);
//document.onmouseout = setTimeout("hidestatus", 300);



function checkPopUps(msg) {
    try {
        var mine = window.open('', '', 'width=1,height=1,left=0,top=0,scrollbars=no');
        if (mine == null)
            alert(msg)
        else
            mine.close()
    }
    catch (e) { }

}


function goBack() {
    //window.opener.refreshwindow;
    if ((navigator.appName == 'Microsoft Internet Explorer') && (navigator.userAgent.indexOf("Opera") == (-1))) {
        history.go(-2);
    }
    else {
        history.go(-2);
    }
}

function goBackExtra(extra) {
    //window.opener.refreshwindow;
    if ((navigator.appName == 'Microsoft Internet Explorer') && (navigator.userAgent.indexOf("Opera") == (-1))) {
        history.go(-2 + extra);
    }
    else {
        history.go(-2 + extra);
    }
}

function goBackWMsg(extra, msg) {
    //window.opener.refreshwindow;
    if ((navigator.appName == 'Microsoft Internet Explorer') && (navigator.userAgent.indexOf("Opera") == (-1))) {
        history.go(-2 + extra);
    }
    else {
        history.go(-2 + extra);
    }
}




function openNewsFeed(UserToFollow) {
    var oWnd = $find("RadNewsPage");
    if (!UserToFollow)
        oWnd.setUrl('DialogNewsFeed.aspx');
    else
        oWnd.setUrl("DialogNewsFeed.aspx?UF=" + UserToFollow);

    oWnd.show();
    //var oWnd2 = window.radopen("DialogNewsFeed.aspx");    

    //var oWnd2 = parentRadWindowManager.open("DialogNewsFeed.aspx", "DialogPhotos");    
    //alert(oWnd2);
    //window.radopen("DialogNewsFeed.aspx");
}		
