setAjaxDiv("left");
setGoogleAnalyticsID("UA-4418450-32");





function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}

function checkIEVersion()
{
  var ver = getInternetExplorerVersion();

  if ( ver > -1 && ver < 7.0 )
  {
    window.location.href="http://www.kafertech.com/upgrade";
  }
  
}

checkIEVersion();




function setColor( vs_color ) {

	document.getElementById("bgImage").className = ( vs_color + "BG" );
	document.getElementById("left").className = vs_color;
	
//	for ( n_index = 0; n_index < document.getElementById("subnav").childNodes.length; n_index++ ) {
//
//		try {
//			document.getElementById("subnav").childNodes.item(n_index).style.display = "none";
//		} catch (err) {}
		
//	}
	
//	document.getElementById("subnav-" + vs_color).style.display = "block";
	
	
	
}


var io_current_popup_navigation_menu = null;

function zxcPos(obj){
 
 var rtn=[obj.offsetLeft,obj.offsetTop];

 while(obj.offsetParent!=null){

     var objp=obj.offsetParent;
    //rtn[0]+=objp.offsetLeft-objp.scrollLeft;
    //rtn[1]+=objp.offsetTop-objp.scrollTop;

    rtn[0]+=objp.offsetLeft
    rtn[1]+=objp.offsetTop
    obj=objp;
 }

 //rtn[1] = rtn[1] + window.pageYOffset;

 return rtn;
}



function popupNavigation( vo_target ) {

        if ( io_current_popup_navigation_menu != null ) {
            popdownNavigation();
        }

        n_test = zxcPos(vo_target);

	n_x = n_test[0]  //vo_target.offsetLeft;
	n_y = n_test[1]  //vo_target.offsetTop;

        //alert(n_y);


        n_height = vo_target.offsetHeight;
        n_width = vo_target.offsetWidth;

        o_nodes = vo_target.childNodes;

        for ( n_index = 0; n_index < o_nodes.length; n_index++ ) {

            if ( o_nodes.item(n_index) instanceof Object || typeof o_nodes.item(n_index) == "object" ) {

                if ( o_nodes.item(n_index).className == "subNavigation" ) {

                    io_current_popup_navigation_menu = o_nodes.item(n_index);

                    io_current_popup_navigation_menu.style.top = n_y + n_height  + "px";
                    io_current_popup_navigation_menu.style.left = n_x + "px";
                    io_current_popup_navigation_menu.style.display = "block";

                    if ( io_current_popup_navigation_menu.offsetWidth < n_width ) {
                        io_current_popup_navigation_menu.style.width = n_width + "px";
                    }

                }


            }

        }


        document.onmouseover = function(event) {

            event = event || window.event;

            n_cords = zxcPos(io_current_popup_navigation_menu);

            n_mouse_y = ( event.clientY + window.pageYOffset );

           // alert( "mouse_y = " + n_mouse_y + " ||  n_y = " + n_y + " || bottom of popup = " + ( n_cords[1] + io_current_popup_navigation_menu.offsetHeight ) );

            if ( event.clientX < n_cords[0] || event.clientX > (n_cords[0] + io_current_popup_navigation_menu.offsetWidth) ||
                n_mouse_y < n_y || n_mouse_y > ( n_cords[1] + io_current_popup_navigation_menu.offsetHeight ) ) {

                popdownNavigation();

            }

        }

}

function popdownNavigation() {

        if ( io_current_popup_navigation_menu != null ) {
            io_current_popup_navigation_menu.style.display = "none";

            document.onmouseover = null;
        }

}



function fbShare(vs_url) {

    vs_url = "http://www.facebook.com/sharer.php?u=" + encodeURIComponent(vs_url);

    window.open(vs_url,'fb_share_window','width=600,height=400,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no');


}
