// TOP MENU ITEMS
$(document).ready(function(){
    $("#nav-one li").hover(
        function(){ $("ul", this).fadeIn("fast"); }, 
        function() { } 
    );
    if (document.all) {
        $("#nav-one li").hoverClass ("sfHover");
    }
});

$.fn.hoverClass = function(c) {
    return this.each(function(){
        $(this).hover( 
            function() { $(this).addClass(c);  },
            function() { $(this).removeClass(c); }
        );
    });
}; 
// END TOP MENU ITEMS

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 openPopup(d,f,t,p,p2,w,h,m,s)
{
  if(t == 1)
   t = ".htm";
  else if(t == 2) 
   t = ".php";
  else if(t == 3) 
   t = ".pdf";
  
  if(p != "" && p2 != "")
   url = d+f+t+"?ref="+p+"&id="+p2; 
  else if(p != "")
   url = d+f+t+"?ref="+p;
  else if(p2 != "")
   url = d+f+t+"?id="+p2;
  else 
   url = d+f+t;
  window.open(url,"Details", "width="+w+", height="+h+", left=10, top=10, directories=0, location=0, menubar="+m+", scrollbars="+s+", status=0, toolbar=0, resizable=0");
}

function openSubmitTicket(url,d_id)
{
	window.open(url +"?d_id="+d_id,"","width=775,height=550, left=10, top=10, status=0, toolbar=0,location=no, menubar=0, resizable=yes, scrollbars=yes, directories=0 ");
}

function openwWindow(d,f,t,p,p2)
{
  if(t == 1)
   t = ".htm";
  else if(t == 2) 
   t = ".php";
  else if(t == 3) 
    t = ".pdf";
  
  if(p != "" && p2 != "")
   url = d+f+t+"?ref="+p+"&id="+p2; 
  else if(p != "")
   url = d+f+t+"?ref="+p;
  else if(p2 != "")
   url = d+f+t+"?id="+p2;
  else 
   url = d+f+t;
   
  window.open(url);
}

function openwWindow2(url,f)
{
	
  if( f == 1 )
   url = url + "downloads/4tierbrochure_bw.pdf";
  else if( f == 2 ) 
   url = url + "downloads/4tierbrochure_color.pdf";
  else if( f == 3 ) 
   url = url + "downloads/pricesheet.pdf";

  window.open(url);
}

function openMessage(p,w,h,m,s)
{
   url = "msg.php?ref="+p;
   window.open(url,"Message", "width="+w+", height="+h+", left=400, top=300, directories=0, location=0, menubar="+m+", scrollbars="+s+", status=0, toolbar=0, resizable=0");
}

function alertMessage()
{
	  $str = "I am sorry!\r\n\r\n";
	  $str += "This service or product can be purchased only through a Independent Business Consultant.\r\n";
	  $str += "Please contact the person who told you about us for more information.\r\n\r\n";
	  $str += "Thank you";
	  alert($str);
}

function submitOrder(param1,param2,param3,param4,param5)
{
  document.ordfrm.rep_id.value = param2;
  document.ordfrm.rep_fn.value = param3;	
  document.ordfrm.rep_ln.value = param4;
  document.ordfrm.rep_em.value = param5;
  document.ordfrm.action = param1;
  document.ordfrm.submit();
}

function submitKSearch()
{
  if(document.ksearchfrm.t_kwd.value == "")
  {
   alert("Please type Keyword\n\n eg:- Amoxicillin");
   return false;
  }
  else
  {
   return true;
  }
}

function submitPSearch()
{
  zip = document.psearchfrm.t_zip.value;
  var valid = "0123456789";
  if (zip.length!=5)
  {
   alert("Please enter your 5 digit zip code");
   return false;
  }
  for (var i=0; i < zip.length; i++) 
  {
    temp = "" + zip.substring(i, i+1);
    if (valid.indexOf(temp) == "-1") 
	{
     alert("Invalid characters in your zip code. Please try again.");
     return false;
	}
  }
  return true;
}

function opentourwindow1()
{
   url = "presentation/html/";
   window.open(url, "preview", "width=760, height=490, left=10, top=10, directories=0, location=0, menubar=0, scrollbars=0, status=0, toolbar=0, resizable=0");
}

function opentourwindow2()
{
   url = "presentation/flash/";
   window.open(url, "preview", "width=750, height=520, left=10, top=10, directories=0, location=0, menubar=0, scrollbars=0, status=0, toolbar=0, resizable=0");
}
function opentourwindow3(url)
{
   url = url + "/presentation/audio/";
   window.open(url, "preview", "width=493, height=229, left=10, top=10, directories=0, location=0, menubar=0, scrollbars=0, status=0, toolbar=0, resizable=0");
}


// Tab Script
var initialtab;
initialtab=[1, "sc1"];
function setTab()
{
  initialtab=[2, "sc2"]
}
var turntosingle=0 
var disabletablinks=0 
var previoustab=""

if (turntosingle==1)
document.write('<style type="text/css">\n#tabcontentcontainer{display: none;}\n</style>')

function expandcontent(cid, aobject){
if (disabletablinks==1)
aobject.onclick=new Function("return false")
if (document.getElementById){
highlighttab(aobject)
if (turntosingle==0){
if (previoustab!="")
document.getElementById(previoustab).style.display="none"
document.getElementById(cid).style.display="block"
previoustab=cid
}
}
}

function highlighttab(aobject){
if (typeof tabobjlinks=="undefined")
collecttablinks()
for (i=0; i<tabobjlinks.length; i++)
tabobjlinks[i].className=""
aobject.className="current"
}

function collecttablinks(){
var tabobj=document.getElementById("tablist")
tabobjlinks=tabobj.getElementsByTagName("A")
}

function do_onload(){
collecttablinks()
expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])
}

if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload
