//////////////////////////////////////////////////////////////////////////////// // // // (C) ALL RIGHTS RESERVED. // // // // Filename: MAIN.JS // // // // Function: Nexuz Computing website, JScript I/O implementions. // // // //////////////////////////////////////////////////////////////////////////////// var g_oNavMenu = null; var g_oPrevNavMenu = null; var g_oPrevDropMenu = null; var g_iDropMenuMax = 5; var g_iCategoryMax = 4; var g_iItemMax = 4; var g_oSubMenu = null; var g_oPrevSubMenu = null; // ...top cCollapseMenu BG BAR color. var g_szColorTitleStaticBG = '#fff'; // ...top cCollapseMenu BG BAR focus color. var g_szColorTitleBG = '#f00'; // ...top cCollapseMenu text color after focus. var g_szColorTitleTextFocusLeft = '#000'; // ...top cCollapseMenu text color. var g_szColorTitleTextFocus = '#fff'; var g_bIE = false; //var g_szURL = "http://127.0.0.1/"; var g_szURL = "http://www.nexuz.homeip.net/"; var g_szDLL = "engine/register.dll"; var g_bGeoInit = false; /*============================================================================*/ if( navigator.appName.indexOf('Microsoft Internet Explorer') != -1 ) { g_bIE = true; } window.onload = OnInit; window.onerror = OnError; /* window.onmousedown = OnMouseRightClick; window.onmouseup = OnMouseRightClick; document.onmousedown = OnMouseRightClick; document.onmouseup = OnMouseRightClick; if (document.layers) window.captureEvents(Event.MOUSEDOWN); if (document.layers) window.captureEvents(Event.MOUSEUP); */ /*============================================================================*/ function OnAlert (o) { window.alert(o); } /*============================================================================*/ function OnDelay () { } window.setTimeout("OnDelay()", 2000); /*============================================================================*/ function OnError () { return true; } /*============================================================================*/ function OnInit() { OnWaitOpen(); OnDropMenuInit(); OnCategoryInit(); OnRegisterPostTest(); OnWaitClose(); } /*============================================================================*/ function OnDropMenuHide () { document.onclick = null; if( g_oPrevDropMenu ) { g_oPrevDropMenu.style.visibility = 'hidden'; g_oPrevDropMenu = null; g_oPrevNavMenu.style.color = g_szColorTitleTextFocusLeft; g_oPrevNavMenu.style.backgroundColor = g_szColorTitleStaticBG; } g_oNavMenu = null; OnCategoryHide(); } /*============================================================================*/ function OnDropMenuInit () { document.onclick = OnDropMenuHide; for( n=1; n<=g_iDropMenuMax; n++ ) { szDrop = 'idDropMenu' + n; szNavigate = 'idNavMenu' + n; oDropMenu = document.getElementById( szDrop ); oDropMenu.style.visibility = 'hidden'; g_oNavMenu = document.getElementById( szNavigate ); g_oNavMenu.onmouseover = OnDropMenuShow; g_oNavMenu.onmouseout = OnDropMenuOut; g_oNavMenu.onclick = OnDropMenuShow; } g_oNavMenu = null; OnFetchURL("idContent", "news.html"); OnObjectImageMove("idCompanyLogo", 7, 10); OnObjectImageMove("idYoutubeLogo", 830, 65); OnObjectImageMove("idFacebookLogo", 864, 65); OnObjectTextMove("idCompanyLogoStaticText1", "company_logo_static_text_1.html", 90, 23); OnObjectTextMove("idCompanyLogoStaticText2", "company_logo_static_text_2.html", 90, 35); OnObjectTextScrollVert("idCompanyHeadline", "broadcaster.html"); } /*============================================================================*/ function OnDropMenuOut (e) { document.onclick = OnDropMenuHide; // // this.id...idNavMenu1 to idNavMenu3 when drop-down cCollapseMenu // switch to each other. // // The name of drop-down cCollapseMenu the mouse // just left. // oNavMenu = document.getElementById( this.id ); if( oNavMenu != g_oNavMenu ) { oNavMenu.style.color = g_szColorTitleTextFocusLeft; oNavMenu.style.backgroundColor = g_szColorTitleStaticBG; } } /*============================================================================*/ function OnDropMenuShow (e) { // // this.id..."idNavMenu?", when drop-down cCollapseMenu switching. // szDropMenuName = 'idDrop' + this.id.substring(5, this.id.length); // // szDropMenuName..."idDropMenu?" // oDropMenu = document.getElementById( szDropMenuName ); OnDropMenuHide(); if( g_oPrevDropMenu == oDropMenu ) return; // // this.id..."idNavMenu?", when drop-down cCollapseMenu switching. // g_oNavMenu = document.getElementById( this.id ); // // eg: // // g_oPrevNavMenu..."idNavMenu?" // // g_oPrevDropMenu..."idDropMenu?" // g_oNavMenu.style.color = g_szColorTitleTextFocus; g_oNavMenu.style.backgroundColor = g_szColorTitleBG; if( oDropMenu ) { // // offsetLeft...start=0 // // offsetParent.offsetTop...start=0 // xPos = g_oNavMenu.offsetLeft; yPos = g_oNavMenu.offsetParent.offsetTop + 18; // window.alert( "x=["+xPos+"] y=["+yPos+"]" ); if( g_bIE ) { xPos -= 0; yPos -= 1; } oDropMenu.style.left = ( xPos ) + 'px'; // -2...to attach top border drop down cCollapseMenu to Horz cCollapseMenu header bar. oDropMenu.style.top = ( yPos ) + 'px'; oDropMenu.style.visibility = 'visible'; g_oPrevDropMenu = oDropMenu; g_oPrevNavMenu = g_oNavMenu; } } /*============================================================================*/ function OnCategoryHide () { document.onclick = null; if( g_oPrevSubMenu ) { g_oPrevSubMenu.style.visibility = 'hidden'; g_oPrevSubMenu = null; } g_oSubMenu = null; } /*============================================================================*/ function OnCategoryInit () { for( n=1; n<=g_iCategoryMax; n++ ) { szCategory = 'idCategory' + n; oCategory = document.getElementById( szCategory ); oCategory.onmouseover = OnCategoryShow; oCategory.onmouseout = OnCategoryOut; oCategory.onclick = OnCategoryShow; } for( n=1; n<=g_iItemMax; n++ ) { szItem = 'idItem' + n; oItem = document.getElementById( szItem ); oItem.style.visibility = 'hidden'; } } /*============================================================================*/ function OnCategoryOut (e) { document.onclick = OnDropMenuHide; } /*============================================================================*/ function OnCategoryShow (e) { // // this.id..."idCategory?", when drop-down cCollapseMenu switching. // szCategory = this.id.substring(10, this.id.length); szSubMenuName = 'idItem' + szCategory; // // szSubMenuName..."idItem?" // oSubMenu = document.getElementById( szSubMenuName ); if( g_oPrevSubMenu == oSubMenu ) return; OnCategoryHide(); if( oSubMenu ) { // // offsetLeft...start=0 // // offsetParent.offsetTop...start=0 // xPos = 270; //oSubMenu.offsetLeft + 250; yPos = 126 - 109; //oSubMenu.offsetParent.offsetTop - 109; yPos += ( ( parseInt(szCategory) - 1 ) * 30 ); // window.alert( "x=["+xPos+"] y=["+yPos+"]" ); if( g_bIE ) { xPos -= 0; yPos -= 1; } oSubMenu.style.left = (xPos) + 'px'; oSubMenu.style.top = (yPos) + 'px'; oSubMenu.style.visibility = 'visible'; g_oPrevSubMenu = oSubMenu; } } /*============================================================================*/ function OnFetchURL (id, url) { if( url == "register_nexuz_eval_license.html" ) if( !g_bGeoInit ) { OnGeoLocationInit(); } OnWaitOpen(); var req = false; if( window.XMLHttpRequest ) { req = new XMLHttpRequest(); } else if( window.ActiveXObject ) { req = new ActiveXObject("Microsoft.XMLHTTP"); } else { OnWaitClose(); window.alert( "ERROR: OnFetchURL()...no function found." ); return false; } // // To capture "Error on page.". // This cause a blank statusbar message. // try { req.onreadystatechange = function() { // // NOTE: I have to put a readyState check here // to avoid "Error on page." directly if // without try+catch block. // if( req.readyState == 4 ) { document.getElementById(id).innerHTML = req.responseText; } } if( g_bIE ) { req.open('GET', g_szURL+url, true); } else req.open('GET', url, true); req.send(null); } catch( e ) { throw e; } window.status = ""; OnWaitClose(); } /*============================================================================*\ OnGeoLocationInit(): - At 23/09/2010, GeoLocation complaint Browser results: Browser Version GeoLocationPrompt API Remark ========= ======= ================= === ============== IE 8.0 Y ? GoogleToolbar->Settings->Restore Defaults ( alternatively: Toolbar Options->Tools->Check "My Location" ). IE 9.0 Y ? " FireFox 3.6 Y Y Opera 10.62 Y ? Safari 5.0 Y ? Chrome 6.0.472.63 Y ? Options->Under the Hood->Reset to defaults. - Current web registration record submission format: . . @longitude|latitude|timezone|ipaddress|mapreference|country|capital|city|region|population|currencycode|currency|fips104|internet|nationalitysingular|nationalityplural|countrytitle|locationcode|# . . @101.7000|3.1670|+08:00|203.188.234.110|Southeast Asia |Malaysia|Kuala Lumpur |Kuala Lumpur|Wilayah Persekutuan|22229040|MYR|Malaysian Ringgit|MY|MY|Malaysian|Malaysians|Malaysia|MYKLKLUM|# 6 longitude....................[101.7000] 1 7 latitude.....................[3.1670] 2 8 timezone.....................[+08:00] 3 9 ipaddress....................[203.188.234.110] 4 10 mapreference.................[Southeast Asia ] 5 11 country......................[Malaysia] 6 12 capital......................[Kuala Lumpur ] 7 13 city.........................[Kuala Lumpur ] 8 14 region.......................[Wilayah Persekutuan ] 9 15 population...................[22229040] 10 16 currencycode.................[MYR] 11 17 currency.....................[Malaysian Ringgit] 12 18 fips104......................[MY] 13 19 internet.....................[MY] 14 20 nationalitysingular..........[Malaysian] 15 21 nationalityplural............[Malaysians] 16 22 countrytitle.................[Malaysia] 17 23 locationcode.................[MYKLKLUM] 18 @-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|# \*===========================================================================*/ var g_szRec = "-"; var g_szLatitude = "-"; var g_szLongitude = "-"; var g_szTimeZone = "-"; var g_szIP = '38.107.179.241'; var g_szMapReference = "-"; var g_szCountry = "-"; var g_szCapital = "-"; var g_szCity = "-"; var g_szRegion = "-"; var g_szPopulation = "-"; var g_szCurrencyCode = "-"; var g_szCurrency = "-"; var g_szfips104 = "-"; var g_szInternet = "-"; var g_szNationalitySingular = "-"; var g_szNationalityPlural = "-"; var g_szCountryTitle = "-"; var g_szCountryCode = "-"; function OnGeoLocationInit () { var dat = new Date(); var now = dat.toString(); if( g_bIE ) { g_szTimeZone = now.substr(now.indexOf("UTC")+3, 5); } else g_szTimeZone = now.substr(now.indexOf("GMT")+3, 5); var off = dat.getTimezoneOffset(); switch( off ) { case 240: g_szMapReference = "East Coast"; break; case 300: g_szMapReference = "Central"; break; case 360: g_szMapReference = "Mountain"; break; case 420: g_szMapReference = "Pacific"; break; default: g_szMapReference = "All"; } g_szRec = "-|-|" + g_szTimeZone+ "|" + g_szIP + "|" + g_szMapReference + "|-|-|-|-|-|-|-|-|-|-|-|-|-|"; g_bGeoInit = true; if( navigator.geolocation ) { navigator.geolocation.getCurrentPosition ( function (position) { var pos = position.coords; var add = position.address; // var ip = document.forms[0].htxtIPAddress.value; // alert( ip ); g_szLatitude = pos.latitude.toString(); g_szLongitude = pos.longitude.toString(); g_szCountry = add.country; g_szCountryTitle = add.country; g_szCity = add.city; g_szRegion = add.region; g_szfips104 = add.countryCode; g_szInternet = add.countryCode; g_szCountryCode = add.countryCode; g_szRec = "@" + g_szLatitude + "|" + g_szLongitude + "|" + g_szTimeZone + "|" + g_szIP + "|" + g_szMapReference + "|" + g_szCountry + "|" + g_szCapital + "|" + g_szCity + "|" + g_szRegion + "|" + g_szPopulation + "|" + g_szCurrencyCode + "|" + g_szCurrency + "|" + g_szfips104 + "|" + g_szInternet + "|" + g_szNationalitySingular + "|" + g_szNationalityPlural + "|" + g_szCountryTitle + "|" + g_szCountryCode + "|" //showMap(pos.latitude, pos.longitude, pos.accuracy); }, function (error) { var errorTypes = { 1: 'Permission Denied', 2: 'Position is not available', 3: 'Request timeout' }; //alert( errorTypes[ error.code ] ); } ); // navigator.geolocation.getCurrentPosition } // if( navigator.geolocation ) } /*============================================================================*/ function OnObjectImageMove (id, x, y) { var object = document.getElementById( id ); object.style.left = x + 'px'; object.style.top = y + 'px'; } /*============================================================================*/ var swap2 = Math.random(); function OnObjectTextMove (id, url, x, y) { var object = document.getElementById(id); OnFetchURL(id, url+"?"+swap2); swap2 = swap2 + 1; object.style.left = x + 'px'; object.style.top = y + 'px'; } /*============================================================================*/ var vsec = 0; var vx = 0; var vy = 77; /* 77 */ var dx = +1; var dy = -5; var start = vy + dy; var swap = Math.random(); var iScrollPause = 5000; var iScrollSpeed = 1; var iScrollStep = 0; var iScrollFix = 23; var iScrollNext = iScrollFix; var iScrollCount = 0; var iScrollFlip = 0; function OnObjectTextScrollVert (id, url) { var object = document.getElementById(id); object.style.left = vx + 'px'; object.style.top = vy + 'px'; vy = vy + dy; if( iScrollCount == 6 || vy == start ) { iScrollCount = 0; iScrollNext = iScrollFix; OnFetchURL(id, url + "?" + swap); vy = 76; swap = swap + 1; } iScrollStep++; iScrollSpeed = 1; if( iScrollStep > iScrollNext ) { iScrollStep = 0; iScrollFlip = !iScrollFlip; if( iScrollFlip ) { iScrollNext = 12; } else { iScrollNext = iScrollFix / 2; } iScrollCount++; if( iScrollCount < 6 ) { iScrollSpeed = iScrollPause; } //alert( "vy=[" + vy + "] step=[" + iScrollStep + "] next=[" + iScrollNext + "] count=[" + iScrollCount + "]" ); } setTimeout("OnObjectTextScrollVert('" + id + "', '" + url + "')", iScrollSpeed); } /* function OnObjectTextScrollVert (id, url) { var object = document.getElementById(id); object.style.left = vx + 'px'; object.style.top = vy + 'px'; vy = vy + dy; if( vy < -150 || vy == 76 ) { OnFetchURL(id, url+"?"+swap); vy = 76; swap = swap + 1; } setTimeout("OnObjectTextScrollVert('" + id + "', '" + url + "')", 128); } */ /*============================================================================*/ function OnMouseRightClick (e) { return false; // alert( "browser=["+navigator.appName+"] mouse=["+e.which+"]" ); if( navigator.appName == 'Netscape' && ( e.which == 2 || e.which == 3 ) ) { alert("Sorry, you do not have permission to right click."); return false; } if( navigator.appName == 'Microsoft Internet Explorer' && ( event.button == 2 || event.button == 3 ) ) { alert("Sorry, you do not have permission to right click."); return false; } return true; } /*============================================================================*/ function OnWriteInnerHTML (id, text) { var obj = document.getElementById( id ); obj.innerHTML = text; } /*============================================================================*/ function OnWaitCheck () { if( document.readyState == "complete" ) { OnWaitClose(); } } /*============================================================================*/ function OnWaitClose () { //document.getElementById("idOnWait").style.display = "none"; document.getElementById("idOnWait").style.visibility = 'hidden'; } /*============================================================================*/ function OnWaitOpen () { var w = ( window.screen.width - 300 ) / 2; var h = ( ( window.screen.height - 100 ) / 2 ) - 100; var o = document.getElementById("idOnWait"); o.style.left = w + 'px'; o.style.top = h + 'px'; o.style.visibility = 'visible'; } //////////////////////////////////////////////////////////////////////////////// // // // (C) ALL RIGHTS RESERVED. // // // // Function: Collapse cCollapseMenu I/O JScript implementions. // // // //////////////////////////////////////////////////////////////////////////////// var autoClose = 0; var oldObject = null; function toggleClamShellMenu (objectID) { if( (oldObject) && (autoClose == 1) ) { oldObject.style.display = 'none'; } var object = document.getElementById( objectID ); if( object.style.display == 'block' ) { object.style.display = 'none'; } else object.style.display = 'block'; oldObject = object; return; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // (C) ALL RIGHTS RESERVED. // // // // Function: User account registration I/O JScript implementions. // // // // Notation: req.readyState: // // // // 1 (Open) The object has been created, but the send method has not been called. // // 2 (Sent) The send method has been called. responseText is not available. responseBody is not available. // // 3 (Receiving) Some data has been received. responseText is not available. responseBody is not available. // // 4 (Loaded) All the data has been received. responseText is available. responseBody is available // // // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function OnFieldEnable (formName) { var f = formName.elements; for( var x=1; x