var letter="";

if (navigator.appName.indexOf("tscape") != -1) document.captureEvents(Event.KEYPRESS);

document.onkeypress = function (keyed) {
	input = (navigator.appName.indexOf("tscape") !=-1) ? keyed.which : event.keyCode;
	letter+=String.fromCharCode(input);
	if(letter=="login" || letter=="admin" ) {
		if ( typeof pid != 'undefined' ) location.href = "p-"+pid+".php?othertempl=login.php";
		else if ( typeof mid != 'undefined' ) location.href = "m-"+mid+".php?othertempl=login.php";
		else if ( typeof ch  != 'undefined' ) location.href = "index.php?ch="+ch+"&othertempl=login.php";
		else location.href = "index.php?othertempl=login.php";
	}
}

function win(theURL,winName,features) {
	window.open(theURL,winName,features);
}

function mail_to (subject,domainpart,localpart) {
	var hrefstr = 'mailto:' + localpart + "@" + domainpart;
	if ( subject != '' ) hrefstr = hrefstr + "?subject=" + subject;
	location.href = hrefstr;
}

function Trim(s) {
  while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r')) s = s.substring(1,s.length);
  while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r') || (s.substring(s.length-1,s.length) == '\t')) s = s.substring(0,s.length-1);
  return s;
}

$(function() {
	// this initialises the demo scollpanes on the page.
	$('#c2scroll').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 14,scrollbarWidth:15,maintainPosition:true,reinitialiseOnImageLoad:true});
	initPane();
});
initPane = function() {
	$('#c2scroll').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 14,scrollbarWidth:15,maintainPosition:true,reinitialiseOnImageLoad:true});
} 


window.onresize=initPane;
setInterval(initPane,100);
