//
function fCrtPage(url, containerid)
{
	var page_request = false;
	
	if (window.XMLHttpRequest) // if Mozilla, Safari etc
	{
		page_request = new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{ // if IE
		try 
		{
			page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e)
		{
			try
			{
				page_request = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e)
			{
			}
		}
	}
	else
	{
		return false
	}
	
	page_request.onreadystatechange=function()
	{
		loadpage(page_request, containerid)
	}
	page_request.open('GET', url, true)
	page_request.send(null)
}

function loadpage(page_request, containerid)
{
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
	{
		document.getElementById(containerid).innerHTML='...';
		document.getElementById(containerid).innerHTML=page_request.responseText;
	}
}	

function fCollection(c)
{
	document.getElementById('collection_data').innerHTML='Loading ...';
	fCrtPage('_inc/collection.php?'+c, 'collection_data');
}

function fLargeImage(i,w,h)
{
	if(w=='')
	{
		w=450;
		h=450;
	}
  	wImg = window.open("landmark-wimage.php?img="+i,"wImg","width="+Number(w)+",height="+Number(h)+",statusbar=1,toolbar=1");
  	wImg.focus();	
}

function fLargeImageStone(i,w,h)
{
	if(w=='')
	{
		w=450;
		h=450;
	}
  	wImg = window.open("natural-stone-wimage.php?img="+i,"wImg","width="+Number(w)+",height="+Number(h)+",statusbar=1,toolbar=1");
  	wImg.focus();	
}



function fLargeImagePhoto(i)
{
	w=600;
	h=450;

  	wImgP = window.open("landmark-wphoto.php?img="+i,"wImgP","width="+Number(w)+",height="+Number(h)+",statusbar=1,toolbar=1");
  	wImgP.focus();	
}


function getParameter(str, name) {
  var res = "";
  if (str.indexOf("?")!=-1) {
    str = str.substring(str.indexOf("?")+1, str.length);
    if (str.indexOf(name)!=-1) {
      if (str.indexOf("&"+name, str.indexOf(name)+name.length)!=-1)
        res = str.substring(str.indexOf("&"+name)+name.length+1, str.indexOf("&"+name))
   	  else
        res = str.substring(str.indexOf(name)+name.length+1, str.length);
      if (res.indexOf("&")!=-1)
        res = res.substring(0,res.indexOf("&"));
   	}
  }
  return res;
}

function fBigImg(imageName, width, height)
{
	width = width+25;
	height =height+25;
		
	wImg = window.open("wimage.htm?path="+imageName+"&width="+width+"&height="+height,"_blank","width="+Number(width)+",height="+Number(height)+",statusbar=1,toolbar=no,scrollbars=0,navbar=no");
  	wImg.focus();
}






function fTTCalculator(f)
{
	if(f==0)
	{
		document.getElementById('ttcalculus').style.display = 'none';
	}
	else
	{
		document.getElementById('ttcalculus').style.display = '';
		
		ttsq = parseFloat(document.frm.ttsq.value)
		ttsa = parseFloat(document.frm.ttsa.value)
		ttav = parseFloat(document.frm.ttav.value)
		
		if(!(ttsq>0)) 	ttsq = 0
		if(!(ttsa>0)) 	ttsa = 0
		if(!(ttav>0)) 	ttav = 0
		
		document.frm.ttpanels.value = ttsq / 16
		document.frm.ttadhesive.value = ttsq / 16
		document.frm.ttmortar.value = ttsq / 80
		document.frm.ttangler.value = ttsa / 10
		document.frm.ttairvent.value = ttav / 8
	}
}


