function createIframe(value)
{ 
        var Iframe = document.createElement('iframe'); 
                Iframe.id = 'Viewer'; 
                Iframe.name = 'Viewer'; 
                Iframe.src = 'Viewer.html'; 
                Iframe.style.height = '504'; 
                Iframe.style.width = '504'; 
                Iframe.style.border = '0px solid #ff0000'; 
                Iframe.style.position ="absolute";
                Iframe.style.zIndex = '3';
        var right=document.getElementById('right');
        var right1=right.firstChild; 
        right.insertBefore(Iframe,right1); 
} 


function destroyIframe()
{ 
var right=this.parent.document.getElementById('right');
var remove=this.parent.document.getElementById('right').firstChild;
right.removeChild(remove);
} 


function createpics(section)
{
var aPics=new Array();
var value=section;
var oPics=document.getElementById('left_picture_section');
var right=document.getElementById('right_picture_section');
if(oPics.hasChildNodes())
    {
        while(right.hasChildNodes())
        {   
        var oFirstR=right.firstChild;
        right.removeChild(oFirstR);
        }
        
        while(oPics.hasChildNodes())
        {
        var oFirst=oPics.firstChild;
        oPics.removeChild(oFirst);
        right.appendChild(oFirst);
        
        }
    }
for(var i=0;i<=2;i++)
{
    
    var current=i+1;
    aPics[i]= section + "/pic" + current + ".jpg";
    var oA=document.createElement("a");
    oA.id="pic" + current;
    var oImg = new Image('70','70');    
    oImg.src = aPics[i];
    oImg.title = "click to expand.";
    oImg.alt = "";
    oImg.onclick = function() { expand(this)}; 
    oA.appendChild(oImg);
    oImg.onerror=function () {fixme(this)};
    oImg.onload = oPics.appendChild(oA);  
   
}
}
function fixme(value)
{
value.src="error.jpg";
}

function expand(current)
{
var oPic=current;
var oCenter=document.getElementById('pic_viewer');
if(oCenter.hasChildNodes())
    {var oRemove=oCenter.firstChild;oCenter.removeChild(oRemove);}
var oA=document.createElement('a');
oA.target="_blank";
oA.href=current.src;
var oImg=new Image('300','300');
    oImg.src=oPic.src;
    oImg.title = "click to expand again.";
    oImg.alt = "";
//oImg.onclick = function() {toggle(this)};
oA.appendChild(oImg);
oImg.onload=oCenter.appendChild(oA);
}

function toggle(current)
{
var oCurrent=current;
var oBig=new Image(w,h);
oBig.src=oCurrent.src;
oBig.alt = "";
}

function remove(value)
{
current=value;
var giant=document.getElementById('giant');
document.body.removeChild(giant);
}