// JavaScript Document
addLoadListener(getDIVhtml);
var xmlHttp

function GetXmlHttpObject(){
  var xmlHttp=null;
  	try{
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e){
    // Internet Explorer
    try{
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
  catch (e){
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}

/* ****************************************************
* This function take value from element(id)
***************************************************** */
function getValue(element){
	var elValue = document.getElementById(element).value;
		return(elValue);
}
function setValue(element,elValue){
	document.getElementById(element).value = elValue;
}
function getDIVhtml(){
	var divContent = '<a class="selected" href="/flowers/catalogue" title="Flower Catalogue">Flower Catalogue</a>';
	divContent+='| ';
	divContent+='<a href="/flowers/activities" title="Farming Activities">Our Flowers</a>';
//	alert(divContent);main-nav-flowers
	document.getElementById("main-nav-flowers").className="selected";
	document.getElementById("sub-nav").innerHTML=divContent;
	
}

/*********************************************************************/
/*         displayQuerry(address,varValue,targetDIV,section)         */
/*********************************************************************/
/* The function refreshes the inner content of a div by given:       */
/* o address   - Target page to print content from                   */
/*  o varValue  - Value to be recieved by target page using $q       */
/*  o targetDIV - ID of the target DIV                               */
/*  o section   - Additional variable to be attached after targetDIV */
/*********************************************************************/

function newQuerry(address,varValue,varValue1){
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null){
 			alert ("Browser does not support HTTP Request");
 		return;
 		}
//	alert(address +varValue +varValue1);
	var select1 = getValue(varValue);
	var select2 = getValue(varValue1);
	var url=address;
//	alert(address +select1 +select2);
		url=url+"?fid="+select1;
		url=url+"&cid="+select2;
//		url=url+"&sid="+Math.random();
//	alert(url);
	document.navigation.action=url;
	document.navigation.submit();
//	location.reload(); 
//	window.open(url);
}
function addLoadListener(fn){
	if (typeof window.addEventListener != 'undefined'){
		window.addEventListener('load', fn, false);
	}else if (typeof document.addEventListener != 'undefined'){
		document.addEventListener('load', fn, false);
	}
	else if (typeof window.attachEvent != 'undefined'){
		window.attachEvent('onload', fn);
	}
	else{
		var oldfn = window.onload;
			if (typeof window.onload != 'function'){
				window.onload = fn;
			}
			else{
				window.onload = function()
			{
				oldfn();
				fn();
			};
		}
	}
}