
function changeImgSrc (p_dir) {
	var file = document.getElementById('galPic').src;
	for (i = 0; i < arr_galMedia.length;i++) {
		var wordCount = arr_galMedia[i].length;
		var tmpFile = file.substring((file.length-wordCount),file.length);
		if (tmpFile == arr_galMedia[i]) {
			var curPos = i;
		}
	}
	if (p_dir == "-") {
		if (curPos == "0") {
			var nextPos = (arr_galMedia.length-1);
		} else {
			var nextPos = curPos-1;
		}
	} else if (p_dir == "+") {
		if (curPos == (arr_galMedia.length-1)) {
			var nextPos = 0;
		} else {
			var nextPos = curPos+1;
		}
	}
	document.getElementById('galPic').src = arr_galMedia[nextPos];
}


var keyStr = "ABCDEFGHIJKLMNOP" +
            "QRSTUVWXYZabcdef" +
            "ghijklmnopqrstuv" +
            "wxyz0123456789+/" +
            "=";
function encode(input) {
   var output = "";
	  var chr1, chr2, chr3 = "";
	  var enc1, enc2, enc3, enc4 = "";
	  var i = 0;

  do {
     chr1 = input.charCodeAt(i++);
     chr2 = input.charCodeAt(i++);
     chr3 = input.charCodeAt(i++);

     enc1 = chr1 >> 2;
     enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
     enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
     enc4 = chr3 & 63;

     if (isNaN(chr2)) {
        enc3 = enc4 = 64;
     } else if (isNaN(chr3)) {
        enc4 = 64;
     }

     output = output + 
        keyStr.charAt(enc1) + 
        keyStr.charAt(enc2) + 
        keyStr.charAt(enc3) + 
        keyStr.charAt(enc4);
     chr1 = chr2 = chr3 = "";
     enc1 = enc2 = enc3 = enc4 = "";
      } while (i < input.length);

      return "?dat=" + output;
   }
  

function browserCheck() {
	var version = navigator.appVersion;
	browser = (
		((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4 ))
		|| 
		((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 ))
		|| 
		((navigator.appName == "Microsoft Internet Explorer") && (version.search(/MSIE 6.+/) != -1 ))
		|| 
		((navigator.appName == "Microsoft Internet Explorer") && (version.search(/MSIE 5\.5.+/) != -1 ))
		|| 
		((navigator.appName == "Safari") && (parseInt(navigator.appVersion) >= 1 ))
	);

	if (browser == 0)	location='html/browsercheck.html';
}

function detectingFLASH() {
	var browser = navigator.userAgent.toLowerCase();
	flashVersion = 0;
	// NS3+, Opera3+, IE5+ Mac
	if ( navigator.plugins != null && navigator.plugins.length > 0 ) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if ( typeof flashPlugin == 'object' ) {
			if ( flashPlugin.description.indexOf('7.') != -1 ) flashVersion = 7;
			else if ( flashPlugin.description.indexOf('6.') != -1 ) flashVersion = 6;
			else if ( flashPlugin.description.indexOf('5.') != -1 ) flashVersion = 5;
			else if ( flashPlugin.description.indexOf('4.') != -1 ) flashVersion = 4;
			else if ( flashPlugin.description.indexOf('3.') != -1 ) flashVersion = 3;
		}
	} else if ( browser.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && browser.indexOf("win")!= -1 && browser.indexOf("16bit")== -1 ) {
		// IE4+ Win32 (VBscript)
		document.write('<scr' + 'ipt language="VBScript"\> \n');
		document.write('on error resume next \n');
		document.write('DIM obFlash \n');
		document.write('SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.7") \n');
		document.write('IF IsObject(obFlash) THEN \n');
		document.write('flashVersion = 7 \n');
		document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.6") END IF \n');
		document.write('IF flashVersion < 7 and IsObject(obFlash) THEN \n');
		document.write('flashVersion = 6 \n');
		document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.5") END IF \n');
		document.write('IF flashVersion < 6 and IsObject(obFlash) THEN \n');
		document.write('flashVersion = 5 \n');
		document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.4") END IF \n');
		document.write('IF flashVersion < 5 and IsObject(obFlash) THEN \n');
		document.write('flashVersion = 4 \n');
		document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.3") END IF \n');
		document.write('IF flashVersion < 4 and IsObject(obFlash) THEN \n');
		document.write('flashVersion = 3 \n');
		document.write('END IF');
		document.write('</scr' + 'ipt\> \n');
	} else {
		// no Flash
		flashVersion = -1;
	}
	return flashVersion;
}