
//'*********************************************************************************
//' Description: javascript functions for Ingenium Website
//' Date: 05/2006
//' Author: Enrique Reyes
//'
//' ::::::::: BEGIN COPYRIGHT and LICENSE :::::::::::::::::::::::::::::::::::::::::::::
//' Removal of this section is a violation of license and terms of use.
//' Source code Copyright 2006. All Rights Reserved.
//' ::::::::: END COPYRIGHT  and LICENSE ::::::::::::::::::::::::::::::::::::::::::::::
//'*********************************************************************************
//' Modifications:
//'-------------------------------------------------------------------------------
//' scn     date       description
//'
//'*********************************************************************************
var msg="Right Click Disabled!";

//------------------------------------------------------------------------------------------
//    Preload Script 
//------------------------------------------------------------------------------------------
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		home_over = newImage("images/home-over.jpg");
		company_profile_over = newImage("images/company-profile-over.jpg");
		services_over = newImage("images/services-over.jpg");
		products_over = newImage("images/products-over.jpg");
		contacts_over = newImage("images/contacts-over.jpg");
		preloadFlag = true;
	}
}


//------------------------------------------------------------------------------------------
//    random images
//------------------------------------------------------------------------------------------
function StringArray (n) {
  this.length = n;  
  for (var i =1; i <= n; i++)
    {
    this[i] = ' '
    }
  }
  
image_cp2 = new StringArray(3)
image_cp2[0] = 'cprofile2a.jpg'
image_cp2[1] = 'cprofile2b.jpg'
image_cp2[2] = 'cprofile2c.jpg'

image_m1 = new StringArray(3)
image_m1[0] = 'm1a.jpg'
image_m1[1] = 'm1b.jpg'
image_m1[2] = 'm1c.jpg'

image_se2 = new StringArray(2)
image_se2[0] = 'services2a.jpg'
image_se2[1] = 'services2b.jpg'

function randomNumber(limit){
  return Math.floor(Math.random()*limit);
}

function ranimage(location) {
  var location;
  if (location == 'cp2') {return(image_cp2[randomNumber(3)]);}
  if (location == 'm1') {return(image_m1[randomNumber(3)]);}
  if (location == 'se2') {return(image_se2[randomNumber(2)]);}
 }

//------------------------------------------------------------------------------------------
// For disabled right click
//------------------------------------------------------------------------------------------
function disableIE() {if (document.all) {alert(msg);return false;}
}
function disableNS(e) {
  if (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {alert(msg);return false;}
  }
}
if (document.layers) {
  document.captureEvents(Event.MOUSEDOWN);document.onmousedown=disableNS;
} else {
  document.onmouseup=disableNS;document.oncontextmenu=disableIE;
}
document.oncontextmenu=new Function("alert(msg);return false")



