


$(function() {$.prompt.setDefaults({loaded:function(){}, persistent:false, top:'12%', promptspeed:0, overlayspeed:0, opacity:0.7});});

// jQuery onready function - sets defaults for the jQuery Impromptu popups



function enlarge1(photo, width, height) {

// Writes enlarge link in main navigation menu

var link = '<a class="navmenu" href="javascript:void(0)" onclick="enlarge(\'' + photo + '\', ' + width + ', ' + height + ');" title="Enlarge Photograph">Enlarge</a>';
document.write(link);}



function enlarge2(photo, width, height) {

// Writes enlarge link at base of photograph

var link = '<a class="photo_larger" href="javascript:void(0)" onclick="enlarge(\'' + photo + '\', ' + width + ', ' + height + ');" title="Enlarge Photograph">+</a>';
document.write(link);}



function enlarge(photo, width, height) {

// Produces pop-up enlargement of a photograph

if (width == 306) {width = 497;}
if (width == 344) {width = 560;}
if (width == 458) {width = 746;}

if (height == 306) {height = 497;}
if (height == 344) {height = 560;}
if (height == 458) {height = 746;}

var divHeight = height + 4;
var divWidth = width + 28;

if ($(window).height()-75 < divHeight) {divHeight = $(window).height() - 75;}
if ($(window).width()-65 < divWidth) {divWidth = $(window).width() - 65;}

var borderWidth = divWidth + 28;

var HTML = '<div class="bigPhoto_topL" style="width:' + borderWidth + 'px;"><div class="bigPhoto_topR"><\/div><\/div>';
HTML += '<div class="pop_outer"><div class="pop_inner" style="height:' + divHeight + 'px; width:' + divWidth + 'px;"><img src="images/' + photo + '-Web-Extra-Large.jpg" width="' + width + '" height="' + height + '" alt="Photo Loading ..." \/><\/div><\/div>';
HTML += '<div class="bigPhoto_botL" style="width:' + borderWidth + 'px;"><div class="bigPhoto_botR"><\/div><\/div>';

HTML += '<a class="photo_smaller" href="javascript:void(0)" onclick="$.prompt.close();" title="Reduce Photograph">&#8722;<\/a>';

$.prompt(HTML, {prefix:'photo_pop', top:'10px'});}



function qG(ID) {return document.getElementById(ID);}

// Makes getting an element by ID easier



function newWindow(url) {var win = window.open(url); return false;}

// Opens a link in a new window and supresses the native link behaviour



function HideWindow(xid) {var item = qG(xid).style; item.visibility = 'hidden';}

// Hides a DOM element



function ShowWindow(xid) {var item = qG(xid).style; item.visibility = 'visible';}

// Shows a DOM element



function GetString(target) {$.post('RSSrandomtip.php', function(data) {qG(target).innerHTML = data;}, "json");}

// Uses jQuery AJAX to get a random photo tip from the archives and display it



function write_refresh() {

// Writes refresh button for tips archive page

var str = '';
str+='<h2 class="highlight">Random Photo Tip';
str+='<a class="white_button" ';
str+='href="javascript:GetString(\'randomtip\')" ';
str+='onMouseOver="document.getElementById(\'refresh\').src=(\'images/refresh2.gif\');"';
str+='onMouseOut="document.getElementById(\'refresh\').src=(\'images/refresh.gif\');"';
str+='title="New Random Photo Tip"><img src="images/refresh.gif" id="refresh" ';
str+='class="text-bottom" width="19px" height="16px" alt=">" ';
str+='title="New Random Photo Tip" \/>New<\/a><\/h2>';
document.write(str);}



function writeTool1() {

// Writes the first part of the RSS feed section of the RSS info page

var str='';
str+='<div class="tool_L">';
str+='<div style="padding:5px; border:1px solid #4F4F4F; background-color:#DDDDDD; width:300px; text-align:center;">';
document.write(str);}



function writeTool2() {

// Writes the second part of the RSS feed section of the RSS info page

var str='';
str+='<\/div>';
str+='<\/div>';
str+='<div class="tool_R">';
str+='<p>Add Daily Photo Tips to your website by copying and pasting the html code below.&#160; The tool\'s colour and size can be easily changed.&#160; The Daily Photo Tips tool will update itself once a day.<\/p>';
str+='<\/div>';
document.write(str);}



function Set_Cookie(name, value, expires, path, domain, secure) {

// Writes the contents of an input field to a cookie

var today = new Date();
today.setTime( today.getTime() );
if (expires) {
expires = expires * 1000 * 60 * 60 * 24; }
var expires_date = new Date(today.getTime() + (expires));
document.cookie = name + "=" +escape(value) +
((expires) ? ";expires=" + expires_date.toGMTString() : "" ) + 
((path ) ? ";path=" + path : "" ) + 
((domain) ? ";domain=" + domain : "" ) +
((secure) ? ";secure" : "" ); }



function Get_Cookie(check_name) {

// Fills the contents of an input field from a cookie

var a_all_cookies = document.cookie.split(';');
var a_temp_cookie = '';
var cookie_name = '';
var cookie_value = '';
var b_cookie_found = false;
for (i = 0; i < a_all_cookies.length; i++) {
a_temp_cookie = a_all_cookies[i].split('=');
cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
if (cookie_name == check_name) {
b_cookie_found = true;
if (a_temp_cookie.length > 1) {
cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') ); }
return cookie_value;
break; }
a_temp_cookie = null;
cookie_name = ''; }
if ( !b_cookie_found ) {
return ''; } }



function generate_address(username, hostname) {

// Generates an email address in an unusual way to make it harder for spam robots to parse

var domain = '.com';
var atsign = '&#64;';
var addr = username + atsign + hostname + domain;
document.write('<p class="bulletindent"><' + 'a' + ' ' + 'class=' + '"white"' + ' ' + 'href=' + 'mail' + 'to:' + addr + ' title="Email Me">' + addr + '<\/a><\/p>');}



function homepage() {

// Generates the HTML for the info button on the homepage

var strIND='';
strIND+='<a class="index" title="News and Information About MarkRaymondMason.com"';
strIND+='href="javascript:void(0)"';
strIND+='onMouseOver="document.getElementById(\'arrow\').src=(\'images\/arrow2.gif\');"';
strIND+='onMouseOut="document.getElementById(\'arrow\').src=(\'images\/arrow.gif\')"';
strIND+='onclick="$.prompt(qG(\'blurb\').innerHTML);">';
strIND+='<b>Info<\/b><img src="images\/arrow.gif" id="arrow" align="top" width="29px" ';
strIND+='height="16px" border="0" alt="^" title="News and Information About MarkRaymondMason.com" \/><\/a> | ';
document.write(strIND);}



function Java_Back(pages, style){document.write ('<a class="'+ style +'" href="javascript:history.back('+ pages +')" title="Go Back">Go Back</a>');}

// Writes a back button to return to a previous page



function lL(){

// Replaces the first letter of the intro text span with a larger fancy accent font image

var D = document.getElementById('D');
if (D){
var E = D.firstChild;
text = E.data;
while (text.substring(0,1) == ' ' || text.substring(0,1) == '\n' || text.substring(0,1)=='\t' || text.substring(0,1)=='\r'){
text = text.substring(1, text.length);}
letter='figures/d'+text.substr(0,1)+'.gif';
var image=document.getElementById('C');
image.src=letter;
image.alt=text.substr(0,1);
text = text.substr(1);
if (text.substring(0,1) == ' ') {D.style.paddingLeft = '7px';}
E.data = text;}}



function copyPop() {

// Writes the copyright popup screen on all pages in main site

var HTML = qG('copyright_pop').innerHTML;
var title = document.title;
HTML = HTML.replace('This document does not have a formal title', title);
$.prompt(HTML);}


