function OpenPopUp(url,width,height){
    window.open(url,"FootBo","width="+width+",height="+height);
}

function makeEmailLink(name,domain, innerHtml){
     var em= name + String.fromCharCode(64) + domain;
     document.write('<a href="mai' + 'lto:' + em + '">' + innerHtml + '</a>');
}
function TextBoxSetDirty(){
    var browserName=navigator.appName;
    if (browserName=="Netscape")
    { 
        var theEvent = arguments.callee.caller.arguments[0];
        theEvent.target.style['color'] = 'red';
    }
    else 
    { 
     if (browserName=="Microsoft Internet Explorer")
     {
        var theEvent = window.event.srcElement.style['color']='red';
     }
     else
       {
        //TODO:Opera
       }
    }
}
function showFlash (url, width, height, wmode)
{
    document.write(
	    '<object name=myFlashMovie classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'> '+
	    '<param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+url+'" /><param name="quality" value="high" /><param name="wmode" value="'+wmode+'" /><param name="menu" value="false" />  '+
	    '<embed src="'+url+'" quality="high" width="'+width+'" height="'+height+'" wmode="'+wmode+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> '+
	    '</object>'
    );
}
//function DetectNEnterOnSearch(txt,e)
//{
//    var characterCode;
//    if(e && e.which) // NN4 specific code
//    {
//        e = e;
//        characterCode = e.which;
//    }
//    else
//    {
//        e = event
//        characterCode = e.keyCode; // IE specific code
//    }
//    if (characterCode == 13) //// Enter key is 13
//    {
//        e.returnValue=false;
//        e.cancelBubble = true;
//        window.location = "/NodesPages/Misc/SearchResults.aspx?q="+txt;
//    }
//    else return false;
//}

function eventChar(e)
{
    var characterCode;
    if(e && e.which) // NN4 specific code
    {
        e = e;
        characterCode = e.which;
    }
    else
    {
        e = event
        characterCode = e.keyCode; // IE specific code
    }
    return characterCode;
}


/**
 * DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
// Declaring valid date character, minimum year and maximum year
var dtCh= ".";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31;
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;}
		if (i==2) {this[i] = 29;}
   } 
   return this
}

function isDate(dtStr,errID){
    var errLbl = document.getElementById(errID);


	var daysInMonth = DaysArray(12);
	var pos1=dtStr.indexOf(dtCh);
	var pos2=dtStr.indexOf(dtCh,pos1+1);
	var strDay = dtStr.substring(0,pos1);
	var strMonth=dtStr.substring(pos1+1,pos2);
	var strYear=dtStr.substring(pos2+1);
	strYr=strYear;
	if (strDay.charAt(0)=="0" && strDay.length>1) { strDay=strDay.substring(1); }
	if (strMonth.charAt(0)=="0" && strMonth.length>1) { strMonth=strMonth.substring(1); }
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) { strYr=strYr.substring(1); }
	}
	month=parseInt(strMonth);
	day=parseInt(strDay);
	year=parseInt(strYr);
	if (pos1==-1 || pos2==-1){
	    errLbl.innerHTML = "The date format should be : mm/dd/yyyy";
	    errLbl.style.display = "block";
		//alert("The date format should be : mm/dd/yyyy");
		return false;
	}
	if (strMonth.length<1 || month<1 || month>12){
	    errLbl.innerHTML = "Please enter a valid month";
	    errLbl.style.display = "block";
		//alert("Please enter a valid month");
		return false;
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
	    errLbl.innerHTML = "Please enter a valid day";
	    errLbl.style.display = "block";
		//alert("Please enter a valid day");
		return false;
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
	    errLbl.innerHTML = "Please enter a valid 4 digit year between "+minYear+" and "+maxYear;
	    errLbl.style.display = "block";
		//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear);
		return false;
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
	    errLbl.innerHTML = "Please enter a valid date";
	    errLbl.style.display = "block";
		//alert("Please enter a valid date");
		return false;
	}
return true;
}

function ValidateForm(){
	var dt=document.frmSample.txtDate;
	if (isDate(dt.value)==false){
		dt.focus();
		return false;
	}
    return true
 }
 
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_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];}
}

