// a rel="external"
function externalLinks() {
	if (!document.getElementsByTagName) return;
		var anchors = document.getElementsByTagName('a');
		for (var i=0; i < anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute('href') && anchor.getAttribute('rel') == 'external') anchor.target = '_blank';
	}
}


// Execute the command if key pressed is action key (space|return|enter)
// e.g. onclick="myFunction();" onkeyup="actionClick(this.onclick);"
function whichKey(e){
	var code;
    if(!e) var e=window.event;
    if(e.keyCode){code=e.keyCode;}
    else if(e.which){code=e.which;}
	action = (code==13||code==32) ? true : false;
}
function actionClick(args){if(action && args)eval(args)}

// Default values in input boxes
function defaultVals(){
	var inputs = document.getElementsByTagName('input');
	var txtareas = document.getElementsByTagName('textarea');
	var obj;

	for(var i=0;i<inputs.length;i++){
		if((obj=inputs[i]) && obj.getAttribute('type')=='text' && obj.className.match(/userinput/gi)){
			obj.onfocus = function(){if(this.value=='*') this.value='';}
			obj.onblur = function(){if(!this.value.replace(/\s+/,'')) this.value='*';}
		}
	}
	for(i=0;i<txtareas.length;i++){
		if((obj=txtareas[i]) && obj.className.match(/userinput/gi)){
			obj.onfocus = function(){if(this.value=='*') this.value='';}
			obj.onblur = function(){if(!this.value.replace(/\s+/,'')) this.value='*';}
		}
	}
}
document.onkeydown = whichKey;

// List of Works
function works(){
	if(document.getElementById('list-of-works')){
		var so2 = new SWFObject("/images/listofworks.swf", "listofworks", "716", "100%", "7", "#fff");
		so2.write("list-of-works");
	}
}
// Homepage quotes
function homepage(){
	var so = new SWFObject("/images/homepage.swf", "swf2", "592", "405", "7", "#f0f0f0");
	so.write("quotes");
}