function breakoutOfFrames()
{
  if (top.location != location) {
    top.location.href = document.location.href ;
  }
}

var timer_id;
function scroll_iframe(frm,inc,dir) {
  if (timer_id) clearTimeout(timer_id);
  if (window.frames[frm]) {
    if (dir == "v") {
		window.frames[frm].scrollBy(0, inc);
		//window.frames[frm].document.images.frameImage.style.visibility = 'hidden';
		}
    else {
		window.frames[frm].scrollBy(inc, 0);
		}
    timer_id = setTimeout("scroll_iframe('" + frm + "'," + inc + ",'" + dir + "')", 20);
  }
}

function stopScroll() { if (timer_id) clearTimeout(timer_id); }

function create_email_address( username, thetext ) {
        var theurl = "coneywines.co.nz";
        var atsign = "&#64;";
        var address = username + atsign + theurl;
		var sometext = thetext
		if (thetext == "addr"){
			sometext = address;
			}
        document.write( 
          "<" + "a" + " " + "href=" + "mail" + "to:" + address + ">" + sometext + "<\/a>");
      }

function changeContent(id,shtml) {
   if (document.getElementById || document.all) {
      var el = document.getElementById? document.getElementById(id): document.all[id];
      if (el && typeof el.innerHTML != "undefined") el.innerHTML = shtml;
   }
}

function changeLink(id, linktext) {
   if (document.getElementById || document.all) {
      var el = document.getElementById? document.getElementById(id): document.all[id];
      if (el && typeof el.href != "undefined") el.href = linktext;
   }
}

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

// the flag that is sent is 1 for visable and 0 for hidden
function Vis(flag,elementName)
{
	var DHTML = (document.getElementById || document.all || document.layers);
	if (!DHTML) return;
	
	var x = new getObj(elementName);
	x.style.visibility = (flag) ? 'hidden' : 'visible'
}
// the flag that is sent is 1 for visable and 0 for hidden
function Sizing(flag)
{
	var DHTML = (document.getElementById || document.all || document.layers);
	if (!DHTML) return;
	
	var x = new getObj('tm');
	if (flag == 's'){
		x.style.width = 0;
		x.style.height = 0;
	}
	else{
		x.style.width = 150;
		x.style.height = 76;
	}
}


//Hiding and showing functions

//function hideDiv(theName) { 
//if (document.getElementById) { // DOM3 = IE5, NS6 
//document.getElementById(" + theName + ").style.visibility = 'hidden'; 
//} 
//else { 
//if (document.layers) { // Netscape 4 
//document." + theName +".visibility = 'hidden'; 
//} 
//else { // IE 4 
//document.all." + theName +".style.visibility = 'hidden'; 
//} 
//} 
//} 
//
//function showDiv(theName) { 
//if (document.getElementById) { // DOM3 = IE5, NS6 
//document.getElementById('" + theName +"').style.visibility = 'visible'; 
//} 
//else { 
//if (document.layers) { // Netscape 4 
//document." + theName +".visibility = 'visible'; 
//} 
//else { // IE 4 
//document.all." + theName +".style.visibility = 'visible'; 
//} 
//} 
//} 

