// JavaScript Document
<!--
browser = navigator.appName;
if(browser == "Netscape"){
	document.write('<link rel="stylesheet" href="../include/css/default_FF.css" />');
	///include/css/default.css
	//alert(browser);
}

$(document).ready(function(){
	
	
	//tool tips for map
	
	 
	 
	 var myNavBg = 'url(/Yara/yara/images/general/item_bg.gif) repeat-x 0% 7px'
	 
	
	$(".hasSubProducts").hover(function() {
		hideAllSubs();								
		$("#productCat").animate({opacity: "show", top: "0"}, "slow");
		$(this).css("background", myNavBg);
		//$(this).css("background", "#ff0000");
   	}, function() {
		$(this).css("background", myNavBg);
    });
	
	$(".hasSubSupport").hover(function() {
		hideAllSubs();	
		$("#subNavSupport").animate({opacity: "show", top: "0"}, "slow");
		$(this).css("background", myNavBg);
   	}, function() {
		$(this).css("background", myNavBg);
    });
	
	$(".hasSubMedia").hover(function() {
		hideAllSubs();	
		$("#subNavMediaCentre").animate({opacity: "show", top: "0"}, "slow");
		$(this).css("background", myNavBg);
   	}, function() {
		$(this).css("background", myNavBg);
    });
	
	$(".hasSubAbout").hover(function() {
		hideAllSubs();	
		$("#subNavAboutus").animate({opacity: "show", top: "0"}, "slow");
		$(this).css("background", myNavBg);
   	}, function() {
		$(this).css("background", myNavBg);
    });
	
	
	$(".noSub").hover(function() {
    	//$(this).append($("<span> ***</span>"));
		//$(this).css("color", "#ff0000");
		//var x = $(this).name();
		//alert(x);
		//productCat
		//lert("dd");
		//$("#productCat").animate({opacity: "show", top: "0"}, "slow");
		hideAllSubs();
		/*$("#productCat").animate({opacity: "hide", top: "0"}, "fast");
		$("#subNavAboutus").animate({opacity: "hide", top: "0"}, "fast");
		$("#subNavSupport").animate({opacity: "hide", top: "0"}, "fast");
		$("#subNavMediaCentre").animate({opacity: "hide", top: "0"}, "fast");*/
   	}, function() {
		
	
    	//$(this).find("span:last").remove();
		//$(this).css("background", "none");
    });
	
	
	//northern
	
	var defaultMap = '<img src="../images/general/ghana_map.gif" alt="Ghana Map" border="0" usemap="#Map" />';
	
	try{
	    $("#Map area").easyTooltip(); 
	}catch(x){}
	
	//show tool tip for distributors
	$(".distName span").hover(function() {

	}, function() {
		
	}).easyTooltip();
	
	 
	$(".distName").click(function() {
		$(this).next("div").toggle();
		//var x = $(this).html();
		//alert( $(this).html() );
		//$(this).html("go");
		// title="Click to show details."
		//$(this).
		//alert("make call/show details");
		
	});
	
	//Distributor Web Call
	$("#Map area").click( function(){
		$.ajax({
        type: "POST",
        url: "Distributor.aspx/GetDistributors",
        data: "{'regionid':'" + this.id + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg){
            $("#DistributorList").html(msg);
            
            //show tool tip for distributors
            $(".distName span").hover(function() {

            }, function() {
            	
            }).easyTooltip();

             
            $(".distName").click(function() {
	            $(this).next("div").toggle();
	            //var x = $(this).html();
	            //alert( $(this).html() );
	            //$(this).html("go");
	            // title="Click to show details."
	            //$(this).
	            //alert("make call/show details");
            	
            });
        }
        })
	});	
	
	//$("#northern").click(function() {
//		alert("make call");		  
//								  
//	});
	
	
	/*$("#northern").hover(function() {
		$("#map").html('<img src="../images/general/northern.gif" alt="Ghana Map" border="0" usemap="#Map" />');
	}, function() {
		$("#map").html(defaultMap);
	});
	
	
	
	$("#upperWest").hover(function() {
		$("#map").html('<img src="../images/general/upper_west.gif" alt="Ghana Map" border="0" usemap="#Map" />');
	}, function() {
		$("#map").html(defaultMap);
	});
	
	$("#upperEast").hover(function() {
		$("#map").html('<img src="../images/general/upper_east.gif" alt="Ghana Map" border="0" usemap="#Map" />');
	}, function() {
		$("#map").html(defaultMap);
	});
	
	$("#brong").hover(function() {
		$("#map").html('<img src="../images/general/brong.gif" alt="Ghana Map" border="0" usemap="#Map" />');
	}, function() {
		$("#map").html(defaultMap);
	});
	
	$("#ashanti").hover(function() {
		$("#map").html('<img src="../images/general/ashanti.gif" alt="Ghana Map" border="0" usemap="#Map" />');
	}, function() {
		$("#map").html(defaultMap);
	});
	
	$("#greaterAccra").hover(function() {
		$("#map").html('<img src="../images/general/greater_accra.gif" alt="Ghana Map" border="0" usemap="#Map" />');
	}, function() {
		$("#map").html(defaultMap);
	});
	
	
	$("#volta").hover(function() {
		$("#map").html('<img src="../images/general/volta.gif" alt="Ghana Map" border="0" usemap="#Map" />');
	}, function() {
		$("#map").html(defaultMap);
	});
	
	$("#eastern").hover(function() {
		$("#map").html('<img src="../images/general/eastern.gif" alt="Ghana Map" border="0" usemap="#Map" />');
	}, function() {
		$("#map").html(defaultMap);
	});
	
	$("#western").hover(function() {
		$("#map").html('<img src="../images/general/western.gif" alt="Ghana Map" border="0" usemap="#Map" />');
	}, function() {
		$("#map").html(defaultMap);
	});
	
	$("#central").hover(function() {
		$("#map").html('<img src="../images/general/central.gif" alt="Ghana Map" border="0" usemap="#Map" />');
	}, function() {
		$("#map").html(defaultMap);
	});*/
	
	
	
	//$(".distributors td a").hover(function() {
//		//alert("df");
//		$(this).next("em").animate({opacity: "show", top: "-75"}, "slow");
//	}, function() {
//		$(this).next("em").animate({opacity: "hide", top: "-85"}, "fast");
//	});
//	
//	
//	$("a").easyTooltip();
//	$("a#link").easyTooltip({
//		tooltipId: "easyTooltip2",
//		content: '<h4p>Some title</h4></p>Lorem ipsum dolor sit amet, <strong>consectetur</strong> adipiscing elit. Mauris placerat.</p>'
//	});

	

});


function hideAllSubs (){
	$("#productCat").animate({opacity: "hide", top: "0"}, "fast");
	$("#subNavAboutus").animate({opacity: "hide", top: "0"}, "fast");
	$("#subNavSupport").animate({opacity: "hide", top: "0"}, "fast");
	$("#subNavMediaCentre").animate({opacity: "hide", top: "0"}, "fast");
	
	$(".hasSubProducts").css("background", "#e7e6d2");
	$(".hasSubSupport").css("background", "#e7e6d2");
	$(".hasSubMedia").css("background", "#e7e6d2");
	$(".hasSubAbout").css("background", "#e7e6d2");
}

//-->
function showHide(line, ans) 
	{
		// hide all other faqs
		var elements = document.getElementsByTagName('div');
				
		for(var i = 0; i < elements.length; i++) {
    		if (elements.item(i).style.display == 'block'){
				elements.item(i).style.display = 'none';
			}
		}
		// show active faq
		if (document.getElementById(line)) 
		{
			document.getElementById(line).style.display = "block";
		} 
		if (document.getElementById(ans)) 
		{
			document.getElementById(ans).style.display = "block";
		} 
	}
	
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_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_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 OpenWindow ( url , title){
        	var win;
			win = window.open( url, title, 'toolbar=no,menubar=no,status=no,width=320,height=240,resizable=no,scrollbars=no' );
			if( win != null ) { win.creator = win; }
		}
function OpenLargeWindow ( url , title){
        	var win;
			win = window.open( url, title);
			if( win != null ) { win.creator = win; }
		}		
function OpenflvWindow ( url ,title){
         	var win;
			win = window.open( url, title, 'toolbar=no,menubar=no,status=no,width=600,height=500,resizable=no,scrollbars=no' );
			if( win != null ) { win.creator = win; }
		}		
