//split URL, into URL and parameters
var params = document.location.href.split("?");
//document.write(""+params[0]+"")
var filename = /(\w*\.\w*)$/.exec(params[0]);
//document.write(""+filename[0]+"")

////////////////////////////////////////////////////////////////////////////////////////////
function getTitle(){

var locator = document.location.href.split("/");
for ($i=0; $i<10; $i++)
//document.write(""+locator[$i]+"")
	if (""+locator[$i]+"" == "carputer")
		{loc = "carputer"
		//document.write(""+loc+"")
		$i=10
		}
	else
		{loc = "cynian"
		//document.write("True")
		}


//document.write(""+loc+"")
if (loc == "carputer")
	{if (params[1])
		{var findArc = params[1].split("?")
	 		if (/(\w*\_archive.\w*)$/.exec(findArc[0]))
				{document.title = "Carputer Archive"
				}
				else if (/(\w*\#\w*)$/.exec(findArc[0]))
				{document.title = "Carputer Archive"
				}
	}
	else
	{document.title = "Carputer Pages"
	}

}
else if (loc == "cynian")
	{if (params[1])
		{var getridofhash = params[1].split("#")
		 var findArc = getridofhash[0].split("?")

	 		if (/(\w*\_archive.\w*)$/.exec(findArc[0]))
				{document.title = "Cyn&Ian Archive"
				 var titleofhtm = params[1].split("?")
				 var titleof = titleofhtm[0].split(".")
				 firstLetter = titleof[0].substring(0, 1).toUpperCase();
				 restOfWord = titleof[0].substring(1, titleof[0].length).toLowerCase();
				 archivePage = ""+firstLetter+""+restOfWord+""
				}

				else
				{
				 var getridofhash = params[1].split("#")
				 var titleof = getridofhash[0].split("?")
				 firstLetter = titleof[0].substring(0, 1).toUpperCase();

					
				 restOfWord = titleof[0].substring(1, titleof[0].length).toLowerCase();
						
				 document.title = ""+firstLetter+""+restOfWord+""
				}
	}
	else
	{document.title = "Cyn&Ian"
	}

}
}










/////////////////////////////////////////////////////////////////////////////////////////////
//
function getPicTitleBar(){

	if (filename == "finland.htm")
	pictitlebar = "here"
	

}

/////////////////////////////////////////////////////////////////////////////////////////////
//function to get correct pic label
function getPicLabel(){



	if (document.title == "Finland")
	{label = "The Chapel"
	 link = "album=1&pic=13"
	}
	else if (document.title == "Sailing")
	{label = "Three Spinnakers"
	 link = "album=5&pic=9"
	}
	else if (document.title == "Madrid")
	{label = "Puerto de Alcalá"
	 link = "album=9&pic=17"
	}
	else if (document.title == "Skiing")
	{label = "Panorama"
	 link = "album=11&pic=4"
	}
	else if (document.title == "England")
	{label = "Greenwich"
	 link = "album=7&pic=11"
	}
	else if (document.title == "Stencil")
	{label = "Puerto de Alcalá"
	 link = "album=3&pic0="
	}
	else if (document.title == "Chilli")
	{label = "Chilli Plants"
	 link = "album=15&pic=0"
	}
	else if (document.title == "Cyn&Ian")
	{label = "Plaza mayor"
	 link = "album=9&pic=18"
	}
	else if (document.title == "Cyn&Ian Archive")
	{label = "Plaza mayor"
	 link = "album=9&pic=18"
	}
	else if (document.title == "Carputer Pages")
	{label = "Carputer"
	 link = "album=&pic="
	}
	else if (document.title == "Carputer Archive")
	{label = "Carputer"
	 link = "album=&pic="
	}
	else
	{label = "Puerto de Alcalá"
	 link = "album=9&pic=17"
	}

document.write("<p class='time'><a href='pictemplate.htm?"+link+"' class='yellow'>"+label+"</a>");
}

/////////////////////////////////////////////////////////////////////////////////////////////
//function to get correct style
function getStylePage(){

	if ((document.title == "Cyn&Ian") || (document.title == "Cyn&Ian Archive"))
	{page = "index"
	}
	else if ((document.title == "Carputer Pages") || (document.title == "Carputer Archive"))
	{page = "carputer"
	}
	else 
	{page = document.title
	 page = page.toLowerCase()
	}


document.write("<LINK REL=StyleSheet HREF='style"+page+".css' TYPE='text/css' MEDIA=screen>");
}

///////////////////////////////////////////////////////////////////////////////////////////////
//function to get correct middle
function getLinkPage(){

	if (document.title == "Cyn&Ian")
	{middle = "body"
	}
	else if (document.title == "Cyn&Ian Archive")
	{middle = archivePage
	}
	else if ((document.title == "Carputer Pages") || (document.title == "Carputer Archive"))
	{middle = "body"
	}
	else 
	{page = document.title
	 middle = page.toLowerCase()
	}

	var findcontent = middle.split(":")
	if (findcontent[1]) 
	{middle = findcontent[1]
	}


//document.write(""+middle+"")
document.write("<span class='time'><script language='javascript' type='text/javascript' src='"+middle+".htm'></script></span>");

}
/////////////////////////////////////////////////////////////////////////////////////////////////
//function to get titletext
function getTitleText(){

	if ((document.title == "Cyn&Ian") || (document.title == "Cyn&Ian Archive") || (document.title == "Carputer Pages") || (document.title == "Carputer Archive"))
	{titext = "index"
	}
	else 
	{//folder = document.title
	 //folder = folder.toLowerCase()
	titext = document.title
	titext = titext.toLowerCase()
	}

topHtm = "top.htm"

	var findcontent = titext.split(":")
	if (findcontent[1])
	{titext = findcontent[1]
	}


document.write("<span class='date'><script language='javascript' type='text/javascript'src='./data/"+titext+""+topHtm+"'></script></span>");



}
/////////////////////////////////////////////////////////////////////////////////////////////////
//function to get top middle
function getTopLinkPage(){


	if ((document.title == "Cyn&Ian") || (document.title == "Cyn&Ian Archive") || (document.title == "Carputer Pages") || (document.title == "Carputer Archive"))
	{topbody = "body"
	}
	else 
	{//folder = document.title
	 //folder = folder.toLowerCase()
	//topbody = document.title
	}

document.write("<span class='time'><script language='javascript' type='text/javascript' src='./data/"+topbody+"top.htm'></script></span>");

}
/////////////////////////////////////////////////////////////////////////////////////////////////
//function to get bottom middle
function getBottomLinkPage(){

	if (document.title == "Cyn&Ian")
	{botlink = "search"
	}
	else if ((document.title == "Cyn&Ian Archive") || (document.title == "Carputer Archive"))
	{botlink = ""
	}
	else if (document.title == "Carputer Pages")
	{botlink = "searchcar"
	}
	else 
	{//folder = document.title
	 //folder = folder.toLowerCase()
	botlink = "bodybottom"
	botlink = botlink.toLowerCase()
	}

	var findFunnies = document.title.split(":")
	if (findFunnies[1])
	{botlink = "funniesbottom"
	 }


document.write("<span class='time'><script language='javascript' type='text/javascript'src='./data/"+botlink+".htm'></script></span>");



}

/////////////////////////////////////////////////////////////////////////////////////////////
function w(m) { // Write function.
m = "" + m + ""; //  Make sure that the m variable is a string.
if ("undefined" != m) { // Test for empty write or other undefined item.
   document.write(m);
   }
//document.write("<br>");
}
//Example
//w("This is an engraving of a horse.");

////////////////////////////////////////////////////////////////////////////////////////////////
//prints html code to display correct links for page
function getLinks(){

	if ((document.title == "Cyn&Ian") || (document.title == "Cyn&Ian Archive") || (document.title == "Carputer Pages") || (document.title == "Carputer Archive"))
	{folder = ""
	}
	else 
	{folder = document.title
	 folder = folder.toLowerCase()
	}

	var findcontent = folder.split(":")
	if (findcontent[1])
	{folder = findcontent[0]
	}

document.write("<span class='time'><script language='javascript' type='text/javascript'src='./data/"+folder+"links.htm'></script></span>");

}



////////////////////////////////////////////////////////////////////////////////////////////////
//e-mail escrambling function.
function escramblecyn(){
 var a,b,c,d,e,f,g,h,i
 a='<a href=\"mai'
 b='cynellem'
 c='\">'
 a+='lto:'
 b+='@'
 e='</a>'
 f='Cyn'
 b+='yahoo.co.uk'
 g='<img src=\"'
 h=''
 i='\" alt="Email us." border="0">'

 if (f) d=f
 else if (h) d=g+h+i
 else d=b

 document.write(a+b+c+d+e)
}

escramble()

function escrambleian(){
 var a,b,c,d,e,f,g,h,i
 a='<a href=\"mai'
 b='ian'
 c='\">'
 a+='lto:'
 b+='@'
 e='</a>'
 f='Ian'
 b+='cynian.net'
 g='<img src=\"'
 h=''
 i='\" alt="Email us." border="0">'

 if (f) d=f
 else if (h) d=g+h+i
 else d=b

 document.write(a+b+c+d+e)
}

escramble()
/////////////////////////////////////////////////////////////////////////////////////
function GetDay(intDay){
    var DayArray = new Array("Sunday", "Monday", "Tuesday", "Wednesday", 
                         "Thursday", "Friday", "Saturday")
    return DayArray[intDay]
    }

  function GetMonth(intMonth){
    var MonthArray = new Array("January", "February", "March",
                               "April", "May", "June",
                               "July", "August", "September",
                               "October", "November", "December") 
    return MonthArray[intMonth] 	  	 
    }
function getDateStrWithDOW(){
    var today = new Date()
    var year = today.getYear()
    if(year<1000) year+=1900
    var todayStr = GetDay(today.getDay()) + ", "
    todayStr += GetMonth(today.getMonth()) + " " + today.getDate()
    todayStr += ", " + year
    return todayStr
}
//////////////////////////////////////////////////////////////////////////////////////
function ReadFromFile()
{
 var fso, a, ForReading;
 ForReading = 1;
 fso = new ActiveXObject("Scripting.FileSystemObject");
 file = fso.OpenTextFile(archive.htm, ForReading, false);
  var name = file.readline();
  var password = file.readline();
 file.Close();
document.write("+password+")
}
//////////////////////////////////////////////////////////////////////////////////////
function getWeather(){


//<div id="container"</div>

//load xml file
if (window.ActiveXObject){
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=true; //Enforce download of XML file first. IE only.
}
else if (document.implementation && document.implementation.createDocument)
var xmlDoc= document.implementation.createDocument("","doc",null);
if (typeof xmlDoc!="undefined")
xmlDoc.load("http://www.cynian.net/weather/pagegrab.php?url=http://weather.interceptvector.com/weather.xml?id=U1BYWDAwNTA");

//Regular expression used to match any non-whitespace character
var notWhitespace = /\S/

function getdaily(){
//Cache "messages" element of xml file
var msgobj=xmlDoc.getElementsByTagName("weather")[0]

//REMOVE white spaces in XML file. Intended mainly for NS6/Mozilla
for (i=0;i<msgobj.childNodes.length;i++){
if ((msgobj.childNodes[i].nodeType == 3)&&
(!notWhitespace.test(msgobj.childNodes[i].nodeValue))) {
// that is, if it's a whitespace text node
msgobj.removeChild(msgobj.childNodes[i])
i--
}
}

//var dateobj=new Date()
//var today=dateobj.getDay() //returns 0-6. 0=Sunday
today=5

sky=document.getElementById("container").innerHTML=xmlDoc.getElementsByTagName("weather")[0].childNodes[14].firstChild.nodeValue
//sky='<img src="./data/icons/dust.gif">'
//Get today's message and display it in DIV:
document.getElementById("container").innerHTML="Temp. "+
xmlDoc.getElementsByTagName("weather")[0].childNodes[5].firstChild.nodeValue+"f - "+sky

}
document.write('<div id="container"</div>')
if (typeof xmlDoc!="undefined"){
if (window.ActiveXObject) //if IE, simply execute script (due to async prop).
getdaily()
else //else if NS6, execute script when XML object has loaded
xmlDoc.onload=getdaily
}
}
/////////////////////////////////////////////////
function changeImage(imgName)
 {
   if (document.images)
    {
      imgOn=eval(imgName + "on.src");
      document[imgName].src= imgOn;
    }
 }

function changeImageBack(imgName)
 {
   if (document.images)
    {
      imgOff=eval(imgName + "off.src");
      document[imgName].src= imgOff;
    }
 }
//////////////////////////////////////////////////
function loadImages(){
if (document.images)
   {
     pic2on= new Image(100,25);
     pic2on.src='./gifs/map/pisolarge.jpg';
     
     pic2off= new Image(100,25);
     pic2off.src='./gifs/map/piso.gif';     
   }
}
///////////////////////////////////////////////////
function getScreenSize(){
if (screen.height >= 768 && screen.width >= 1024) {
}
else {
if (screen.height == 600 && screen.width == 800) {
;
}
else {
;
   }
}
}