function GetQueryStringParam(name)
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}
function OnLoadHandler()
{
  var software  =GetQueryStringParam('software');
  var hardware  =GetQueryStringParam('hardware');
  var networking=GetQueryStringParam('networking');
  var webdesign =GetQueryStringParam('webdesign');
  var techtips  =GetQueryStringParam('techtips');
  var links     =GetQueryStringParam('links');
  var aboutus   =GetQueryStringParam('aboutus');
  var contactus =GetQueryStringParam('contactus');
  var coupons   =GetQueryStringParam('coupons');
  var pricing   =GetQueryStringParam('pricing');
  if(software!="")
    parent.frames[0].location.href='http://www.J-TownComputer.com/Software.htm?iframe=1'
  else if(hardware!="")
    parent.frames[0].location.href='http://www.J-TownComputer.com/Hardware.htm?iframe=1'
  else if(networking!="")
    parent.frames[0].location.href='http://www.J-TownComputer.com/Networking.htm?iframe=1'
  else if(webdesign!="")
    parent.frames[0].location.href='http://www.J-TownComputer.com/WebDesign.htm?iframe=1'
  else if(techtips!="")
    parent.frames[0].location.href='http://www.J-TownComputer.com/TechTips.htm?iframe=1'
  else if(aboutus!="")
    parent.frames[0].location.href='http://www.J-TownComputer.com/AboutUs.htm?iframe=1'
  else if(contactus!="")
    parent.frames[0].location.href='http://www.J-TownComputer.com/ContactUs.htm?iframe=1'
  else if(links!="")
    parent.frames[0].location.href='http://www.J-TownComputer.com/Links.htm?iframe=1'
  else if(coupons!="")
    parent.frames[0].location.href='http://www.J-TownComputer.com/Coupons.htm?iframe=1'
  else if(pricing!="")
    parent.frames[0].location.href='http://www.J-TownComputer.com/Pricing.htm?iframe=1'
  else
    parent.frames[0].location.href='http://www.J-TownComputer.com/Home.htm?iframe=1'
// Framed page loads automatically on refresh - this would cause it to load twice.
// var isRefresh=document.getElementById('isRefresh');
// if(isRefresh.value=='1')return;
// isRefresh.value='1';
//  parent.frames[0].location.href='http://www.J-TownComputer.com/Home.htm?iframe=1'
}
function AdjustIFrameSize(iframeWindow)
{
  if(iframeWindow.document.height)
  {
    var iframeElement=document.getElementById("MainIFrame");
    iframeElement.style.height=iframeWindow.document.height+'px';
    //iframeElement.style.width=iframeWindow.document.width+'px';
  }
  else if(document.all)
  {
    var iframeElement=document.all["MainIFrame"];
    if(iframeWindow.document.compatMode && iframeWindow.document.compatMode!='BackCompat')
    {
      iframeElement.style.height=iframeWindow.document.documentElement.scrollHeight+5+'px';
      //iframeElement.style.width=iframeWindow.document.documentElement.scrollWidth+5+'px';
    }
    else
    {
      iframeElement.style.height=iframeWindow.document.body.scrollHeight+5+'px';
      //iframeElement.style.width=iframeWindow.document.body.scrollWidth+5+'px';
    }
  }
}
function btnHome_Click()
{
  parent.frames[0].location.href='http://www.J-TownComputer.com/Home.htm?iframe=1'
}
function btnSoftware_Click()
{
  parent.frames[0].location.href='http://www.J-TownComputer.com/Software.htm?iframe=1'
}
function btnHardware_Click()
{
  parent.frames[0].location.href='http://www.J-TownComputer.com/Hardware.htm?iframe=1'
}
function btnNetworking_Click()
{
  parent.frames[0].location.href='http://www.J-TownComputer.com/Networking.htm?iframe=1'
}
function btnWebDesign_Click()
{
  parent.frames[0].location.href='http://www.J-TownComputer.com/WebDesign.htm?iframe=1'
}
function btnContactUs_Click()
{
  parent.frames[0].location.href='http://www.J-TownComputer.com/ContactUs.htm?iframe=1'
}
function btnAboutUs_Click()
{
  parent.frames[0].location.href='http://www.J-TownComputer.com/AboutUs.htm?iframe=1'
}
function btnTechTips_Click()
{
  parent.frames[0].location.href='http://www.J-TownComputer.com/TechTips.htm?iframe=1'
}
function btnLinks_Click()
{
  parent.frames[0].location.href='http://www.J-TownComputer.com/Links.htm?iframe=1'
}
function btnCoupons_Click()
{
  parent.frames[0].location.href='http://www.J-TownComputer.com/Coupons.htm?iframe=1'
}
function btnPricing_Click()
{
  parent.frames[0].location.href='http://www.J-TownComputer.com/Pricing.htm?iframe=1'
}
function getClockTime()
{
  var now   =new Date();
  var hour  =now.getHours();
  var minute=now.getMinutes();
  var second=now.getSeconds();
  var ap="AM";
  if(hour   > 11){ap    ="PM";         }
  if(hour   > 12){hour  =hour - 12;    }
  if(hour   == 0){hour  =12;           }
  //if(hour   < 10){hour  ="0" + hour;   }
  if(minute < 10){minute="0" + minute; }
  if(second < 10){second="0" + second; }
  var timeString = hour+':'+minute+':'+second+" "+ap;
  return timeString;
}
function GetDateTimeString()
{
  var now=new Date();
  var str=(now.getMonth()+1)+'/'+now.getDate()+'/'+now.getYear()+'<br/>'+getClockTime();
  document.write(str);
}
function GetPromptText()
{
  var promptText ="J-Town Computer Solutions";
  promptText="<DIV class=\"PromptTextCenter\">"+promptText+"</DIV>";
  document.write(promptText);
}
