
// status bar
// ==============================

window.status= ":: USA Seibukan Martial Arts Training Center ::"


// Window functions
// ==============================

function stopError() {
	return true;
	}
window.onerror = stopError;


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function P7_OpResizeFix(a) { //v1.1 by Project VII
if(!window.opera){return;}if(!document.p7oprX){
 document.p7oprY=window.innerWidth;document.p7oprX=window.innerHeight;
 document.onmousemove=P7_OpResizeFix;
 }else{if(document.p7oprX){
  var k=document.p7oprX-window.innerHeight;
  var j=document.p7oprY - window.innerWidth;
  if(k>1 || j>1 || k<-1 || j<-1){
  document.p7oprY=window.innerWidth;document.p7oprX=window.innerHeight;
  location.reload();}}}
}
P7_OpResizeFix();

function OpenLogin(theURL,winName,features, myWidth, myHeight, isCenter) {
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function window_map(){
      pop_up = window.open('pop_map.html','pop_up','height=550,width=650,top=10,left=10,screenX=10,screenY=10');
      pop_up.focus();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function close_window() {
    window.close();
}


// Date functions
// ==============================

function getDate() {
	var d=new Date()
	var dayname=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
	var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
	var year=d.getFullYear()
	year=year.toString()
	year=year.substring(2,4)

	document.write(dayname[d.getDay()] + ", ")
	document.write(monthname[d.getMonth()] + ". ")
	document.write("<b>"+d.getDate() + "</b> .")
	document.write(year)
}


// Image functions
// ==============================

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_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.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 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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


// Jump Menu functions
// =================================

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}


// Add to favorites
// ==============================

/* Add to Favorites / Bookmarks or Sidebar Script. v1.0
Copyright (c) 2003 dazdezines.com. All rights reserved.*/

function dd_uniBookmark() { //v1.0 www.dazdezines.com/mme
	if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')) {
    window.sidebar.addPanel ( document.title,'http://'+linkSidebar,'');
    /* Gecko (Netscape 6 etc.) - add to Sidebar */
	} else if( window.external && navigator.platform == 'Win32' ) {
    window.external.AddFavorite( location.href, titleText );
	} else if( window.opera && window.print ) {
    /* Opera 6+ - add as sidebar panel to Hotlist */
	return true;
	} else if( document.layers ) {
    /* NS4 & Escape - tell them how to add a bookmark quickly */
    window.alert( 'Please click OK then press Ctrl+D to create a bookmark.' );
	} else {
    /* other browsers - tell them to add a bookmark (adds current page, not target page) */
    window.alert( 'Please use your browser\'s bookmarking facility to create a bookmark\r\rPlease email dwsupport@dazdezines.com telling us your\rbrowser type and version so that we can update this script\rto add support for your browser.\r\rThankyou for your support and help.' );
	}
  return false;
}

var ns6LnkText = "Add our Sidebar"; //ns6+
var ie4LnkText = "Add to Favorites"; //ie4+
var op6LnkText = "Bookmark & Add to Hotlist"; //op6+
var ns4LnkText = "Bookmark this page"; //ns4+
var LinkURL = "javascript:;";
var linkSidebar = "www.usaseibukan.com/sidebar.html" //ns6+
var titleText = "USA Seibukan"; //ie4+ & op6+

if (typeof window.sidebar == "object" /* NS6+ */ ) { linkText = ns6LnkText; }
else if (window.external /* IE4+ */ ) { linkText = ie4LnkText; }
else if (window.opera /* OP6+ */ ) { linkText = op6LnkText; }
else { linkText = ns4LnkText ; /* NS4+ & Unknown */ }
if (window.opera) { lnkURL = document.location.href;
} else { lnkURL = LinkURL; }

function mOver() {
self.status='Click here now to visit this site'; return true;
}
function mOut() {
self.status=''; return true;
}

/* automatically set all links to use link frameset */
d = document.links; f = "file:"; j = "javascript:"; m = "mailto:"; t = "extLinks";
for (i = 0; i < (d.length); i++)
if (d[i].protocol != f && d[i].protocol != j && d[i].protocol != m && d[i].hostname != document.domain) {
	d[i].title = "External link to " + d[i].href;
	d[i].onmouseover = mOver
	d[i].onmouseout = mOut
	d[i].href = fileLoc + 'lnkframe.htm?' + escape(d[i].href);
	d[i].target = t;
}



// Form functions
// ==============================

function firstFocus()
{
   if (document.forms.length > 0)
   {
      var TForm = document.forms[0];
      for (i=0;i<TForm.length;i++)
      {
         if ((TForm.elements[i].type=="text")||
           (TForm.elements[i].type=="textarea")||
           (TForm.elements[i].type.toString().charAt(0)=="s"))
         {
            document.forms[0].elements[i].focus();
            break;
         }
      }
   }
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}


// Email functions
// =================================

<form action="http://www.bluehost.com/bluemail" enctype="multipart/form-data" method="POST">
<input type="hidden" name="sendtoemail" value="info@usaseibukan.com"><<br>
<input type="submit" value="Send Email">
</form>


// generic cookie set/get
// ==============================

var expDays = 30;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}

function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

isMac = (navigator.appVersion.indexOf("Mac") != -1);
var goodBrowser = (document.getElementById && !isMac);


// bgcolorchanger
// ==============================

function theme(which){
SetCookie ('zd', which, exp);
if (goodBrowser){
document.body.style.backgroundColor="#"+which;
}else{
window.location.reload();
}
}

var favColor = GetCookie('zd');
if (favColor == null) {favColor = '000000';SetCookie('zd', favColor, exp);}
document.write("<style>");
document.write("body {background-color:#"+favColor+"}");
document.write("</style>");
