// mobysoft javascript

function textSize(s){
	var b = document.getElementsByTagName('body')[0];
	switch(s){
		case '0':
			b.style.fontSize = "0.8em";
			break;
		case '1':
			b.style.fontSize = "1em";
			break;
		case '2':
			b.style.fontSize = "1.2em";
			break;
		default:
			b.style.fontSize = "0.8em";
			break;
	}
	cookieMaker('mobytextsize',s);
}

function initTextSize(){
	if(c=cookieVal('mobytextsize')){
		textSize(c);
	}
}

function cookieMaker(myName,textsize){
	document.cookie=myName+'='+textsize+'; path=/';
}

function cookieVal(cookieName){
	var thisCookie=document.cookie.split("; ");
	if(thisCookie.length>0){
		for (cook=0; cook<thisCookie.length; cook++){
			if (cookieName==thisCookie[cook].split("=")[0]){
				return thisCookie[cook].split("=")[1];
			}
		}
	}
}



// slideshow fix
if(document.addEventListener){window.addEventListener("load", fixsafari, false); }else 
if(document.attachEvent){window.attachEvent("onload", fixsafari);}

function fixsafari(){
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("safari") != -1){ 
		theObjects = document.getElementsByTagName("object");
		for (var i = 0; i < theObjects.length; i++) {
			if(theObjects[i].parentNode.className == "duoflash"){	
				for (j=0;j<theObjects[i].childNodes.length;j++){
					if(theObjects[i].childNodes[j].name=="Src"){
						var data=theObjects[i].childNodes[j].value;
					}
				}
			if(data.match(/slideshow.swf/i)){
				var height=theObjects[i].height;
				var width=theObjects[i].width;
				var classid=theObjects[i].classid;
				var codebase=theObjects[i].codebase;
				var htmlData = theObjects[i].parentNode.innerHTML;
				var newHtml='<object data="'+data+'" width="'+width+'" height="'+height+'" classid="'+classid+'" codebase="'+codebase+'" >  <param name="AllowFullScreen" value="true" /> <param name="WMode" value="Opaque" /></object>';
				var newObject=theObjects[i].parentNode;
				newObject.innerHTML=newHtml;
			}
			}
		}
	}
}

function mailThisUrl() {
	var initialsubj="I thought you may find this interesting";
	var initialmsg="I saw this and thought you may find it interesting: "+window.location	
	window.location = "mailto:?subject="+initialsubj+"&body="+initialmsg
}

