/* ========================================================================
    common.js written by Simon Holmes, Design Motive
    Copyright 2004 Design Motive Ltd
	http://www.designmotive.co.uk/
   ======================================================================== */ 


// DEFINE GLOBAL VARIABLES AND SET UP SOME STANDARD DOM VAR'S
var showh, showv, structure, viseq, closingb, active, displayB, displayI, displayN, diseq;
docimg = "document.images.";
showh = "'hidden'";
showv = "'visible'";
displayB = "'block'";
displayI = "'inline'";
displayN = "'none'";
classH = "'hidden'";
classV = "'visible'";
classV2 = "'visibleb'";

structure = "document.getElementById('";
viseq = "').style.visibility = ";
diseq = "').style.display = ";
classq = "').className = ";
closingb = "')";


function testElement(id)
{
 test = eval(structure +id + closingb);
 if (!test) {return false;}
 return true;
}

function showHideLayer(lyrid,state)
{
 if (!testElement(lyrid)) {return false;}
 var strVis = ((state == 1) ? displayB : displayN);
 eval(structure + lyrid + diseq + strVis)
}

function fn_NotYet()
{alert("Sorry, this page hasn't been constructed as part of this demonstration");}

function fn_elementDisplay(strID,state)
{
 if (!testElement(strID)) {return false;}
 var strDisp = ((state == 1) ? displayB : displayN);
 eval(structure + strID + diseq + strDisp)
}

function fn_elementDisplay1(strID,strID2,state)
{
 if (!testElement(strID)) {return false;}
 if (!testElement(strID2)) {return false;}
 
 var strDisp = ((state == 1) ? classH : classV);
 var strDisp2 = ((state == 1) ? classV : classH);
 
 eval(structure + strID + classq + strDisp)
 eval(structure + strID2 + classq + strDisp2)
}

function fn_elementDisplay2(strID,strID2,state)
{
 if (!testElement(strID)) {return false;}
 if (!testElement(strID2)) {return false;}
 
 var strDisp = ((state == 1) ? classH : classV);
 var strDisp2 = ((state == 1) ? classV2 : classH);
 
 eval(structure + strID + classq + strDisp)
 eval(structure + strID2 + classq + strDisp2)
}

function get_cookie(cookie_name)
{
 var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );
 if ( results )
  {return true;}
 else
  {return false;}
}

function addLocalCookie(pid)
{
 document.cookie = "AMSTAEzinePoll"+pid+"=True;expires=16/07/2012 00:00:00";
}

function checkLocalCookie(pid)
{
 alert("hello");
 var tmpbln = get_cookie("AMSTAEzinePoll"+pid);
 return tmpbln
}

function openPoll(pid)
{
 window.open ("http://www.projectmotive.co.uk/Amadeus/STA/eZine/PollIframe.asp?PollID="+pid,'AmadeusPoll','width=180,height=430');
}