// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = false;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

function viewPic(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block" alt="'+imageTitle+'"></body></html>');
close();		
}
//imgWin.moveTo((screen.width-document.images[0].width)/2, (screen.height-document.images[0].height)/2);
imgWin.focus();
}

/*
function viewPic(url, title) {
    if (url == '') return false;
    width = 300;
    height = 100;
    window_top = (screen.height - height) / 2;
    window_left = (screen.width - width) / 2;
    win = window.open(url, 'image', 'width='+width+', height='+height+', top='+window_top+', left='+window_left+',toolbar=no,scrollbars=no,resizable=yes');
    win.document.open();
    win.document.write('<html><head><title>'+title+'</title>');
    win.document.write('<' + 'script language="Javascript"> ');
    win.document.write('function body_on_load() {window.document.getElementById("text").innerHTML = ""; document.getElementById("photo").style.display = "block"; window.resizeTo((document.images.photo.width+30),(document.images.photo.height+60)); window.moveTo((screen.width-document.images.photo.width)/2, (screen.height-document.images.photo.height)/2); window.focus(); }</'+'script>');
    win.document.write('</head><body leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0 marginwidth=0 marginheight=0 onload="body_on_load()">');
    win.document.write('<center><span id="text"><br>Идет загрузка изображения...</span><a href="javascript:window.close();"><img id="photo" src="'+url+'" style="display:none" border="0"></a></center>');
    win.document.write('</body></html>');
    win.document.close();    
}
*/
function viewURL(url, width, height, scroll) {
    if (url == '')   return false;
    if (width == null) width = 640;
    if (height == null) height = 480;

    if (scroll == null) scroll = 0;
    win = window.open(url, '', 'width='+width+', height='+height+', toolbar=0, statusbar=0, location=0, scrollbars='+scroll+', resizable=0');
    win.moveTo((screen.width-width)/2, (screen.height-height)/2);
}

function select(){
    var id = document.select_bank.bank.value;
        var item_1_o=document.getElementById("item_1");
    if(item_1_o != null){
        item_1_o.innerHTML = a[id]['d_purchase']; 
    }
    var item_2_o=document.getElementById("item_2");
    if(item_2_o != null){
        item_2_o.innerHTML = a[id]['d_sale']; 
    }
        var item_3_o=document.getElementById("item_3");
    if(item_3_o != null){
        item_3_o.innerHTML = a[id]['e_purchase']; 
    }
    var item_4_o=document.getElementById("item_4");
    if(item_4_o != null){
        item_4_o.innerHTML = a[id]['e_sale']; 
    }                
}
 
function GoToUrl(nameForm)
{
    var id = document.select_bank.bank.value;
    var urlPath  = '/go/' + id;
    
    if (urlPath == "") {
        return false;
    } else {
         return window.location = urlPath;
    }
}
