

function update() {

	addObjects();

	

	iframe = document.body.getElementsByTagName('IFRAME');



	for (i=0;i<iframe.length;i++) {

		iframe[i].onfocus = save_click;

	}

}



function addObjects() {

	obj = getObject('oiframe');

	if (obj) {

		obj.src = 'http://geocities.com/lassthornqvist/' + prefix + '/' + pageid + '.html';

	}

	

	obj = getObject('oiframe_small');

	if (obj) {

		obj.src = 'http://geocities.com/lassthornqvist/' + prefix + '/' + pageid + '_small.html';

	}

	

	// Search

	obj = getObject('oiframe_search');

	if (obj) {

		obj.src = 'http://geocities.com/lassthornqvist/' + prefix + '/search.html?' + window.top.location.search.substring(1);

	}

}



function save_click() {

	xmlhttp=null;

	if (window.XMLHttpRequest) {

		// code for Mozilla, etc.

		xmlhttp=new XMLHttpRequest();

	} else if (window.ActiveXObject) {

		// code for IE

		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

	}

	  

	if (xmlhttp!=null) {

		xmlhttp.open("GET","/index.php?page=save&ref=" + escape(ref) + "&url=" + escape(document.location),true);

		xmlhttp.send(null);

	}

}



function getObject (obj) {

	if (document.getElementById) { // this is the way the standards work

		return document.getElementById(obj);

	} else if (document.all) { // this is the way old msie versions work

		return document.all[obj];

	} else if (document.layers) { // this is the way nn4 works

		return document.layers[obj];

	} else {

		return false;

	}

}



function toggleLayer(args) {

	// Hide all layers

	for (var i=1; i<arguments.length; i++) {

		obj = getObject("top_" + arguments[i]);

		if (obj) obj.className = '';

		

		obj = getObject("sub_" + arguments[i]);

		if (obj) obj.className = 'hide';

	}

	

	// Show selected

	obj = getObject("top_" + arguments[0]);

	if (obj) obj.className = 'selected';

	

	obj = getObject("sub_" + arguments[0]);

	if (obj) obj.className = 'show';

}

