// JavaScript Document
function studJump(targ,selObj,restore){ 
	if (selObj.options[selObj.selectedIndex].value!="") {
  	eval(targ+".location='studbook.php?id="+selObj.options[selObj.selectedIndex].value+"'");
  	if (restore) selObj.selectedIndex=0;
	}
}

function searchJump(targ,selObj,restore,where){ 
	if (selObj.options[selObj.selectedIndex].value!="") {
  	eval(targ+".location='search.php?where="+where+"&this_offset="+selObj.options[selObj.selectedIndex].value+"'");
  	if (restore) selObj.selectedIndex=0;
	}
}

function jumpTo(targ,selObj,url,restore){ 
	if (selObj.options[selObj.selectedIndex].value!="") {
		//alert(url+"?id="+selObj.options[selObj.selectedIndex].value);
  	eval(targ+".location='"+url+"?id="+selObj.options[selObj.selectedIndex].value+"'");
  	if (restore) selObj.selectedIndex=0;
	}
}

function inputSire(selObj){
	if(selObj.options[selObj.selectedIndex].value!=""){
		objSplit=selObj.options[selObj.selectedIndex].value.split(":");
	document.horsedata.sire.value=objSplit[1];
	document.horsedata.sfr_no.value=objSplit[2];
	document.horsedata.sireid.value=objSplit[0];
	
	}
}
function inputDam(selObj){
	if(selObj.options[selObj.selectedIndex].value!=""){
		objSplit=selObj.options[selObj.selectedIndex].value.split(":");
	document.horsedata.dam.value=objSplit[1];
	document.horsedata.dfr_no.value=objSplit[2];
	document.horsedata.damid.value=objSplit[0];
	
	}
}

function delCheck() {
	if (confirm("Are you sure you want to delete this horse?")) {
		return true;
	}
	else {
		return false;
	}
}

function close_window() {
    window.close();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function custom_print() {
    if (document.all) {
        if (navigator.appVersion.indexOf("5.0") == -1) {
            var OLECMDID_PRINT = 6;
            var OLECMDEXECOPT_DONTPROMPTUSER = 2;
            var OLECMDEXECOPT_PROMPTUSER = 1;
            var WebBrowser = "<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>";
            document.body.insertAdjacentHTML("beforeEnd", WebBrowser);
            WebBrowser1.ExecWB(6, 2);
            WebBrowser1.outerHTML = "";
        } else {
            self.print();
        }
    } else {
        self.print();
    }
}