/**
* SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
*/
var counter = 0;
if (typeof deconcept == "undefined") { var deconcept = new Object(); } if (typeof deconcept.util == "undefined") { deconcept.util = new Object(); } if (typeof deconcept.SWFObjectUtil == "undefined") { deconcept.SWFObjectUtil = new Object(); } deconcept.SWFObject = function(_1, id, w, h, _5, c, _7, _8, _9, _a) { if (!document.getElementById) { return; } this.DETECT_KEY = _a ? _a : "detectflash"; this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY); this.params = new Object(); this.variables = new Object(); this.attributes = new Array(); if (_1) { this.setAttribute("swf", _1); } if (id) { this.setAttribute("id", id); } if (w) { this.setAttribute("width", w); } if (h) { this.setAttribute("height", h); } if (_5) { this.setAttribute("version", new deconcept.PlayerVersion(_5.toString().split("."))); } this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion(); if (!window.opera && document.all && this.installedVer.major > 7) { deconcept.SWFObject.doPrepUnload = true; } if (c) { this.addParam("bgcolor", c); } var q = _7 ? _7 : "high"; this.addParam("quality", q); this.setAttribute("useExpressInstall", false); this.setAttribute("doExpressInstall", false); var _c = (_8) ? _8 : window.location; this.setAttribute("xiRedirectUrl", _c); this.setAttribute("redirectUrl", ""); if (_9) { this.setAttribute("redirectUrl", _9); } }; deconcept.SWFObject.prototype = { useExpressInstall: function(_d) { this.xiSWFPath = !_d ? "expressinstall.swf" : _d; this.setAttribute("useExpressInstall", true); }, setAttribute: function(_e, _f) { this.attributes[_e] = _f; }, getAttribute: function(_10) { return this.attributes[_10]; }, addParam: function(_11, _12) { this.params[_11] = _12; }, getParams: function() { return this.params; }, addVariable: function(_13, _14) { this.variables[_13] = _14; }, getVariable: function(_15) { return this.variables[_15]; }, getVariables: function() { return this.variables; }, getVariablePairs: function() { var _16 = new Array(); var key; var _18 = this.getVariables(); for (key in _18) { _16[_16.length] = key + "=" + _18[key]; } return _16; }, getSWFHTML: function() { var _19 = ""; if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "PlugIn"); this.setAttribute("swf", this.xiSWFPath); } _19 = "<embed type=\"application/x-shockwave-flash\" src=\"" + this.getAttribute("swf") + "\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\""; _19 += " id=\"" + this.getAttribute("id") + "\" name=\"" + this.getAttribute("id") + "\" "; var _1a = this.getParams(); for (var key in _1a) { _19 += [key] + "=\"" + _1a[key] + "\" "; } var _1c = this.getVariablePairs().join("&"); if (_1c.length > 0) { _19 += "flashvars=\"" + _1c + "\""; } _19 += "/>"; } else { if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "ActiveX"); this.setAttribute("swf", this.xiSWFPath); } _19 = "<object id=\"" + this.getAttribute("id") + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\">"; _19 += "<param name=\"movie\" value=\"" + this.getAttribute("swf") + "\" />"; var _1d = this.getParams(); for (var key in _1d) { _19 += "<param name=\"" + key + "\" value=\"" + _1d[key] + "\" />"; } var _1f = this.getVariablePairs().join("&"); if (_1f.length > 0) { _19 += "<param name=\"flashvars\" value=\"" + _1f + "\" />"; } _19 += "</object>"; } return _19; }, write: function(_20) { if (this.getAttribute("useExpressInstall")) { var _21 = new deconcept.PlayerVersion([6, 0, 65]); if (this.installedVer.versionIsValid(_21) && !this.installedVer.versionIsValid(this.getAttribute("version"))) { this.setAttribute("doExpressInstall", true); this.addVariable("MMredirectURL", escape(this.getAttribute("xiRedirectUrl"))); document.title = document.title.slice(0, 47) + " - Flash Player Installation"; this.addVariable("MMdoctitle", document.title); } } if (this.skipDetect || this.getAttribute("doExpressInstall") || this.installedVer.versionIsValid(this.getAttribute("version"))) { var n = (typeof _20 == "string") ? document.getElementById(_20) : _20; n.innerHTML = this.getSWFHTML(); return true; } else { if (this.getAttribute("redirectUrl") != "") { document.location.replace(this.getAttribute("redirectUrl")); } } return false; } }; deconcept.SWFObjectUtil.getPlayerVersion = function() { var _23 = new deconcept.PlayerVersion([0, 0, 0]); if (navigator.plugins && navigator.mimeTypes.length) { var x = navigator.plugins["Shockwave Flash"]; if (x && x.description) { _23 = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")); } } else { if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0) { var axo = 1; var _26 = 3; while (axo) { try { _26++; axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + _26); _23 = new deconcept.PlayerVersion([_26, 0, 0]); } catch (e) { axo = null; } } } else { try { var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); } catch (e) { try { var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); _23 = new deconcept.PlayerVersion([6, 0, 21]); axo.AllowScriptAccess = "always"; } catch (e) { if (_23.major == 6) { return _23; } } try { axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); } catch (e) { } } if (axo != null) { _23 = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(",")); } } } return _23; }; deconcept.PlayerVersion = function(_29) { this.major = _29[0] != null ? parseInt(_29[0]) : 0; this.minor = _29[1] != null ? parseInt(_29[1]) : 0; this.rev = _29[2] != null ? parseInt(_29[2]) : 0; }; deconcept.PlayerVersion.prototype.versionIsValid = function(fv) { if (this.major < fv.major) { return false; } if (this.major > fv.major) { return true; } if (this.minor < fv.minor) { return false; } if (this.minor > fv.minor) { return true; } if (this.rev < fv.rev) { return false; } return true; }; deconcept.util = { getRequestParameter: function(_2b) { var q = document.location.search || document.location.hash; if (_2b == null) { return q; } if (q) { var _2d = q.substring(1).split("&"); for (var i = 0; i < _2d.length; i++) { if (_2d[i].substring(0, _2d[i].indexOf("=")) == _2b) { return _2d[i].substring((_2d[i].indexOf("=") + 1)); } } } return ""; } }; deconcept.SWFObjectUtil.cleanupSWFs = function() { var _2f = document.getElementsByTagName("OBJECT"); for (var i = _2f.length - 1; i >= 0; i--) { _2f[i].style.display = "none"; for (var x in _2f[i]) { if (typeof _2f[i][x] == "function") { _2f[i][x] = function() { }; } } } }; if (deconcept.SWFObject.doPrepUnload) { if (!deconcept.unloadSet) { deconcept.SWFObjectUtil.prepUnload = function() { __flash_unloadHandler = function() { }; __flash_savedUnloadHandler = function() { }; window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs); }; window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload); deconcept.unloadSet = true; } } if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }; } var getQueryParamValue = deconcept.util.getRequestParameter; var FlashObject = deconcept.SWFObject; var SWFObject = deconcept.SWFObject;

//PopupMenu start
(function() {

    var UA = navigator.userAgent;
    is_gecko = /gecko/i.test(UA);
    is_opera = /opera/i.test(UA);
    is_mac = /mac_powerpc/i.test(UA);
    is_ie = /msie/i.test(UA) && !is_opera && !is_gecko && !is_mac;
    is_ie5 = is_ie && /msie 5\.[^5]/i.test(UA);
    is_nn4 = (document.layers) ? true : false;
})();
function getScrollTopValue() {
    var scrollYPos;
    if (typeof window.pageYOffset != 'undefined') {
        scrollYPos = window.pageYOffset;
    }
    else if (document.compatMode && document.compatMode != 'BackCompat') {
        scrollYPos = document.documentElement.scrollTop;
    }
    else {
        scrollYPos = document.body.scrollTop;
    }

    return scrollYPos;
}
function getScrollLeftValue() {
    var scrollXPos;
    if (typeof window.pageXOffset != 'undefined') {
        scrollXPos = window.pageXOffset;
    }
    else if (document.compatMode && document.compatMode != 'BackCompat') {
        scrollXPos = document.documentElement.scrollLeft;
    }
    else {
        scrollXPos = document.body.scrollLeft;
    }

    return scrollXPos;
}
//PopupMenu end

function IsSysInit() {
    return (typeof (Sys) !== 'undefined');
}

function insertSmiley(imageUrl, title, updateLen) {
    var html = '<img src="' + imageUrl + '" border="0" title="' + title + '" alt=""/>';
    if(IsSysInit()&&Sys.Browser.name=='Opera')html+='&nbsp;';
    if (tinyMCE) {
        tinyMCE.execCommand('mceInsertContent', false, html);
        if (updateLen) countLength();
    }
}

/* Set focus and click on the button defined by buttonID */
function clickButton( buttonID, uniqueID )
{
	var button = document.getElementById( buttonID );
    if ( button.click )
    {        
        button.focus();
        button.click();
    }
    else
    {        
        var script = "__doPostBack('" + uniqueID + "','')";
        eval( script );
    }
}

function doPopup(title, url, height, width)
{
	var _left = 0;
	var _top = 0;
	var _width = width;
	var _height = height;
	
    _left = (screen.width - width) / 2; 
    _top = (screen.height - height) / 2;
    
    _popupWindow = window.open(url,"","top="+_top+",left="+_left+",width="+_width+",height="+_height+",scrollbars=no"+",resizable=no"+",modal=yes");
	if (null != _popupWindow)
	{	   
	    _popupWindow.focus();
	}
	
	return false;
} 
function showPopup(url, name, left, top, width, height, scrollbars, resizable)
{
    if (name == null)
        name = '';
        
    if (left == null)
        left = (screen.width - width) / 2;
        
    if (top == null)
        top = (screen.height - height) / 2;
        
    if (width == null)
        width = (screen.width - width) / 2;
        
    if (height == null)
        height = (screen.height - height) / 2;
        
    if (scrollbars == null)
        scrollbars = 1;
    
    if (resizable == null)
        resizable = 1; 

    _popupWindow = window.open(url, name, "top="+top+",left="+left+",width="+width+",height="+height+",scrollbars="+scrollbars+",resizable="+resizable);
    _popupWindow.focus();
}
function __getY(element)
{
    var f = 0;
    while(element != null)
    {
        f += element.offsetTop;
        element = element.offsetParent;
    }
    return f;
}

function __getX(element)
{
    var f = 0;
    while(element != null)
    {
        f += element.offsetLeft;
        element = element.offsetParent;
    }
    return f;
}

function doPopupScroll(title, url, height, width)
{
	var _left = 0;
	var _top = 0;
	var _width = width;
	var _height = height;
	
    _left = (screen.width - width) / 2; 
    _top = (screen.height - height) / 2;
    
    _popupWindow = window.open(url,"","top="+_top+",left="+_left+",width="+_width+",height="+_height+",scrollbars=yes"+",resizable=1"+",modal=yes");
	if (null != _popupWindow)
	{	   
	    _popupWindow.focus();
	}
	
	return false;
}

function doNamedPopup(title, winname, url, height, width, scrolls)
{
	var _left = 0;
	var _top = 0;
	var _width = width;
	var _height = height;
	var _scrolls = scrolls;
	if (!_scrolls) 
	{	    
	    _scrolls = "yes";
	}
	
	_left = (screen.width - width) / 2; 
    _top = (screen.height - height) / 2;
    var _popupWindow = window.open(url, winname, "top=" + _top + ",left=" + _left + ",width=" + _width + ",height=" + _height + ",scrollbars=" + _scrolls + ",resizable=no" + ",modal=yes");
	
	if (null != _popupWindow)
	{	   
	    _popupWindow.focus();
	}	
	return _popupWindow;
} 

var _modalDialogReturnValue;

function doPopup2(title, controlUrl, height, width)
{
  var strHTML = ''
  strHTML = strHTML + '<html>';
  strHTML = strHTML + '  <head>';
  strHTML = strHTML + '    <title>' + title + '</title>';
  strHTML = strHTML + '    <script language="JavaScript" type="text/javascript" src="scripts/main.js"></script>';
  strHTML = strHTML + '  </head>';
  strHTML = strHTML + '  <body id="modalBody" name="modalBody" topmargin="0" marginwidth="0" marginheight="0" leftmargin="0" style="background-color: #FFFFCC;">';
  strHTML = strHTML + '    <iframe id="modalIFrame" name="modalIFrame" width="100%" height="100%" src="' + controlUrl + '" frameborder="0" scrolling="no"></iframe>';
  strHTML = strHTML + '  </body>';
  strHTML = strHTML + '</html>';

// Calculate coordinates of popup. -- center
  var x = window.screenX + ((window.outerWidth - width) / 2)
  var y = window.screenY + ((window.outerHeight - height) / 2)
  var flags = "scroll=no,modal=yes,screenX=" + x + ",screenY=" + y + ",resizable=yes,width=" + width + ",height=" + height;

//open the modal dialog
  w=window.open('', 'popupWin', flags);

//write the html content to the window
  w.document.open();
  w.document.write(strHTML);
  w.document.close();

  // Since this method of popup is non-blocking
  // this value is not used... -- see doClosePopup  
  return _modalDialogReturnValue;
 
};

// Method attached to buttons in modal dialog to close and set return values
function doClosePopup2(returnValue, targetElementID)
{
    self.close();
    return false;
}; 

function getElementValue(elementClientId)
{
    var elem = document.getElementById(elementClientId);
    return elem.value; 
}

function refreshParent(url,closeIt,delay)
{ 
	opener.location.href = url;
	if (closeIt == true)
	{	
		setTimeout('self.close()',delay);
	}
}

function SetUniqueRadioButton(nameregex, current)
{
   re = new RegExp(nameregex);
   for(i = 0; i < document.forms[0].elements.length; i++)
   {
      elm = document.forms[0].elements[i]
      if (elm.type == 'radio')
      {
         if (re.test(elm.name))
         {
            elm.checked = false;
         }
      }
   }
   current.checked = true;
}

function SetCheckBox(firstElementClientId, secondElementClientId) {
    elem1 = document.getElementById(firstElementClientId);
    elem2 = document.getElementById(secondElementClientId);
    if (null != elem1 && null != elem2)    
    {
        elem2.checked = elem1.checked;
    }
}

function SetAllCheckBoxes(nameregex,selectAllElem) {
   if (null != selectAllElem)
   {
       re = new RegExp(nameregex);
       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))
             {
               // if (elm != selectAllElem)
                {
                    elm.checked = selectAllElem.checked;
                }
             }
          }
       } 
   }
}


function FindFirstCheckBox(nameregex)
{
    re = new RegExp(nameregex);
    for(i = 0; i < document.forms[0].elements.length; i++)
    {        
        elm = document.forms[0].elements[i]
        if (elm.type == 'checkbox')
        {    
            if (re.test(elm.id) && elm.checked)
            {
                var hd = document.getElementById(elm.getAttribute('id') + 'Value');
                if (hd.value.length > 0)
                {
                    return hd.value;
                    break;
                }
            }
        } 
    }
    return 0;
}

function CheckBoxCheck(value) {
    for(i=0; i < document.forms[0].elements.length; i++)
    {
        elm = document.forms[0].elements[i]
        if (elm.type == 'checkbox')
        {
            elm.checked = false;
            AddCbValue(elm);
            if (elm.value == value)
            {
                if (!elm.checked)
                {
                    elm.checked = true;
                    AddCbValue(elm);
                }
                else
                {
                    elm.checked = false;
                    AddCbValue(elm);
                }
            }
        }
    }
}

function CheckBoxPageLoaded() {
    var isChecked = false;
    for (i = 0; i < document.forms[0].elements.length; i++)
    {
        elm = document.forms[0].elements[i]
        if (elm.type == 'checkbox')
        {
            if (elm.checked)
            {
                AddCbValue(elm);
                isChecked = true;
            }
        }
    }

    if (!isChecked) {
        counter = 0;
    }
}

function SynchronizeDropDownSelection(ddl1,ddl2)
	{	
		var elemDdl1 = document.getElementById(ddl1);
		var elemDdl2 = document.getElementById(ddl2);

		if (null != elemDdl1  && null != elemDdl2 )
		{
			elemDdl2.selectedIndex = elemDdl1.selectedIndex;		
			alert(elemDdl2.selectedIndex);
		}					
	}
	
///////AjaxExceptionHandler\\\\\\\
Sys.Application.add_load(AppLoad);

function AppLoad() {
if (IsSysInit())
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest); 
}
function EndRequest(sender, args){
  // Check to see if there's an error on this request.
  if (args.get_error != 'undefined')
  {
		// Let the framework know that the error is handled, 
		//  so it doesn't throw the JavaScript alert.
		args.set_errorHandled(true);
  }
}

/////Alerts\\\\\

// Method 1 - titlebar text
var titleSwitchCount = 0;
var titleSwitchLimit = 0;
var titleOriginalText = document.title;
var titleText;
var titleDelay = 500;
var runBlinking = false;

function blinkstop()
{
	titleBlinkLimit = 0;
	titleBlinkLimit = titleBlinkCount;
}


function titlebarTextAlert() {
// Failsafe
if( titleSwitchCount) return;

titlebarSwitch();
}

function titlebarSwitch() {

if( document.title == titleOriginalText) {
// New message text
document.title = titleText;
titleSwitchCount++;

} else {
// Original text
document.title = titleOriginalText;
if (0 == titleSwitchLimit) titleSwitchCount = 1;
else if( titleSwitchCount == titleSwitchLimit) titleSwitchCount = 0;
}

// If count is 0 then we must have just reset it
if( titleSwitchCount) setTimeout( "titlebarSwitch();", titleDelay);
}

// Method 1.5 - Another titlebar alert
var title2Text = titleText +" - ";
var titleAppearCount = 0;
var titleBlinkCount = 0;
var titleBlinkLimit = -1; // -1 - if internal 
var titleBlinkDelay = 500;
var title2OriginalText;

function titlebar2(txt) {
reset();
title2Text = txt +" - ";
titleBlinkLimit = -1; // -1 - if internal 


setTimeout( "runBlinking = true;titleAppear();", 3000);

}

function titleAppear() {
if( titleAppearCount!= title2Text.length) {
// Add next character...
document.title = title2Text.charAt( title2Text.length -(++titleAppearCount)) +document.title;
setTimeout( "titleAppear();", 25);

} else {
// Reset and move on to blinking
titleAppearCount = 0;
title2OriginalText = document.title;
titleBlink();
}
}

function titleBlink() {

if (runBlinking == false) return;

// If has new message in title...
if( document.title == title2OriginalText) {
// Put old title back
document.title = titleOriginalText;
if (titleBlinkLimit == -1) titleBlinkCount++;

} else {
// Put message back again
document.title = title2OriginalText;

if( titleBlinkCount == titleBlinkLimit ) {
titleBlinkCount = 0;
titleDisappear();

}
}

if( titleBlinkCount) setTimeout( "titleBlink();", titleBlinkDelay);
}

function titleDisappear() {
if( titleAppearCount!= title2Text.length) {
// 'Remove' characters
var len = title2Text.length -(++titleAppearCount);
var str = title2Text.substr( titleAppearCount, len);

document.title = str +titleOriginalText;
setTimeout( "titleDisappear();", 100);

} else {
titleAppearCount = 0;
runBlinking = false;
}

}

// Method 2 - Popup window
// Note, using height to 'move' box - this avoids a scrollbar!
var posDist;
var posNow = 0;
var popupRunning;

function popupAlert(txt) {

var elem = document.getElementById("alertText");
if (elem)
{
	elem.innerHTML = txt;
}

// Failsafe
if( popupRunning) return;
popupRunning = true;

var div = document.getElementById("alertPopup");

// Set start position
div.style.display = "block";
posDist = div.offsetHeight;
div.style.height = "0px";
div.style.overflow = "hidden";

// Start appear....
popupUp();
}

function popupUp() {
var div = document.getElementById("alertPopup");

// How far to go?
var dist = posDist -posNow;

if( dist >1) {
// Move up a bit
posNow += Math.ceil( dist /8);
div.style.height = posNow +"px";

setTimeout( "popupUp();", 25);

} else {
// We've arrived, delay for 1.5 secs then vanish
div.style.height = posDist;
setTimeout( "popupDown();", 3000);
}
}

function popupDown() {
var div = document.getElementById("alertPopup");

// How far to go?
var dist = posNow;

if( dist >1) {
// Move down a bit
posNow -= Math.ceil( dist /8);
div.style.height = posNow +"px";

setTimeout( "popupDown();", 20);

} else {
// Done, reset the box
div.style.height = posDist +"px";
div.style.display = "none";
popupRunning = false;
}
}

function reset()
{
title2Text = "";
document.title = titleOriginalText;
runBlinking = false;
titleBlinkCount = 0;
titleAppearCount = 0;
}

//Check if the browser is IE and supports ActiveX
function isIESupport(objName) {
    var isSupport = true;
    if (Sys.Browser.agent == Sys.Browser.InternetExplorer) {
        if (Sys.Browser.version <= 6) {
            if (window.ActiveXObject) {
                try {
                    var xmlhttp = new ActiveXObject(objName); return xmlhttp;
                }
                catch (e1) {
                    isSupport = false;
                }
            }
        }
    }
    return isSupport;
}
//////CollectValues\\\\\\
function CollectCheckBoxValuesInto(el, tbName, tbButton1, tbButton2, tbButton3, elFrom, elTo) {
    var tb = document.getElementById(tbName);
    if (tb != null) {
        var ar = new Array();
        ar = tb.value.split(',');
        var v = el.value;
        var c = -1;
        for (var i = 0; i < ar.length; i++) {
            if (ar[i] == v) {
                c = i;
            }
        }
        if (el.checked) {
            if (c == -1) {
                ar.push(v);
                counter = counter + 1;
            }
            if (ar[0] == '') {
                ar.splice(0, 1);
            }
        } else {
            if (c > -1) {
                ar.splice(c, 1);
                counter = counter - 1;
            }
        }
        var btn1 = document.getElementById(tbButton1);
        var btn2 = document.getElementById(tbButton2);
        var btn3 = document.getElementById(tbButton3);
        
        if (btn1 != null) 
            btn1.disabled = (btn1 != null && counter != 1) ? true : false;

        if (btn2 != null) 
            btn2.disabled = (btn2 != null && counter != 1) ? true : false;

        if (btn3 != null)
            btn3.disabled = (btn3 != null && counter < 1) ? true : false;
        
        tb.value = ar.toString();
    }
}

function PassThroughtClick ( userid, photoid,showcomments, storefieldid, buttonid)
{   
    var sf = document.getElementById(storefieldid);
    sf.value = userid + "&" + photoid + "&" + showcomments;
    __doPostBack(buttonid, '');
}

function submitForm(ev)
{
    ev||(ev=window.event);
    if(ev && ev.keyCode == 13 && (ev.altKey || ev.ctrlKey))
    {
      eval(__doPostBack('ctl00$cphMain$ctrSendMessage$btnSend',''));
      return false;
    }
}
function txtGoto_OnKeyPress(sender, e, buttonId)
{
    var keycode = (e.which) ? e.which : e.keyCode;
    if (keycode == 13)
    {
        var lnkJump = document.getElementById(buttonId);
        if (lnkJump) eval(lnkJump.href);
    }
}
function txtGoto_filter(sender, e, pageCount)
{
    var keycode = (e.which) ? e.which : e.keyCode;
    if (keycode == 13)
    {    
        if (sender.value > pageCount) sender.value = pageCount;
        if (sender.value < 1) sender.value = 1;   
        
        return false;
    }
           
    if (!(  ((!(keycode < 47)) && (!(keycode > 57))) || (((keycode == 46) || (keycode == 8) || (keycode == 37) || (keycode == 39)) && (sender.value.indexOf('.') < 0))  ))
        return false;
    
    return true;
}


function onDivUserPhoto(e, visible, uid) {
    if (visible)
    {
        var coors = findMousePos(e);
        document.getElementById('divUserPhoto').style.visibility = 'visible';
        document.getElementById('divUserPhoto').style.top = coors[1] + 15 + 'px';
        document.getElementById('divUserPhoto').style.left = coors[0] + 'px';
        document.getElementById('divImgUserPhoto').src = 'Image.ashx?Id=' + uid + '.&ImageType=1&ImageDim=1&Chat=1';
    }
    else
    {
        setTimeout("document.getElementById('divUserPhoto').style.visibility = 'hidden'", 3000);
    }  
} 



function findMousePos(e) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}

	return [posx,posy]
}

function MozillaInsertText(element, text, pos) 
{
    element.value = element.value.slice(0,pos)+text+element.value.slice(pos);
}

function AddTag(textboxelement,t1,t2)
{
    var agt=navigator.userAgent.toLowerCase();
    var is_major = parseInt(navigator.appVersion);
    // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
    // If you want to allow spoofing, take out the tests for opera and webtv.
    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
			    && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
		    	&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));

    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );

    var is_nav4up = (is_nav && (is_major >= 4));
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);

	if (is_ie5up)
	{
		if (document.selection)
		{
			textboxelement.focus();

			var txt = textboxelement.value;
			var str = document.selection.createRange();

			if (str.text == "")
			{
					str.text = t1 + t2;
			}
			else if (txt.indexOf(str.text) >= 0)
			{
			str.text = t1 + str.text + t2;
			}
			else
			{
				textboxelement.value = txt + t1 + t2;
			}
			str.select();
		}
	}
	else if (is_nav4up)
	{
		var element = textboxelement;
		var sel_start = element.selectionStart;
		var sel_end = element.selectionEnd;
		MozillaInsertText(element, t1, sel_start);
		MozillaInsertText(element, t2, sel_end+t1.length);
		element.selectionStart = sel_start;
		element.selectionEnd = sel_end+t1.length+t2.length;
		element.focus();    
	}    
	else
	{
		textboxelement.value = textboxelement.value + t1 + t2;
	}
}

function getFlash() {
    var my_msie = (navigator.appName.toLowerCase().substring(0,2) == "mi") ? 1 : 0;
    var my_flash;

    if (navigator.plugins && navigator.plugins.length) {
        for (var i=0; i<navigator.plugins.length; i++) {
            if (navigator.plugins[i].name.indexOf('Shockwave Flash') >= 0) {
                my_flash = parseFloat(navigator.plugins[i].description.split('Shockwave Flash ')[1]);
                break;
            }
        }
    }
    else if (window.ActiveXObject) {
        for (var i=10; i>=2; i--) {
            try {
                var f=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+i+"');");
                if (f) {
                    my_flash = i+'.0';
                    break;
                }
            }
        catch(e) {}
        }
        
        if (my_flash == "" && my_msie &&
        (navigator.appVersion.indexOf("MSIE 5") >= 0 || navigator.appVersion.indexOf("MSIE 6") >= 0)) {
            if (clientInformation.appMinorVersion.indexOf('SP2') >= 0) my_flash = '>';
        }
    }
    return my_flash;
}

function getGMT()
{
    var my_winterOffset = (new Date(2000, 01, 01)).getTimezoneOffset();
    var my_summerOffset = (new Date(2000, 07, 01)).getTimezoneOffset();
    var my_nowOffset = (new Date()).getTimezoneOffset();
    var my_gmt = -my_nowOffset / 60;
    if (my_nowOffset == my_summerOffset && my_nowOffset != my_winterOffset) my_gmt--;
    return my_gmt;
}

