var compatible = (document.getElementById);

function init()
{
    allimages = new Array();
	images = document.getElementsByName('thumbnails');
	stat = 'img';

    for (i=0; i<images.length; i++){

        //get all objects for these functions
       	allimages[i] = document.getElementById(images[i].id);

        // open and see but also closs
        allimages[i].onclick = function () {

	        if (!compatible) {
	        		return false;
	        	} else {
	        		image = this.getAttribute('src');
				newSrc = image.replace('_tmb','');
				if (stat == 'img') {
					document.getElementById('enlarged').src = newSrc;
				} else {
					hateeemel = '<img id="enlarged" class="mag" src="'+  newSrc + '" alt="">';
					document.getElementById('movimg_container').innerHTML = hateeemel;
				}
				stat = 'img';
				return false;
	        }
        }

    }

	movies = document.getElementsByName('movie');

	if (movies.length > 0){
		movie = movies[0];
   		movie.onclick = function () {
			swf = this.getAttribute('src');
			// replace content_img for content_mov
			swf = swf.replace ('img', 'mov');
			// replace img_tmb.jpg for img.jpg
			swf = swf.replace ('_tmb', '');
			// then replace jpg or png for swf
			swf = swf.replace ('jpg', 'flv');
			swf = swf.replace ('png', 'flv');
			swf = swf.replace ('images', 'other');

			
			/*	
				<!-- Image fall back for non-HTML5 browser with JavaScript turned off and no Flash player installed -->
				<!--img src="http://www.sophiekrier.com/files/trailer_zoutmeisje.jpg" width="567" height="425" alt="Here we are" 
					title="No video playback capabilities" / -->
		
			*/
			
   			hatheeemel = '<object ';
			hatheeemel += 'type="application/x-shockwave-flash" ';
			hatheeemel += 'height="425" ';
			hatheeemel += 'width="567" ';
			//hatheeemel += 'id="'+ title +'" ';
			hatheeemel += 'data="http://www.sophiekrier.com/files/video/flashmediaelement.swf"> ';
			hatheeemel += '<param name="movie" value="http://www.sophiekrier.com/files/video/flashmediaelement.swf" /> ';
			//hatheeemel += '<param name="flashvars" value="controls=true&amp;file=http://www.sophiekrier.com/files/video/'+swf+'" /> ';
			hatheeemel += '<param name="flashvars" value="controls=true&amp;file='+swf+'" /> ';
			
			hatheeemel += '<param name="bgcolor" value="#ffffff" /> ';
			/*hatheeemel += '<embed src="' + swf + '" ';
			hatheeemel += '	quality="high" ';
			hatheeemel += '	bgcolor="#ffffff" ';
			hatheeemel += '	width="567" ';
			hatheeemel += '	height="425"';
			hatheeemel += '	name="'+ title +'" ';
			hatheeemel += '	align="middle" ';
			hatheeemel += '	allowScriptAccess="sameDomain" ';
			hatheeemel += '	type="application/x-shockwave-flash"';
			hatheeemel += '	pluginspage="http://www.macromedia.com/go/getflashplayer" />';*/
			hatheeemel += '</object>';
			document.getElementById('movimg_container').innerHTML = hatheeemel;
			stat = 'mov';

   		}
   	}
}

window.onload = function () { init(); }

