document.onselectstart = function () { return false; } // disable user selection
document.oncontextmenu = function () { alert('- All rights reserved -\n\u00A92007'); return false; } // disable user rightclick
window.onresize = function () { location.reload(); } // refresh when resized to maintain layers position
var class0,v;
function chg_cls(obj) { //change navigation class on mouseover and mouseout
	with (obj) {
		v = attributes['class'].value;
		if (v.indexOf('On') < 1) {
			class0 = v;
			attributes['class'].value += 'Over';
			onmouseout = function () { attributes['class'].value = class0; }
		}
	}
}

function switchit() { //switch object display status (byID)
	var a = switchit.arguments;
	for(var i=0; i<a.length; i++) {
		with (document.getElementById(a[i]).style) {
			if (!display || display == 'none') {
				display = 'block';
			} else {
				display = 'none';
			}
		}
	}
}

function scrollit(obj) { //scroll object
	if (document.all&&!window.opera) {
		with (document.getElementById(obj)) {
			filters.revealTrans.Apply();
			switchit(obj);
			filters.revealTrans.Play();
		}
	} else {
		switchit(obj);
	}
}

var institutional = new Array('bezalel','modiincemetery','trumpeldor_pavilion','trumpeldormemorial','yaddavid','jerusalem','palasmemorial','haifalibrary');
var commercial = new Array('santateresa','shovofficebuilding','zichronioffice','aqua','seabreezespabar','kefarharuvspa','brouschette','lemongrassbar');
var housing = new Array('houseofarcs','benshetach','lilinblum14','hadoar8','michaelissq','nordao_elal','mohaliver35','in_progress');
var houses = new Array('privatesharon','pardozichronihouse','almoghouse','koresh1','efrathouse','kritzmanhouse','orenhouse','felzhouse');

var preLoader = new Array();
function initproj(allImg) { // initiate image gallery, more info box height and project nav controls (project page)
	document.getElementById('projtxt').style.height = document.getElementById('refheight').offsetHeight-32;
	document.getElementById('totalImg').innerHTML=allImg;
	for (var k=0; k<allImg; k++) {
		preLoader[k] = new Image;
		preLoader[k].src = "images/" + (k+1) + ".jpg"
	}
	var p=location.pathname,r;
	if (p.indexOf('\u005C')<0) r = '/'; else r = '\u005C';
	var l=p.split(r);
	var c=window[l[l.length-3]],n=l[l.length-2];
	for (var i=0; i<c.length; i++) if (c[i]==n) {
		var thisProj = i;
	}
	with (document.getElementById('projnavlt')) {
		if (thisProj == 0) {
			innerHTML='<div class="ltOff"></div>';
		} else {
			innerHTML='<div class="lt" title="previous project" onClick="MM_goToURL(\'parent\',\'../'+(c[thisProj-1])+'/index.html\');return document.MM_returnValue" onMouseOver="chg_cls(this)"></div>';
		}
	}
	with (document.getElementById('projnavrt')) {
		if (thisProj == c.length-1) {
			innerHTML='<div class="rtOff"></div>';
		} else {
			innerHTML='<div class="rt" title="next project" onClick="MM_goToURL(\'parent\',\'../'+(c[thisProj+1])+'/index.html\');return document.MM_returnValue" onMouseOver="chg_cls(this)"></div>';
		}
	}
}

var picnum = 1;
function imgNav(all,ind) { // navigate image gallery (project page)
	if (ind == 1) {
		picnum %= all;
		picnum ++;
	} else {
		picnum --;
		if (picnum == 0) picnum = all;
	}
	document.getElementById('thisImg').innerHTML = picnum;
	with (document.getElementById('bigpic')) {
		var s = preLoader[picnum-1].src;
		if(document.all&&!window.opera) {
			style.display = 'none';
			filters.blendTrans.apply();
			src = s;
			style.display = 'block';
			filters.blendTrans.play();
		} else {
			src = s;
		}
	}
}

var allpage;
function initpage(imgPage,allImg) { // initiate image array (general page)
	allpage = Math.ceil(allImg/imgPage);
	document.getElementById('totalPage').innerHTML = allpage;
}

var q,pagenum = 1;
function imgNavAr(ind) { // navigate image array (general page)
	if (ind == 1) {
		pagenum %= allpage;
		pagenum ++;
	} else {
		pagenum --;
		if (pagenum == 0) pagenum = allpage;
	}
	document.getElementById('thisPage').innerHTML = pagenum;
	for(var i=1; i<=imgPage; i++) {	
		q = (pagenum-1)*imgPage+i;
		if (q <= allImg) {
			with (document.getElementById('atd'+i)) {
				attributes['class'].value = 'generalImgTd';
			}
			with (document.getElementById('aimg'+i)) {
				var s = "images/profile/"+q+".jpg";
				if(document.all&&!window.opera) {
					style.display = 'none';
					filters.blendTrans.apply();
					src = s;
					style.display = 'block';
					filters.blendTrans.play();
				} else {
					src = s;
				}
			}
		} else {
			with (document.getElementById('atd'+i)) {
				attributes['class'].value = 'generalImgTdOff';
			}
			with (document.getElementById('aimg'+i)) {
				src="images/spacer.gif";
			}
		}
	}
}

function openPopUpWin(sPicURL) { //open big picture pop-up
  document.bigpicwin=window.open( "popup.html?"+sPicURL, "bigpicwin","LEFT=10,TOP=125,HEIGHT=1,WIDTH=1,RESIZABLE=1");
  document.bigpicwin.focus();
}

onunload = function() { if (document.bigpicwin!=null && !document.bigpicwin.closed) document.bigpicwin.close(); };

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
