/* // 2007-02-12 // Copyright (c) Art. Lebedev | http://www.artlebedev.ru/ // Author - Vladimir Tokmakov */ function cmnInformation(){ this.sUser_agent = navigator.userAgent.toLowerCase(); this.bIE = ( ( this.sUser_agent.indexOf("msie") != -1 ) && ( this.sUser_agent.indexOf("opera") == -1 ) ); this.bOpera = ( this.sUser_agent.indexOf("opera") != -1 ); if( this.bOpera ){ cmnSet_class( document.getElementsByTagName( 'html' )[0], 'Opera' ); } this.bMAC = ( this.sUser_agent.indexOf("mac") != -1 ); this.bGecko = ( navigator.product == "Gecko" ); this.bMozilla = this.bGecko; this.sLanguage = null; this.bHTTP = null; return this; } function cmnPlaceholder( eThis, sText, sClass_on_empty ){ eThis.onfocus = function(){ if( eThis.value.length && eThis.value == sText ){ eThis.value = ''; } cmnRemove_class( this, sClass_on_empty ); eThis.select(); } eThis.onblur = function(){ if( !this.value.length ){ cmnSet_class( this, sClass_on_empty ); this.value = sText; } } if( !eThis.value.length ){ eThis.onblur(); } if( !eThis.getAttribute( 'placeholder' ) ){ eThis.setAttribute( 'placeholder', sText ); } } var cmn_aPopup_defaults = [ ["width", 540], ["height", 600], ["menubar", "no"], ["toolbar", "no"], ["resizable", "yes"], ["scrollbars", "yes"], ["status", "yes"] ] var cmn_aPopup = new Array(); function cmnPopup( sURL, sName, sFeatures, bReplace ){ if( !sURL.length ){ if( sURL && sURL.tagName.toLowerCase() == "a" ){ if( !sName ){ sName = ( sURL.id ) ? sURL.id : "_blank"; } sURL = sURL.href; }else{ return false; } }else if( !sName ){ sName = "_blank"; } for( var i = 0 ; i < cmn_aPopup_defaults.length ; i++ ){ if( !cmnPairs_string_get_value( sFeatures, cmn_aPopup_defaults[i][0], "=", "," ) ){ sFeatures = cmnPairs_string_set_value( sFeatures, cmn_aPopup_defaults[i][0], cmn_aPopup_defaults[i][1], "=", "," ); } } var iWidth = cmnPairs_string_get_value( sFeatures, "width", "=", "," ); var iHeight = cmnPairs_string_get_value( sFeatures, "height", "=", "," ); if( screen ){ var iScreen_height = screen.height ? screen.height - 100 : 0; var iScreen_width = screen.width ? screen.width - 100 : 0; var bScroll = false; if( iScreen_height < iHeight ){ bScroll = true; iHeight = iScreen_height; sFeatures = cmnPairs_string_set_value( sFeatures, "height", iHeight, "=", "," ); } if( iScreen_width < iWidth ){ bScroll = true; iWidth = iScreen_width; sFeatures = cmnPairs_string_set_value( sFeatures, "width", iWidth, "=", "," ); } if( bScroll ) { sFeatures = cmnPairs_string_set_value( sFeatures, "scrollbars", "yes", "=", "," ); } sFeatures = cmnPairs_string_set_value( sFeatures, "top", Math.round( ( iScreen_height - iHeight ) / 2 ), "=", "," ); sFeatures = cmnPairs_string_set_value( sFeatures, "left", Math.round( ( iScreen_width - iWidth ) / 2 ), "=", "," ); } if( sURL.match(/\.(gif|jpe?g|png)$/i) ){ cmn_aPopup[sName] = window.open( "", sName, sFeatures ); if( cmn_aPopup[sName] ){ var sTitle = unescape( cmnPairs_string_get_value( sFeatures, "title", "=", "," ) ); sTitle = sTitle.replace( /<\/?\w[^>]*>/g, " " ).replace( /