//find element

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;
  }
  
}

//-----------------------------------------------------------------
//change property

	function idoit(i1,iprop) {
         var myBox = new getObj(i1);

        if (document.all && !document.getElementById) {
			
                  myBox.style.visibility=iprop;
			
		}
    else if (document.getElementById && document.body.style) {
			
			divel=document.getElementById(i1);

			// using DOM HTML to set style properties. 
			divel.style.visibility=iprop;
			
		}
	}

//------------------------------------------------------------------
//swap z-index

var i2 = 'intro';

function swapz(i1) {

        
     var elem1 = new getObj(i2);

        if (document.all && !document.getElementById) {

		  elem1.style.overflow ='hidden';	
                  elem1.style.zIndex= -100;
                  	
		}
    else if (document.getElementById && document.body.style) {
			
			divel1=document.getElementById(i2);

			// using DOM HTML to set style properties. 
			
                        divel1.style.overflow ='hidden';
                        divel1.style.zIndex= -100;
        
}

         var elem = new getObj(i1);

        if (document.all && !document.getElementById) {
		if (elem.style.overflowY) {
               	 
                  elem.style.overflowY='auto';
                }
                else {
                 elem.style.overflow='auto';
                 }
		  elem.style.zIndex= +100;	
		}
    else if (document.getElementById && document.body.style) {
			
			divel=document.getElementById(i1);

			// using DOM HTML to set style properties. 
			
			divel.style.overflow='auto';
			divel.style.zIndex= +100;
		}

 //   alert (i2);
            
}



//-----------------------------------------------------------------
//insert iframe

   function writifr(id,loc)
{
    
     var scpt='javascript:idoit("flash1","visible");swapz("doc_blank");var i2 = "doc_blank";unwrit("submit")';

     var mailt="'mailto:feedback@davidsalkeld.co.uk'";

     var callit='javascript:writifr("submit","sign")';

     var callit2='javascript:writifr("submit","view")';

        if (loc == 'contact')
        {
            var address = "'submitmail.html'";
            var bod = "<div class='subtext'><h1>I welcome any feedback and will make every effort to answer all of your queries.<br><br>You can use the form on the right even if you do not have an e-mail account.<br><br> The fields are all optional but if you do not include an e-mail address or other contact details I will not be able to reply.<br><br><a href="+ mailt +">feedback@davidsalkeld.co.uk<\/a><br><br>Tel, voice-mail & fax- 0709 226 9051<br><br>";
            var styl= "'fram'";
       }
        else if (loc == 'view')
        {
            var address = "'guestbook/index.php'";
            var bod = "<div class='subtext'>";
            var styl= "'fram1'";
        }
        else if (loc == 'sign')
        {
            var address = "'http://davidsalkeld.users.btopenworld.com/sculpture_feedback.htm'";
            var bod = "<div class='subtext'><h1><a href="+ callit2 +">View the Guestbook</a><br><br>";
            var styl= "'fram'";
        }
        else {
             var address = "'"+ loc +"'";
             var bod = "<div class='subtext'><h1>";
             var styl=" fram'";
        }

    

    var text= bod +"</h1><h1><a href='"+ scpt +"'>Back to Main Menu<\/a><\/h1></div><div class="+ styl +"><iframe id='wind' name='wind' src="+ address +" width='100%' height='100%' frameborder='0' align='right' margin='0' scrolling='auto'>no iframes\<\/iframe></div>";

	if (document.getElementById)
	{
		x = document.getElementById(id);
		x.innerHTML = '';
		x.innerHTML = text;
      
	}
	else if (document.all)
	{
		x = document.all[id];
		x.innerHTML = text;
	}
	
}  

//------------------------------------------------------------------
//change iframe src

     function changeit()
{
       if (document.getElementById)
       {
                  y = document.getElementById('wind').src;
                y = 'http://davidsalkeld.users.btopenworld.com/email_feedback.htm';
	}
}

//------------------------------------------------------------------
//Clear iframe

         function unwrit(id)
{
     if (document.getElementById)
	{
		x = document.getElementById(id);
		x.innerHTML = '';
        }
              else if (document.all)
	{
		x = document.all[id];
                x.innerHTML = '';
        }
}
//--------------------------------------------------------------------
//Make Flash

function makeFlash(){
  flashNode1 ='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="495" height="550">';
  flashNode2= '<param name="movie" value="level_0.swf"> <param name="wmode" value="transparent"><!--[if !IE]> <--> <object data="level_0.swf" width="495" height="550" type="application/x-shockwave-flash">';
  flashNode3= '<param name="wmode" value="transparent">wmode="transparent" </object> <!--> <![endif]--> </object>';
document.getElementById('flash1').innerHTML=flashNode1+flashNode2+flashNode3;
}

function fixflash(containerID){
var flashContainer = document.getElementById(containerID);
var flashMovie = document.createElement("div");
flashMovie.innerHTML = flashContainer.innerHTML.replace(/</g, "<").replace(/>/g, ">");
flashContainer.parentNode.insertBefore(flashMovie, flashContainer);
flashContainer.parentNode.removeChild(flashContainer);
flashMovie.setAttribute("id",containerID);
}