Event.observe(document, "dom:loaded", function() {
	/* topBtns On & Off*/
	var techImg = $$(".technologies")[0];
	if(techImg) imgOver(techImg);

	var gnbImg = $("headArea").down(".customerPortal");
	if(gnbImg) menuOver(gnbImg);

	var gnbImg = $("headArea").down(".trainingSupport");
	if(gnbImg) menuOver(gnbImg);
	
	var gnbImg = $("headArea").down(".demoPresentation");
	if(gnbImg) menuOver(gnbImg);

	
	function imgOver(obj) {
		var container = obj;
		container.select("a").each(function(item) {
			item.observe("mouseover", function() {
				if(item.down("img")) {
					item.down("img").src = item.down("img").src.replace(".gif", "On.gif");
					item.observe("mouseout", function() {
						item.down("img").src = item.down("img").src.replace("On.gif", ".gif");
					});
				}
			});
		});	
	}
	var rollingImgs = $("rollingImg").select("img");
	var i = 1;
	var indexImg = 0;
	rollingImgs.each(function(item, i) {
		if(i!=0) item.hide();
	});
	function RollingBanner() {
		if(i <= (rollingImgs.size()-1)) {
			rollingImgs.each(function(item) {
				item.hide();
			});
			rollingImgs[i].show();
			indexImg = i;
			i++;
		} else {i = 0;}
	}

	var btns = $("rollingBtn").select("img");
	btns.each(function(item, clickedIndex) {
		item.observe("click", function() {
			var onImg = indexImg;
			rollingImgs.each(function(item, i) {
				item.hide();
			});
			if(clickedIndex == 0) {
				onImg--;
			} else if(clickedIndex == 1) {
				onImg++;
			}
			rollingImgs[onImg].show();
		});
	}.bind(this));



	new PeriodicalExecuter(RollingBanner, 3); 
});

function menuOver(obj) {
	var item = obj;
	item.observe("mouseover", function() {
		if(!item.hasClassName("on")) {
			item.addClassName("on");
		}

		item.observe("mouseout", function() {
			if(item.hasClassName("on")) {
				item.removeClassName("on");
			}	
		});

	});	
}
/*
*
* multi object embed
* for standard
* Reflexion co.
*
*/
function setEmbed(){ 
	var objId = new String; 
	var parameter = new String; 
	var params = new String;
	var clsid = new String; 
	var codebase = new String; 
	var pluginspage = new String; 
	var embedType = new String; 
	var src = new String; 
	var width = new String; 
	var height = new String; 
	this.init = function(oSrc, oWidth, oHeight, oId) {
		thisFileName = getFileName(oSrc).split(".")[0];
		thisFileType = getFileName(oSrc).split(".")[1];
		thisFileType = thisFileType.replace(" ", "");
		
		if (!oId){
			oId = thisFileName;
		}

		switch(thisFileType){
			case "swf" : {
				embedType = "application/x-shockwave-flash";
				mediaType = "flash";
				} break;
			case "wmv" : {
				embedType = "video/x-ms-wmv";
				mediaType = "movie";
				} break;
			case "wma" : {
				embedType = "audio/x-ms-wma";
				mediaType = "movie";
				} break;
			case "mp3" : {
				embedType = "audio/mpeg";
				mediaType = "movie";
				} break;
			case "asf" : {
				embedType = "video/x-ms-asf ";
				mediaType = "movie";
				} break;
			case "avi" : {
				embedType = "video/x-msvideo";
				mediaType = "movie";
				} break;
			case "mpeg" :
			case "mpg" : {
				embedType = "video/mpeg";
				mediaType = "movie";
				} break;
		}

		if (mediaType == "flash"){ 
			clsid = "D27CDB6E-AE6D-11cf-96B8-444553540000";        
			codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0"; 
			pluginspage = "http://www.macromedia.com/go/getflashplayer"; 
			parameter += "<param name='quality' value='high'>\n"; 
		} 
		else if (mediaType == "movie"){ 
			clsid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6";
			codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715";
			pluginspage="http://www.microsoft.com/windows/mediaplayer/download/default.asp";
		} 

		if (thisFileType == "mov"){ 
			clsid="CLSID:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";
			codebase="http://www.apple.com/qtactivex/qtplugin.cab";
			pluginspage="http://www.microsoft.com/windows/mediaplayer/download/default.asp";
			embedType="video/quicktime";
		} 

		src = oSrc;
		width = oWidth;
		height = oHeight;
		objId = oId;	
	} 

	this.param = function(parm , value) {      
		parameter += "<param name='"+parm +"' value='"+ value + "'>\n";
		params += parm + "='" + value + "'";
	}  


	this.show = function() { 
		if (clsid){ 
			obj = '<object classid="clsid:'+ clsid +'" codebase="'+ codebase +'" width="'+ width +'" height="'+ height +'" id="' + objId + '">\n';
			obj += '<param name="src" value="'+ src + '">\n';
			obj += '<param name="url" value="'+ src + '">\n';
			obj += parameter;
			//obj += '<!--[if !IE]>-->';
			//obj += '<object data="' + src + '" type="' + embedType + '" width="'+ width +'" height="'+ height +'" name="' + objId + '" >';
			//obj += '<param name="src" value="'+ src + '">\n';
			//obj += parameter;
			//obj += '<a href="' + pluginspage + '" onclick="window.open(this.href);return false;">Click here to download plugin</a>';
			//obj += '</object>\n';
			//obj += '<!--<![endif]-->';
			obj += '<embed src="'+ src+ '" quality="high" bgcolor="#ffffff" width="'+ width +'" height="'+ height +'" name="'+objId+'" align="middle" type="' + embedType + '" pluginspage="' + pluginspage + '" '+params+' />';
			obj += '</object>\n'; 
			eval("window." + objId + " = document.getElementById('" + objId + "');");
		} 
		//alert(params);
		document.write(obj);
	}
}

function getFileName(uri){
	if(uri.indexOf("#")>0)uri = uri.substr(0,uri.indexOf("#"));
	if(uri.indexOf("&")>0)uri = uri.substr(0,uri.indexOf("&"));
	if(uri.indexOf("?")>0)uri = uri.substr(0,uri.indexOf("?"));
	var thisUriArray = uri.split(/\//);
	var thisFileName = thisUriArray[thisUriArray.length-1];
	return thisFileName;
}

function getSWF(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
		if (window.document[movieName])	return window.document[movieName];
    }
	else {
		if (!window.document[movieName]) return document.getElementById(movieName);
		if(document[movieName].length != undefined)	return document[movieName][1];
    }
}


