﻿// JScript File
<!--
    // Root Directory example Home page
    function init1()
    {

	    if (document.getElementById)
		    var x = document.getElementById('mouseovers').getElementsByTagName('img');
	    else if (document.all)
		    var x = document.all['mouseovers'].all.tags('img');
	    else return;
	    var preloads = new Object();
	    for (var i=0;i<x.length;i++)
	    {
		    preloads['n'+x[i].id] = new Image;
		    preloads['n'+x[i].id].src = 'Resources/Images/TopMenu/'+ x[i].id + '_nrm.jpg';
		    preloads['o'+x[i].id] = new Image;
		    preloads['o'+x[i].id].src = 'Resources/Images/TopMenu/'+ x[i].id + '_omo.jpg';
		    preloads['o'+x[i].id].onerror = function () {/*this.src='Images/TopMenu/default.gif'*/}
		    x[i].onmouseover = function () {this.style.cursor = "hand"; this.src=preloads['o'+this.id].src;}
		    x[i].onmouseout = function () {this.src=preloads['n'+this.id].src;}
		  /*  x[i].onclick = function () {location.href= menuUrl[this.id]; }*/

	    }
    }


    // Level 1 branch example Mobile Plan, Mobile Data, Broadband, etc..
    function init2()
    {
    
	    if (document.getElementById)
		    var x = document.getElementById('mouseovers').getElementsByTagName('img');
	    else if (document.all)
		    var x = document.all['mouseovers'].all.tags('img');
	    else return;
	    var preloads = new Object();
	    for (var i=0;i<x.length;i++)
	    {
		    preloads['n'+x[i].id] = new Image;
		    preloads['n'+x[i].id].src = '../Resources/Images/TopMenu/'+ x[i].id + '_nrm.jpg';
		    preloads['o'+x[i].id] = new Image;
		    preloads['o'+x[i].id].src = '../Resources/Images/TopMenu/'+ x[i].id + '_omo.jpg';
		    preloads['o'+x[i].id].onerror = function () {/*this.src='Images/TopMenu/default.gif'*/}
		    x[i].onmouseover = function () {this.style.cursor = "hand"; this.src=preloads['o'+this.id].src;}
		    x[i].onmouseout = function () {this.src=preloads['n'+this.id].src;}
		   /* x[i].onclick = function () {location.href= menuUrl[this.id]; }*/

	    }
	    
	    LMinit1();
    }


    // Level 1 Left menu
    function LMinit1()
    {
    
	    if (document.getElementById)
		    var x = document.getElementById('leftmouseovers').getElementsByTagName('img');
	    else if (document.all)
		    var x = document.all['leftmouseovers'].all.tags('img');
	    else return;
	    var preloads = new Object();
	    for (var i=0;i<x.length;i++)
	    {
		    preloads['n'+x[i].id] = new Image;
		    preloads['n'+x[i].id].src = '../Resources/Images/LeftMenu/'+ x[i].id + '_nrm.jpg';
		    preloads['o'+x[i].id] = new Image;
		    preloads['o'+x[i].id].src = '../Resources/Images/LeftMenu/'+ x[i].id + '_omo.jpg';
		    preloads['o'+x[i].id].onerror = function () {/*this.src='Images/TopMenu/default.gif'*/}
		    x[i].onmouseover = function () {this.style.cursor = "hand"; this.src=preloads['o'+this.id].src;}
		    x[i].onmouseout = function () {this.src=preloads['n'+this.id].src;}
		   /* x[i].onclick = function () {location.href= menuUrl[this.id]; }*/

	    }
    }
    
    function tabmouseover(val){
        var x = document.getElementById(val)
        x.style.cursor = "hand";
    }
    
       
    // Navigation path
    function NavigateTo(val){
        location.href = val;
    }
   
   // Open the catalog in a new window
   
   function DownloadCatalog(){
    location.href="../Resources/Images/Competition/CurrentCatalog.pdf";
   }
   
   
   // Numeric Data entry validation 
    function numericOnly(e) {
	    var iKeyCode;
	    if (!e) {
		    var e = window.event;
	    }
	    if (e.keyCode) {
		    iKeyCode = e.keyCode;
	    } else {
		    if (e.which) {
			    iKeyCode = e.which;
		    }
	    }
	    switch(iKeyCode) {
		    case 8:
		    case 9:
		    case 37:
		    case 38:
		    case 39:
		    case 40:
		    case 46:
			    break;
		    case 48:
		    case 49:
		    case 50:
		    case 51:
		    case 52:
		    case 53:
		    case 54:
		    case 55:
		    case 56:
		    case 57:
			    if (e.shiftKey || e.altKey){
				    return false;
			    }
			    break;
		    case 96:
		    case 97:
		    case 98:
		    case 99:
		    case 100:
		    case 101:
		    case 102:
		    case 103:
		    case 104:
		    case 105:
			    //return correct numeric from keypad
			    return iKeyCode - 48; break;
		    case 110:
		    case 190:
			    //if you are supporting decimal points
			    return '.';	break;
		    default: return false;
	    }
    }

    // Mobile Product Popup Window functions
    //parent window
    function openPopup(val){
        var w = 800, h = 600;

        /*
        if (document.all) {
           // the following is only available after onLoad 
           w = document.body.clientWidth;
           h = document.body.clientHeight;
        }
        else if (document.layers) {
           w = window.innerWidth;
           h = window.innerHeight;
        }
        */
        
        var popW = 700, popH = 650;
        var leftPos = (w-popW)/2, topPos = (h-popH)/2;
    
        var url = 'MobileProductPopup.aspx?ProductID=' + val;
        var feature = 'width='+ popW + ',height=' + popH + ',top=' + topPos + ',left='+ leftPos + ',resizable=1,scrollbars=1';
        (window.open(url,'ProductWin',feature,'')).focus();
        
    }
    
    function navigatefromchild(val){
        document.forms['formData'].action = val;
        document.forms['formData'].submit();
    }
 
    function closedownall(){
        var myhandler = window.open('','ProductWin');
        myhandler.close();
    }
    
    //child window
    function navigatetoparent(val){
    window.opener.navigatefromchild(val);
    window.close();
    }    
	
	function FitPic() { 
       iWidth = (NS)?window.innerWidth:document.body.clientWidth; 
       iHeight = (NS)?window.innerHeight:document.body.clientHeight; 
       iWidth = document.images[0].width - iWidth; 
       iHeight = document.images[0].height - iHeight; 
       window.resizeBy(iWidth, iHeight); 
       self.focus(); 
    }
			
-->