﻿function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'inline';
	}
	else {
		if (document.layers) { // Netscape 4
		    document.id.display = 'inline';
		}
		else { // IE 4
		    document.all.id.style.display = 'inline';
		}
	}
}

function invisiblediv(id) {
    //safe function to hide an element with a specified id
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(id).style.visibility = 'hidden';
    }
    else {
        if (document.layers) { // Netscape 4
            document.id.visibility = 'hidden';
        }
        else { // IE 4
            document.all.id.style.visibility = 'hidden';
        }
    }
}

function visiblediv(id) {
    //safe function to show an element with a specified id

    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(id).style.visibility = 'visible';
    }
    else {
        if (document.layers) { // Netscape 4
            document.id.visibility = 'visible';
        }
        else { // IE 4
            document.all.id.style.visibility = 'visible';
        }
    }
}

//For iPhone Application Page(s)
function changeImage(anImage, newSource) {
    document.images[anImage].src = 'Images/' + newSource;
}
imgArray = new Array("1", "2", "3", "4");
numImages = 4;
curImage = 1;
function iphone_slide(x) {
    curImage = curImage + x;
    if (curImage > numImages)
    { curImage = 1; }
    if (curImage == 0)
    { curImage = numImages; }
    document.getElementById('imgiphone').src = 'Images/iPhoneApp' + imgArray[curImage - 1] + '.jpg';
    resetall();
    showdiv('iphoneapp' + imgArray[curImage - 1]);
    showdiv('iphonetext' + imgArray[curImage - 1]);
    changeImage('bullet' + imgArray[curImage - 1], 'iPhoneAppBulletOn.jpg');
}
function resetall() {
    visiblediv('iphoneappnav')
    hidediv('iphoneapp1');
    hidediv('iphoneapp2');
    hidediv('iphoneapp3');
    hidediv('iphoneapp4');
    hidediv('iphoneapp5');
    hidediv('iphonetext1');
    hidediv('iphonetext2');
    hidediv('iphonetext3');
    hidediv('iphonetext4');
    changeImage('bullet1', 'iPhoneAppBulletOff.jpg');
    changeImage('bullet2', 'iPhoneAppBulletOff.jpg');
    changeImage('bullet3', 'iPhoneAppBulletOff.jpg');
    changeImage('bullet4', 'iPhoneAppBulletOff.jpg');
}
function forceimg(x) {
    document.getElementById('imgiphone').src = 'Images/iPhoneApp' + x + '.jpg';
}
function setcurImage(x) {
    curImage = x;
}

//For iPhone Timer Application Page(s)
imgArrayTimer = new Array("1", "2", "3");
numImagesTimer = 3;
curImageTimer = 1;
function iphonetimer_slide(x) {
    curImageTimer = curImageTimer + x;
    if (curImageTimer > numImagesTimer)
    { curImageTimer = 1; }
    if (curImageTimer == 0)
    { curImageTimer = numImagesTimer; }
    document.getElementById('imgiphonetimer').src = 'Images/iPhoneTimerApp' + imgArray[curImageTimer - 1] + '.jpg';
    resetallTimer();
    showdiv('iphonetimerapp' + imgArray[curImageTimer - 1]);
    showdiv('iphonetimertext' + imgArray[curImageTimer - 1]);
    changeImage('bullettimer' + imgArray[curImageTimer - 1], 'iPhoneAppBulletOn.jpg');
}
function resetallTimer() {
    visiblediv('iphonetimerappnav')
    hidediv('iphonetimerapp1');
    hidediv('iphonetimerapp2');
    hidediv('iphonetimerapp3');
    hidediv('iphonetimertext1');
    hidediv('iphonetimertext2');
    hidediv('iphonetimertext3');
    changeImage('bullettimer1', 'iPhoneAppBulletOff.jpg');
    changeImage('bullettimer2', 'iPhoneAppBulletOff.jpg');
    changeImage('bullettimer3', 'iPhoneAppBulletOff.jpg');
}
function forceimgTimer(x) {
    document.getElementById('imgiphonetimer').src = 'Images/iPhoneTimerApp' + x + '.jpg';
}
function setcurImageTimer(x) {
    curImageTimer = x;
}
