var CookieDomain = ".voxengo.com";
var CookiePath = "/";
var wincCurrentTextarea = 0;
var tab_groups = [];
var tab_bars = [];
var xmlhttp = false;
var xmlhttp_preview = null;
var xmlhttp_preview_outer = null;
function popup( url, name, width, height )
{width = width ? width : 400;
height = height ? height : 500;
window.open( url, name, "top=0,left=0,location=0,scrollbars=1,toolbar=0," +
"menubar=0,statusbar=0,resizable=1,width=" + width + ",height=" + height );}
function popup_centered( url, name, width, height )
{width = width ? width : 400;
height = height ? height : 500;
var left = Math.round(( window.screen.width - width ) / 2 );
var top = Math.round(( window.screen.height - height ) / 2 );
window.open( url, name, "top=" + top + ",left=" + left +
",location=0,scrollbars=1,toolbar=0,menubar=0,statusbar=0,resizable=1," +
"width=" + width + ",height=" + height );}
function get_by_id( id )
{return( document.getElementById ? document.getElementById( id ) :
document.all ? document.all[ id ] : 0 );}
function get_by_id_from_opener( id )
{return( opener.document.getElementById ?
opener.document.getElementById( id ) :
opener.document.all ? opener.document.all[ id ] : 0 );}
function find_className( htElement, find_class )
{var classes = htElement.className.split( " " );
for( var i = 0; i < classes.length; i++ )
{if( classes[ i ] == find_class )
{return( true );}}
return( false );}
function add_className( htElement, add_class )
{var classes = htElement.className.split( " " );
for( var i = 0; i < classes.length; i++ )
{if( classes[ i ] == add_class )
{return;}}
classes.push( add_class );
htElement.className = classes.join( " " );}
function remove_className( htElement, remove_class )
{var classes = htElement.className.split( " " );
var new_classes = [];
var found = false;
for( var i = 0; i < classes.length; i++ )
{if( classes[ i ] != remove_class )
{new_classes.push( classes[ i ]);}
else
{found = true;}}
if( !found )
{return;}
htElement.className = new_classes.join( " " );}
function get_cookie( name )
{if( document.cookie.length > 0 )
{var c_start = document.cookie.indexOf( name + "=" );
if( c_start != -1 )
{c_start = c_start + name.length + 1;
var c_end = document.cookie.indexOf( ";", c_start );
if( c_end == -1 )
{c_end = document.cookie.length;}
return( unescape( document.cookie.substring( c_start, c_end )));}}
return( "" );};
function set_cookie( name, value )
{var ExpireDate = new Date();
ExpireDate.setDate( ExpireDate.getDate() + 3000 );
document.cookie = name + "=" + escape( value ) + ";path=" + CookiePath +
";domain=" + CookieDomain + ";expires=" + ExpireDate.toGMTString();}
function make_visible( id, display_class )
{var htElement = get_by_id( id );
if( !htElement )
{return( false );}
htElement.style.display = ( display_class == null ? 'block' : display_class );
return( id );}
function make_invisible( id )
{var htElement = get_by_id( id );
if( !htElement )
{return( false );}
htElement.style.display = 'none';
return( id );}
function toggle_visibility( id )
{var htElement = get_by_id( id );
if( !htElement )
{return( false );}
if( htElement.style.display == 'none' )
{htElement.style.display = 'block';}
else
{htElement.style.display = 'none';}
return( id );}
function open_tab( tab, group, target_id )
{if( !tab )
{return;}
if( tab_bars[ group ])
{remove_className( tab_bars[ group ], "tab_active" );}
add_className( tab, "tab_active" );
toggle_visibility( tab_groups[ group ]);
tab_bars[ group ] = tab;
tab_groups[ group ] = toggle_visibility( target_id );}
function wrap_textarea_selection( open_tag, close_tag )
{if( !wincCurrentTextarea )
{return;}
var inserted = 0;
if( document.selection )
{var sel = document.selection.createRange();
if( sel.text.length > 0 )
{sel.text = open_tag + sel.text + close_tag;
document.selection.empty();
inserted = 1;}}
else
{if( typeof( wincCurrentTextarea.selectionStart ) != "undefined" )
{var sel_start = wincCurrentTextarea.selectionStart;
var sel_end = wincCurrentTextarea.selectionEnd;
var sel_length = wincCurrentTextarea.textLength;
wincCurrentTextarea.value =
wincCurrentTextarea.value.substring( 0, sel_start ) + open_tag +
wincCurrentTextarea.value.substring( sel_start, sel_end ) + close_tag +
wincCurrentTextarea.value.substring( sel_end, sel_length );
wincCurrentTextarea.selectionStart = sel_start + open_tag.length;
wincCurrentTextarea.selectionEnd = sel_start + open_tag.length;
inserted = 1;}}
if( !inserted )
{wincCurrentTextarea.value += open_tag + close_tag;}
wincCurrentTextarea.focus();}
function preview_comment( id, baseurl, preview_target, preview_outer, str_wait,
par_context )
{var htElement = get_by_id( id );
if( !htElement )
{return;}
var text = escape( htElement.value );
text = text.replace( /\+/g, "%2B" );
if( xmlhttp )
{delete xmlhttp;}
xmlhttp = false;
if( window.XMLHttpRequest )
{xmlhttp = new XMLHttpRequest();}
else
{if( window.ActiveXObject && !window.opera )
{xmlhttp = new ActiveXObject( "msxml2.XMLHTTP" );}}
if( xmlhttp )
{xmlhttp_preview = get_by_id( preview_target );
xmlhttp_preview_outer = get_by_id( preview_outer );
xmlhttp_preview.innerHTML = str_wait;
xmlhttp.onreadystatechange = function()
{if( xmlhttp.readyState == 4 && xmlhttp.status == 200 )
{xmlhttp_preview.innerHTML = xmlhttp.responseText;
xmlhttp_preview_outer.style.display = 'block';}};
xmlhttp.open( 'POST', baseurl, true );
xmlhttp.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8' );
xmlhttp.send( 'text=' + text + '&context= ' + escape( par_context ));}
else
{popup( baseurl + "&text=" + text + '&context=' + escape( par_context ),
'preview', 500, 300 );}}
function apply_selected_id( selectId, par_text, par_value )
{var htText = get_by_id_from_opener( selectId + '_text' );
var htValue = get_by_id_from_opener( selectId + '_value' );
if( !htText || !htValue )
{return;}
var t = par_text.replace( /\</g, "&lt;" );
t = t.replace( /\>/g, "&gt;" );
t = t.replace( /\"/g, "&quot;" );
htText.innerHTML = t;
htValue.value = par_value;
window.close();}
function is_input_email( id )
{var htElement = get_by_id( id );
if( !htElement )
{return( true );}
var email = htElement.value;
if( email != email.replace(
/([^0-9a-zA-Z\@\.\-\_])|(\.$)|(^\.)|(\@\.)|(\.\@)/g, "" ) ||
!email.match( /[^\@]+\@[^\@]+\.[^\@]+/ ))
{htElement.focus();
return( true );}
else
{return( false );}}
function is_input_empty( id )
{var htElement = get_by_id( id );
if( !htElement )
{return( true );}
if( htElement.value === "" )
{htElement.focus();
return( true );}
else
{return( false );}}
function is_input_too_long( id, max_length )
{var htElement = get_by_id( id );
if( !htElement )
{return( true );}
if( htElement.value.length > max_length )
{htElement.focus();
return( true );}
else
{return( false );}}
function is_input_too_short( id, min_length )
{var htElement = get_by_id( id );
if( !htElement )
{return( true );}
if( htElement.value.length < min_length )
{htElement.focus();
return( true );}
else
{return( false );}}
function request_ajax( id, url, pleaseWaitText )
{var htElement = get_by_id( id );
if( !htElement )
{return( false );}
var xmlhttp = null;
try
{xmlhttp = new ActiveXObject( "Msxml2.XMLHTTP" );}
catch( e )
{try
{xmlhttp = new ActiveXObject( "Microsoft.XMLHTTP" );}
catch( e2 )
{xmlhttp = null;}}
if( xmlhttp == null && typeof XMLHttpRequest != "undefined" )
{xmlhttp = new XMLHttpRequest();}
if( xmlhttp == null )
{return( false );}
htElement.innerHTML = pleaseWaitText;
xmlhttp.onreadystatechange = function()
{if( xmlhttp.readyState == 4 && xmlhttp.status == 200 )
{htElement.innerHTML = xmlhttp.responseText;}};
try
{xmlhttp.open( 'GET', url, true );
xmlhttp.send( null );}
catch( e )
{return( false );}
return( true );};
function mark_for_later_dl( id )
{var dlmarks = get_cookie( "dlmarks" ).split( "," );
dlmarks[ dlmarks.length ] = id;
set_cookie( "dlmarks", dlmarks.join( "," ));
make_invisible( "idMarkDLButton" + id );
make_visible( "idMarkedDL" + id, "inline" );};
function show_admhint( hint )
{var htElement = get_by_id( 'idAdminHint' );
if( !htElement )
{return;}
var hintStr = hint.replace( /\\\'\\\'/g, '"' );
htElement.innerHTML = '<div class="readable a_hint">' +
'<div>' + hintStr + '</div>' +
'<div><br /></div>' +
'<div class="a_right">' +
'<a href="javascript:;" onclick="hide_admhint(); return false;">Close Hint</a>' +
'</div>' +
'</div>' +
'<div><br /></div>';};
function hide_admhint()
{var htElement = get_by_id( 'idAdminHint' );
if( !htElement )
{return;}
htElement.innerHTML = '';}
function get_hint()
{var el = get_by_id( "JSHint" );
if( !el )
{var el = document.createElement( "div" );
el.setAttribute( "id", "JSHint" );
document.body.appendChild( el );
el.style.display = "none";
el.style.position = "absolute";
el.style.top = "0";
el.style.left = "0";}
return( el );};
function show_hint( obj, text )
{var el = get_hint();
if( el )
{var x = 0;
var y = 15;
var cur = obj;
while( true )
{x += cur.offsetLeft;
y += cur.offsetTop;
cur = cur.offsetParent;
if( !cur )
{break;}}
var text2 = text;
el.innerHTML = text2.replace( /``/g, '"' );
el.style.left = x + "px";
el.style.top = y + "px";
el.style.visibility = "hidden";
el.style.display = "block";
if( x - el.offsetWidth < 100 )
{x += 30;}
else
{x -= el.offsetWidth + 1;}
el.style.left = x + "px";
el.style.visibility = "visible";}};
function hide_hint()
{var el = get_hint();
if( el )
{el.style.display = "none";}};
var CurDate = new Date();
set_cookie( "TimeShift", CurDate.getTimezoneOffset() );
