var int_cloud_left=new Array(16); int_cloud_left[0]=-150; int_cloud_left[1]=-150; int_cloud_left[2]=-150; int_cloud_left[3]=-150; int_cloud_left[4]=-150; int_cloud_left[5]=-150; int_cloud_left[6]=-150; int_cloud_left[7]=-150; int_cloud_left[8]=-150; int_cloud_left[9]=-150; int_cloud_left[10]=-150; int_cloud_left[11]=-150; int_cloud_left[12]=-150; int_cloud_left[13]=-150; int_cloud_left[14]=-150; int_cloud_left[15]=-150; var int_cloud_speed=new Array(16); var str_i=0; int_cloud_speed[0]=0; int_cloud_speed[1]=0; int_cloud_speed[2]=0; int_cloud_speed[3]=0; int_cloud_speed[4]=0; int_cloud_speed[5]=0; int_cloud_speed[6]=0; int_cloud_speed[7]=0; int_cloud_speed[8]=0; int_cloud_speed[9]=0; int_cloud_speed[10]=0; int_cloud_speed[11]=0; int_cloud_speed[12]=0; int_cloud_speed[13]=0; int_cloud_speed[14]=0; int_cloud_speed[15]=0; function func_init() { func_loaddata("_data/home.php?nocache="+Math.random(),"init","content"); func_reset_cloud('0'); func_reset_cloud('1'); func_reset_cloud('2'); func_reset_cloud('3'); func_reset_cloud('4'); func_reset_cloud('5'); func_reset_cloud('6'); func_reset_cloud('7'); func_reset_cloud('8'); func_reset_cloud('9'); func_reset_cloud('10'); func_reset_cloud('11'); func_reset_cloud('12'); func_reset_cloud('13'); func_reset_cloud('14'); func_reset_cloud('15'); func_feature(); } function func_feature() { func_loaddata("_modules/feature.php?nocache="+Math.random(),"","featured"); setTimeout("func_feature();",20000); } function func_anim_cloud(int_id) { if (int_cloud_left[int_id]>600) { func_reset_cloud(int_id); int_cloud_left[int_id]=-150; } else { document.getElementById('cloud'+int_id).style.left=int_cloud_left[int_id]+"px"; int_cloud_left[int_id]+=int_cloud_speed[int_id]; setTimeout("func_anim_cloud('"+int_id+"')",50); } } function func_reset_cloud(int_id) { int_cloud_top=Math.round(Math.random()*250)-90; int_cloud_zindex=Math.round(Math.random()*10); int_cloud_wait=Math.round(Math.random()*6000); int_cloud_speed[int_id]=Math.round(Math.random()*3); setTimeout("func_anim_cloud('"+int_id+"')",int_cloud_wait); document.getElementById('cloud'+int_id).style.zIndex=int_cloud_zindex; document.getElementById('cloud'+int_id).style.top=int_cloud_top+"px"; document.getElementById('cloud'+int_id).style.left="-200px"; } function func_load(str_loadthis) { document.getElementById('loader').style.display="block"; func_loaddata("_data/"+str_loadthis+".php?nocache="+Math.random(),"","content"); document.getElementById('but_home').className=""; document.getElementById('but_about').className=""; document.getElementById('but_portfolio').className=""; document.getElementById('but_contact').className=""; document.getElementById('but_'+str_loadthis).className="selected"; str_char=str_loadthis.substring(0,1).toUpperCase(); document.title="John Ashley Martin - Portfolio - "+str_char+str_loadthis.substring(1); } function func_loaddata(str_url,str_init,str_id) { var xmlhttp=false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) // JScript gives us Conditional compilation, we can cope with old IE versions. // and security blocked creation of the objects. try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @end @*/ if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } xmlhttp.open("GET",str_url,true); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { document.getElementById(str_id).innerHTML=xmlhttp.responseText; document.getElementById('loader').style.display="none"; if (str_init=="init") { func_fade(100); } } } xmlhttp.send(null); } function func_portfolio(int_id) { document.getElementById('loader').style.display="block"; document.getElementById('but_home').className=""; document.getElementById('but_about').className=""; document.getElementById('but_portfolio').className="selected"; document.getElementById('but_contact').className=""; func_loaddata("_data/portfolio.php?id="+int_id+"&nocache="+Math.random(),"","content"); } function func_reset_portfolio() { document.getElementById('loader').style.display="block"; func_loaddata("_data/portfolio.php?nocache="+Math.random(),"","content"); } function func_window(str_url,str_name,str_attrs) { window.open(str_url,str_name,str_attrs); } function func_opacity(opacity) { obj=document.getElementById("starter"); opacity=(opacity==100)?99.999:opacity; obj.style.filter="alpha(opacity:"+opacity+")"; obj.style.KHTMLOpacity=opacity/100; obj.style.MozOpacity=opacity/100; obj.style.opacity=opacity/100; } function func_fade(opacity) { if (opacity>=0) { func_opacity(opacity); opacity-=5; setTimeout("func_fade("+opacity+")",10); } else { document.getElementById("starter").style.display="none"; } } function func_contact() { document.getElementById('input_submit').value="Sending data..."; document.getElementById('input_submit').disabled="disabled"; } function setActiveStyleSheet(title) { var i, a, main; for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { a.disabled = true; if(a.getAttribute("title") == title) a.disabled = false; } } } function getActiveStyleSheet() { var i, a; for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title"); } return null; } function getPreferredStyleSheet() { var i, a; for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title") ) return a.getAttribute("title"); } return null; } function createCookie(name,value,days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); document.cookie = name+"="+value+expires+"; path=/; domain=johnamartin.net"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } window.onload = function(e) { var cookie = readCookie("CSSstyle"); var title = cookie ? cookie : getPreferredStyleSheet(); setActiveStyleSheet(title); } window.onunload = function(e) { var title = getActiveStyleSheet(); createCookie("CSSstyle", title, 365); } var cookie = readCookie("CSSstyle"); var title = cookie ? cookie : getPreferredStyleSheet(); setActiveStyleSheet(title);