//counterref = "http://www.kenda.co.uk/cgi-bin/counter.pl?" + location.href;
//window.open(counterref,'counter','width=1,height=1,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');
function topdfcount()
{
	page = "http://www.kendata.com/topdfcounter.html";
	window.open(page,'topdfcounter','width=400,height=60,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');
}
//Script to make Info form only open once a day.
//Set the page to open
var page = "mform.html";
//Set the variables for the size of the marketing window
var windowprops = "width=240,height=280,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no";
//This function gets called by every page
function market() 
{									
	//check if cookie exists
	if (document.cookie =='') 
	{
	//if the does not exist run the write cookie function
	writeCookie();
	//then open the marketing form
	//window.open(page, "", windowprops);
	}
}

//This function is called by the market() function
function writeCookie() 
{
	//set the number of days ahead you wish the cookie to expire
	var expDays = 1
	//set a date expression as todays date
	var exp = new Date(); 
	//Set a Date the number of days set in expDays ahead of todays date (which you have set above)
	//you are setting the time of exp to be the number of miliseconds since 1970 plus the number of days set above
	exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
	//Convert the drivel which was returned above to a GMT date string
	var exp_date = exp.toGMTString();
	//Write the cookie string to expire
	var the_cookie = "my_cookie=kenda;expires=" + exp_date;
	//write the cookie
	document.cookie = the_cookie;
}
//  End of Cookie check

function formHandler(form){
	var URL = document.form.site.options[document.form.site.selectedIndex].value;
	if (URL =="") return false;
	window.location.href = URL;
}

function validemail() 
{
	var foundAt = document.zine.email.value.indexOf("@",0)
	var founddot = document.zine.email.value.indexOf(".",foundAt)
	if (foundAt < 1 || founddot < (foundAt+2)) 
	{
	alert("You have not entered a valid Email address");
	document.zine.email.select();
	return false;
	}
}

function setfocus(name)
{
  var e = document.getElementById(name);
  if (e)
	  e.focus();
}

function formHandler(form){
	var URL = document.form.site.options[document.form.site.selectedIndex].value;
	if (URL =="") return false;
	window.location.href = URL;
}

function popUp(file)
{
	var desktop = window.open(file, "_blank", "toolbar=no,location=no,status=yes,menubars=no,width=630,height=340,scrollbars=no,resizable=yes");
}

function popUp2(filename) 
{
	var desktop = window.open(filename, "_blank", "toolbar=yes,location=no,status=yes,menubar=yes,width=880,height=530,scrollbars=yes,resizable=yes");
}

function popUp3(filename) 
{
	var desktop = window.open(filename, "_blank", "toolbar=yes,location=no,status=yes,menubar=yes,width=810,height=600,scrollbars=yes,resizable=yes");
}

function popUp4(filename) 
{
	var desktop = window.open(filename, "_blank", "toolbar=yes,location=no,status=yes,menubar=yes,width=810,height=445,scrollbars=yes,resizable=yes");
}

function popUp4Bars(filename) 
{
	var desktop = window.open(filename, "_blank", "toolbar=no,location=no,status=no,menubar=no,width=610,height=404,scrollbars=no,resizable=no");
}

function popUpFlash(filename) 
{
	var desktop = window.open(filename + '.html', "_blank", "toolbar=yes,location=no,status=yes,menubar=yes,width=720,height=450,scrollbars=yes,resizable=yes");
}

function pagepop(name) 
{
	var desktop = window.open(name + '.html', "_blank", "toolbar=yes,location=no,status=yes,menubar=yes,width=630,height=450,scrollbars=yes,resizable=yes");
}

function pagepop2(name) 
{
	var desktop = window.open(name + '.html', "_blank", "toolbar=no,location=no,status=yes,menubars=no,width=650,height=300,scrollbars=yes,resizable=yes");
}
function getFileExtension(fileSource)
{
	var newSource = '';
	if (fileSource.lastIndexOf(".") != -1)
    {
		newSource = fileSource.substring(fileSource.lastIndexOf("."));
		}
	return newSource;
}

function sizeUp()
{					
	abc=document.getElementById("wrap");
	def=screen.availHeight;
	ghi=document.body.clientHeight;	
	jkl=355+(ghi-570);		
	if (ghi>570)
		abc.style.height=jkl;		
}
function SetClickHref(objid, href)
{
  var obj = document.getElementById(objid);
  obj.onclick=function(){popUp2(href);};
}
function switchIcon(pic, name, title)
{
var icon = document.getElementById(pic);
icon.src ="images/" + name + ".jpg";
if (typeof(title) != "undefined")
	{
	icon.alt = title;
	icon.title = title;
	}
}
//row = row number (zero based)
//col = col number to set color in (zero based)
//count = Num tds in a row
//hicolor = highlight col
//normcolor = normal color
var hilite="#00835f";var norm="#DDDDDD";
function switchHighlight(tbl, row, col, count, hicolor, normcolor)
{
var table = document.getElementById(tbl);
var cols = table.getElementsByTagName("td");   
var r = 0;
var c = 0;
for (var i = 0; i < cols.length; i++)           
		{
		if (c == col)	//Col number to change
			{
			if (r == row)   //Highlight
				{
				cols[i].style.backgroundColor=hicolor;
				//cols[i].style.fontWeight="bold";
				}
			else
				{
				cols[i].style.backgroundColor=normcolor;				
				//cols[i].style.fontWeight="normal";
				}
			}
		if (((i+1) % count) == 0)	//Next row!
			{
			r++;
			c=0;
			}
		else
			c++;
		}
}
function compress(compid, hidden, title1, title2, image, td)
{			
	var compressor = document.getElementById(compid);	
	/*if (compressor)
		alert("Yes");
	else
		alert("No");
	
	if (document)
		alert("Yes");
	else
		alert("No");
	
	if (typeof(compressor.style) == "undefined")
		alert("undefined");
	else
		alert(compressor.style.display);*/

	var hiddn = document.getElementById(hidden);			
	var t1 = document.getElementById(title1);
	var t2 = document.getElementById(title2);		
	var img = document.getElementById(image);
	var tds = document.getElementById(td);	
	
if (compressor && compressor.style.display == "none")
		{
		compressor.style.display = "block";
		hiddn.style.display = "none";		
		t1.style.display = "block";		
		t2.style.display = "block";
		t2.style.cssFloat = "left";
		img.src='btns/up2.gif';
		img.alt = "Collapse";
		img.title = "Collapse";
		}		
	else if (compressor && compressor.style.display == "block")
		{		
		compressor.style.display = "none";
		hiddn.style.display = "block";
		t1.style.display = "none";
		t2.style.display = "none";		
		img.src='btns/down2.gif';
		img.alt = "Expand";
		img.title = "Expand";
		}			
		var h = document.getElementById('container').offsetHeight;	
		if (h<450)
			h=450;	
		document.getElementById('middle').style.height = h + "px";
}

// BEGIN DW added JULY 2009
AttachEvent = function (obj, name, func)
{
  if (obj.addEventListener)
    {
    AttachEvent = function (obj, name, func)
      {
      obj.addEventListener(name, func, false);
      }
    }
  else if (obj.attachEvent)
    {
    AttachEvent = function (obj, name, func)
      {
      obj.attachEvent('on'+name, func);
      }
    }
  else
    {
    AttachEvent = function (obj, name, func)
      {
      obj['on'+name] = func;
      }
    }
  AttachEvent(obj, name, func);
}

function SetMinHeight(id, height)
{
  var obj = document.getElementById(id);
  if (obj && (obj.offsetHeight < height))
    obj.style.height=height+"px";
}
var divh = 420;
AttachEvent(window, "load", function () {SetMinHeight("middle", divh);});
// END DW added JULY 2009
