try { console.log(''); } catch(e) { console = { log: function() {} } }
//console.log=function(){};

var photos = [
"1.png",
"2.png",
"3.png",
"4.png",
"5.png",
"6.png",
"7.png",
"8.png",
"9.png",
"10.png",
"11.png",
"12.png"
];

var descs = [
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
];

var heights = [
275,
275,
275,
275,
275,
275,
275,
275,
275,
275,
275,
275
];

var nc = 2; //photos per row
var w = 180; 
var h = 138; 


function getGalleryHTML(){
    var np = photos.length;
    var nr = Math.ceil(np/nc);
    console.log(np);
    console.log(nr);
    
    var count = 0;
    var str="<table cellpadding='0' cellspacing='8' border='0' width='93%'>";
    
    for(var i=0;i<nr;i++){
        str+="<tr>";
        for(var j=0;j<nc;j++){
            if(count==np)
                break;
            str+="<td class='gallery_slot'><a style='border:0;' href='show-tour.html?i="+count+"'><img style='cursor:pointer;' title='"+descs[count]+"' width='"+w+"' src='mov/"+photos[count]+"'/ onclick='loadTourViewer("+count+");' class='thumb_photo' onmouseover='this.className=\"photo_hover_fix\";' onmouseout='this.className=\"thumb_photo\";' align='right'/></a></td>";
            count++;
        }
        str+="</tr>";
    }
    str+="</table>";
    return str;
}
function loadTourViewer(i){
    window.location.href='show-tour.html?i='+i;
}
//i: index into photo name array
//container: div to hold the photo
function elem(id){
    return document.getElementById(id);
}

function insertQTMovie(src){
    document.write('<objectid=player" width="363" height="288" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab">\n');
    document.write('<param name="src" value="mov/'+src+'.mov" />\n');
    document.write("<embed name='player' src='mov/"+src+".mov' width='363' height='288' pluginspage='http://www.apple.com/quicktime/download/'> </embed>");
    document.write('</object>\n<p/>');
}

function gup(name)
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}