//<![CDATA[


///////////////////////////////// FUNCTIONS ////////////////////////////////////

var hasFlash = function(){
    var nRequiredVersion = 6;	
	
	if(navigator.appVersion.indexOf("MSIE") != -1 && navigator.appVersion.indexOf("Windows") > -1){
		document.write('<script language="VBScript"\> \n');
		document.write('on error resume next \n');
		document.write('hasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & ' + nRequiredVersion + '))) \n');  
		document.write('<'+'/script\> \n');
		/*	If executed, the VBScript above checks for Flash and sets the hasFlash variable. 
			If VBScript is not supported it's value will still be undefined, so we'll run it though another test
			This will make sure even Opera identified as IE will be tested */
		if(window.hasFlash != null){
			return window.hasFlash;
		};
	};
	
	if(navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
		var flashDescription = (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description;
		var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
		return flashVersion >= nRequiredVersion;
	};
	
	return false;
}();
     

function openWin(path,winW,winH) {
	var iMyWidth;
	var iMyHeight;
    iMyWidth = (window.screen.width/2) - ((winW/2)+ 10); 
	iMyHeight = (window.screen.height/2) - ((winH/2) + 50); 
	var win2 = window.open(path,'',"status,toolbar=0,height="+winH+",width="+winW+",resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");
    win2.opener=window;
    win2.focus();
    return false;
}
function isValidEmailAddress(addr) {
    var re;
    re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/;
    if (re.test(addr) == true)
       return true;
    else
      return false;
}
function playMovie(file, index){
	//alert(file);
	mov = new FlashObject("inc/swfPlayer.swf?file="+file, "swf", "325", "221", 6, "#4e605b");
 	mov.write("player");
	var descr=document.getElementById('c'+index);
	descr.style.display='block';
	var pl=document.getElementById('player');
	pl.style.display='block';
	var close=document.createElement('a');
	close.setAttribute('href','javascript:closePlayer('+index+')');
	var txt=document.createTextNode('close');
	close.appendChild(txt);
	pl.appendChild(close);
	return false;
}
function closePlayer(index){
	var pl=document.getElementById('player');
	//pl.innerHtml='';
	mov = new FlashObject("inc/swfPlayer.swf", "swf", "0", "0", 6, "#4e605b");
 	mov.write("player");
	pl.style.display='none';
	var descr=document.getElementById('c'+index);
	descr.style.display='none';
}
function setSlide(file,n,title){
sl = new FlashObject("inc/slide.swf?file="+file+"&n="+n+"&title="+title, "sl", "660", "270", 6, "#000000");
sl.write("area");
}
function $(strId){
	return document.getElementById(strId);
}
///////////////////////////////// onload ///////////////////////////////////////
var params = {
  menu: "false",
  bgcolor:'#020202',
  wmode: 'transparent'
};

if($('home'))swfobject.embedSWF("files/swf/intro.swf", "intro", "765", "375", "8",false,false,params);
else if($('work'))swfobject.embedSWF("files/swf/choose.swf", "swf", "765", "375", "8",false,false,params);
else if($('films'))swfobject.embedSWF("files/swf/films.swf", "swf", "765", "375", "8",false,false,params);
else if($('still'))swfobject.embedSWF("files/swf/still.swf", "swf", "765", "375", "8",false,false,params);


function changeLinks(){
    //aMod_popup() ;
    aMod_externalLink();
    // imgMod_align();
}

function aMod_popup(){
	 var as,i,islink;
    // grab all links, loop over them;
    as=document.getElementsByTagName('a');
    for(i=0;i<as.length;i++){
        // check which link has a coord attribute, and send this one to popup
        var re = /\d[x]\d/;
        var coord = as[i].getAttribute('coords');         
        if(coord!='' && re.test(coord) == true){
            as[i].setAttribute('coords','');
            var split = coord.split('x');
            var w = split[0];
            var h = split[1];
            var link = as[i].getAttribute('href'); 
            as[i].setAttribute('onclick',"return openWin('"+link+"',"+w+","+h+")"); 
        }
    }
}

function aMod_externalLink(){    
    var as,i,islink;
    // grab all links, and loop over them
    as=document.getElementsByTagName('a');
    for(i=0;i<as.length;i++){
        // take the link's href
        islink=as[i].href; 
        // and check if it contains the current location 
        var host = new String(window.location.hostname);
        rExp = /www./gi;
        domain = host.replace(rExp, "");

        if(islink.indexOf(domain)==-1 && islink.indexOf('javascript:')==-1){
            if(!as[i].getAttribute('title'))as[i].setAttribute('title',islink);
            as[i].setAttribute("target","_blank"); 
        } 
    }
}
///////////////////////////////// SCRIPTS //////////////////////////////////////

if(document.getElementById && document.createTextNode){
    window.onload=changeLinks;
}  



//]]>
