var qsParm = new Array();
function qs() {
	var query = window.location.search.substring(1);
	var parms = query.split('&');
	for (var i=0; i<parms.length; i++) {
		var pos = parms[i].indexOf('=');
		if (pos > 0) {
			var key = parms[i].substring(0,pos);
			var val = parms[i].substring(pos+1);
			qsParm[key] = val;
		}
	}
	
	if(qsParm['id'] != null) {
		togglePic(qsParm['id']+"00",12);
	}
}

function toggleMainPic(){
	document.getElementById("triggerControl"+(Math.floor(Math.random()*7)+1)).className="clearfix showIt";
}

function toggle(id)
{
	if(document.getElementById(id).className=="hide")
	{
		document.getElementById(id).className="show";
		document.getElementById("triggerControl"+id).className="minus";
	}
	else
	{
		document.getElementById(id).className="hide";
		document.getElementById("triggerControl"+id).className="plus";
	}
}

function togglePic(id,count){
	for (i = 1; i < count+1; i++) {
	//	document.getElementById(i+'00').className = "hide"; 
		document.getElementById("triggerControl"+i+"00").className="";
	}
	//document.getElementById(id).className="show";	
	document.getElementById("triggerControl"+id).className="selected";
}

function toggleText(id,count){
	for (i = 1; i < count+1; i++) {
		document.getElementById(i+'00').className = "hide"; 
		document.getElementById("triggerControl"+i+"00").className="";
	}
	document.getElementById(id).className="show";	
	document.getElementById("triggerControl"+id).className="selected";
}

function clearAll(count){
	for (i = 1; i < count+1; i++) {
		document.getElementById(i+'00').className = "hide"; 
		document.getElementById("triggerControl"+i+"00").className="";
	}
}

function showPic (thumb,whichpic,count, set) 
{
	if (document.getElementById)
	{ 
		//alert(thumb.substring(6));
		curIndex = parseInt(thumb.substring(6));
		document.getElementById('placeholder'+set).src = whichpic.href;
		for (i = 1; i < count+1; i++)
			document.getElementById('thumb'+set+i).className = "off"; 
		document.getElementById(thumb).className = "on"; 
		return false; 
	}
	else 
	{ 
		return true; 
	} 
}

function picRotator(picCount,indexChange)
{
	if(curIndex==1 && indexChange < 0)
		curIndex = picCount;
	else if(curIndex==picCount && indexChange > 0)
		curIndex = 1;
	else
		curIndex = curIndex+indexChange;
	
	showPic('thumb1'+curIndex,document.getElementById('thumb1'+curIndex),picCount,1);
	//alert(curIndex);
	//document["placeholder1"].src = document.getElementById("thumb1" + curIndex).href;
	//togglePic(curIndex,44);
	//curIndex = curIndex + indexChange;
	//alert(curIndex);
	//if(indexChange>0)
	//{	
		//alert(document.getElementById("thumb12").href);
		//document["placeholder1"].src = document.getElementById("thumb12").href;
		//alert(document.getElementById("placeholder1").src);
	//}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])?args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

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 show_options(model){
	config=window.open("config/"+model, "config", "toobar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=816,height=612");
	//config=window.open("http://taurus.lunarpages.com/~tryarc2/MR/config/"+model, "config", "toobar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=816,height=612");
	//config=window.open("http://www.marmolradzinerprefab.com/config/"+model, "config", "toobar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=816,height=612");
	//config=window.open("http://www.tryarc.com/MR/config/"+model, "config", "toobar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=816,height=612");
}

function show_features(model){
	//config=window.open("full-features-mod"+model+".html", "features"+model, "toobar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=500,height=550");
	config=window.open("features.html", "features"+model, "toobar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=500,height=550");
}

function show_instructions(){
	config=window.open("../design/instructions.html", "instructions", "toobar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=482,height=220");
}

function show_invite(){
	invite=window.open("invite.html", "invite", "toobar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=550,height=460");
}

function show_video(){
	invite=window.open("marvid1.html", "video", "toobar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=430,height=360");
}

function press_pop(page){
	invite=window.open(page, "press", "toobar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=700,height=500");
}

function enlarge(model,pic){
	enlarge=window.open("images/model"+model+"/lg/"+pic+".jpg","model"+model+pic, "toobar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=600,height=394");
}

function enlargeInProgress(loc,pic,w,h){
	enlarge=window.open("images/portfolio/"+loc+"/"+pic+".jpg","house_"+loc+pic, "toobar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width="+w+",height="+h);
}

function markSelected(selected){
	document.getElementById("thumb1").className = "off"
	document.getElementById("thumb2").className = "off"
	document.getElementById("thumb3").className = "off"
	
	document.getElementById("thumb"+selected).className = "on"
}
