if (document.all) { 
docObj = "document.all."
styleObj = ".style"

ie =true
}

else
{
docObj = "document."  
styleObj = ""
ie =false
}
window.onbeforeunload = close; 

function close(){
	document.getElementById(id).style.visibility = 'hidden';
	
}

function loaded(){
}

function popUpDynamic(evt, displayStr) { 
	popUpContainer = document.getElementById("popup");
	popUpContainer.innerHTML = displayStr;
	popUp(evt, "popup");
}
var count = 0
function showDyn(evt, i) {
	count++;
	//alert(count);
	displayStr = eval('a'+ i)
	popUpContainer = document.getElementById("popup");
	popUpContainer.innerHTML = displayStr;
	popUp(evt, "popup");
	//if (count < 1){
	//	alert(popUpContainer.innerHTML + count);
	//}
	//
}

function move(evt,value) {
			popUp(evt,"A"+value)
}
function popUp(evt, ggg) { 
	if (id != null){

		popDown()
		}
id = ggg
	if (ie){
		if (document.body.clientHeight < evt.y + 60){
			xy = parseInt(evt.y) - 60
		}
		else xy = parseInt(evt.y)
		if (document.body.clientWidth < evt.x + 151){
			xc = parseInt(evt.x) - 150
		}
		else xc = parseInt(evt.x)
		popUpWin = eval(docObj + ggg + styleObj)
		 popUpWin.top = xy + 23 + document.body.scrollTop
		popUpWin.left = Math.max(2, xc) + 5 
		popUpWin.visibility = "visible"  
		popUpWin.status = ""
		//alert("i")	
	}
    else{
          if (window.innerWidth < evt.pageX + 150){
	xc = evt.pageX - 150

	}
	else xc = evt.pageX

	if (window.innerHeight  + window.pageYOffset < evt.pageY + 50){
		xy = evt.pageY - 40

	}
	else xy = evt.pageY  + 30

	document.getElementById(id).style.top = xy +"px";
	document.getElementById(id).style.left = xc +3  +"px"; 
	document.getElementById(id).style.visibility = 'visible'
	}


}

function popDown() {
 document.getElementById(id).style.visibility =  "hidden"	
}

function setQuickTimeCookie() {
    var cookie = readCookie("qt");
    if (cookie == null){
		var hasQT = detectQuickTime();
		var date = new Date();
		if (hasQT){
			date.setTime(date.getTime()+(15 * 86400000));
			var expires = "; expires="+date.toGMTString();
			cookie = readCookie("prefs2");
			if (cookie != null){
				if (cookie.charAt(0) == '1'){
					document.cookie ='prefs2=0' + cookie.charAt(1) + expires + '; path=/';
				}
			}
			document.cookie ='qt=yes' + expires + '; path=/';

		}
		else{
			date.setTime(date.getTime()+(2 * 86400000));
			var expires = "; expires="+date.toGMTString();			
			document.cookie ='qt=no' + expires + '; path=/';
		}
    }
}


// Here we write out the VBScript block for MSIE Windows
if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
    document.writeln('<script language="VBscript">');

    document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
    document.writeln('detectableWithVB = False');
    document.writeln('If ScriptEngineMajorVersion >= 2 then');
    document.writeln('  detectableWithVB = True');
    document.writeln('End If');

    document.writeln('\'this next function will detect most plugins');
    document.writeln('Function detectActiveXControl(activeXControlName)');
    document.writeln('  on error resume next');
    document.writeln('  detectActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('\'and the following function handles QuickTime');
    document.writeln('Function detectQuickTimeActiveXControl()');
    document.writeln('  on error resume next');
    document.writeln('  detectQuickTimeActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('    detectQuickTimeActiveXControl = False');
    document.writeln('    hasQuickTimeChecker = false');
    document.writeln('    Set hasQuickTimeChecker = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")');
    document.writeln('    If IsObject(hasQuickTimeChecker) Then');
    document.writeln('      If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then ');
    document.writeln('        detectQuickTimeActiveXControl = True');
    document.writeln('      End If');
    document.writeln('    End If');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('</scr' + 'ipt>');
}

function detectQuickTime() {
    var daPlugin = 'QuickTime';
    // consider pluginFound to be false until proven true
    var pluginFound = false;
    // if plugins array is there and not fake
    if (navigator.plugins && navigator.plugins.length > 0) {
	var pluginsArrayLength = navigator.plugins.length;
	// for each plugin...
	for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
	    // loop through all desired names and check each against the current plugin name
	    var numFound = 0;
		// if desired plugin name is found in either plugin name or description
		if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugin) >= 0) || 
		    (navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugin) >= 0) ) {
		    // this name was found
		    return true;
		}  
	}
    }
	else{
		if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1) &&detectQuickTimeActiveXControl)
			return true;
	}
    return false;
} // detectPlugin
setQuickTimeCookie();

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}



function displayMsg(evt, msg) {
	document.getElementById('msg').innerHTML = msg;
	//alert('hi' +msg)
	popUp(evt,'msg')
	
}

function hidemsg(){
	document.getElementById('msg').innerHTML =  "";	
}

function groupShow(evt, index, number) {
	
	try{
			value = "" + eval("a71")
			value = value + " " + index;
			if (number != -1)
				value += " - " + eval('a'+ number)
			group = document.getElementById("group_popup");
			group.innerHTML = "" + value; 
			popUp(evt,"group_popup")	
		}
		catch(e){ // if the variable to a71 hasn't been defined then use this one. 
			if (number != -1)
				popUp(evt,"A"+number)
		}
}

var id;
function show(evt,value) {
		popUp(evt,"A"+value)
	}
function showS(evt,i) {
	
	source = document.getElementById('S'+ i);
	//alert(displayStr.innerHTML);
	translation = document.getElementById('A'+ i);
	//alert(displayStr.innerHTML);
	popUpContainer = document.getElementById("popup");
	popUpContainer.innerHTML = "<div class='source'>" + source.innerHTML + "</div><div class='translation'>" + translation.innerHTML + "</div>";
	popUp(evt, "popup");
	
	

	}
	
function showNothing(evt,value){
}
	
function show_tag(evt, value) {
		popUp(evt, value)
	}
	
function play(evt,value) {


		popUp(evt,"A"+value)
		
	}
function change(event){
	if (ie){
		event = window.event
		var here = event.srcElement;
		here.parentNode.style.background = "url('/images/new/norm_right_on.gif') no-repeat right top"
	}
}
function changeOff(event){
	if (ie){
		event = window.event
		var here = event.srcElement;
		here.parentNode.style.background = "url('/images/new/norm_right.gif') no-repeat right top"
	}
}

