// function showimage()
// {
// if (!document.images)
// return
// document.images.avatar.src= 'images/avatar/' + document.Register.user_avatar.options[document.Register.user_avatar.selectedIndex].value
// }
// set no error to old browsers
function errorsuppressor(){
return true;
}
window.onerror=errorsuppressor;
// set img click filter events for Internet Explorer
if (document.all)
{
imgRotation = new Array();
imgIsFlipped = new Array();
imgIsInverted = new Array();
imgIsGray = new Array();
document.onclick = function()
{
var e = event;
var obj = event.srcElement;
if (obj.tagName.toUpperCase() == 'IMG')
{
if (e.shiftKey)
{
imgIsFlipped[obj.src] = imgIsFlipped[obj.src] ? 0 : 1;
if (!imgRotation[obj.src])
{
imgRotation[obj.src] = 1;
}
else
{
imgRotation[obj.src]++;
}
}
if (e.ctrlKey)
{
imgIsGray[obj.src] = imgIsGray[obj.src] ? 0 : 1;
}
if (e.altKey)
{
imgIsInverted[obj.src] = imgIsInverted[obj.src] ? 0 : 1;
}
obj.style.filter = ''
//+ (imgIsFlipped[obj.src] ? 'FlipV() FlipH() ' : '')
+ 'progid:DXImageTransform.Microsoft.BasicImage(rotation='+(imgRotation[obj.src]%4)+') '
+ (imgIsGray[obj.src] ? 'Gray() ' : '')
+ (imgIsInverted[obj.src] ? 'Invert() ' : '')
+ '';
//if (obj.parentElement.tagName.toUpperCase() == 'A' && (e.shiftKey || e.ctrlKey || e.altKey))
if (obj.parentElement.tagName.toUpperCase() == 'A' && (e.ctrlKey || e.altKey))
{
return false;
}
}
}
}
var msgWindow;
var maxText=50; // character length over-run limit
var minText=5;
var targetSubmit='http://www.google.com/search?hl=en&ie=UTF-8&q=';
function LTrim(str) {
// work left-to-right by eroding \s\t\n\r
// in multiple keyword highlights from left first
var whitespace = new String(" \t\n\r");
var s = new String(str);
if (whitespace.indexOf(s.charAt(0)) != -1) {
var j=0, i = s.length;
while (j < i && whitespace.indexOf(s.charAt(j)) != -1) j++;
s = s.substring(j, i);
}
return s;
}
function RTrim(str) {
// work right-to-left by eroding \s\t\n\r
// in multiple keyword highlights from right first
var whitespace = new String(" \t\n\r");
var s = new String(str);
if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
var i = s.length - 1;
while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) i--;
s = s.substring(0, i+1);
}
return s;
}
function Trim(str) {
// right-left excess cleaner
// should also need a case switch for internal white space '+'
// for some targets
return RTrim(LTrim(str.toLowerCase()));
}
function popup(find) {
// redirect this to other frame or window targets
self.name = "body";
msgWindow = window.open(targetSubmit + find, "displayWindow", "scrollbars=yes,resizable=yes,height=480,width=500,screenX=0,left=0,screenY=0,top=0");
msgWindow.onerror=null;
if (msgWindow.opener == null){
msgWindow.opener = content;
}
}
function display(e) {
// functional browser detection
if (document.getSelection) { // NS 4+ syntax
var str = document.getSelection();
} else if (document.selection && document.selection.createRange) { // IE5+ syntax
var range = document.selection.createRange();
var str = range.text;
} else { // out-of-luck below v.4
var str = "";
//alert("Sorry, event capture is not possible with your browser.");
return;
}
// escape any functional html or close parens
// so don't have any ( )) cases in raw text
str=""+escape(Trim(str));
// minMax highlight brackets
if (str.length > maxText ) {
status="You have selected a large amount of text. Try a smaller highlight.";
} else {
if (str.length > minText) {
if (window.event) {
var elm = window.event.srcElement
if ( typeof(elm.name) != "undefined" ) return;
}
popup(str);
}
}
}
/*-------------------------------
// Trigger on event
// MOUSEUP is Nav4+,IE4+
---------------------------------*/
if (window.Event) { document.captureEvents(Event.MOUSEUP); }
document.onmouseup = display;
/*
Draggable images
*/
var dragapproved=false
var z,x,y
function move(){
if (event.button==1&&dragapproved){
z.style.pixelLeft=temp1+event.clientX-x
z.style.pixelTop=temp2+event.clientY-y
return false
}
}
function drags(){
if (!document.all)
return
if (event.srcElement.className=="drag"){
dragapproved=true
z=event.srcElement
temp1=z.style.pixelLeft
temp2=z.style.pixelTop
x=event.clientX
y=event.clientY
document.onmousemove=move
}
}
document.onmousedown=drags
document.onmouseup=new Function("dragapproved=false")
//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div','td','tr','a');
//Specify spectrum of different font sizes:
var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz = 2;
function ts( trgt,inc ) {
if (!document.getElementById) return
var d = document,cEl = null,sz = startSz,i,j,cTags;
sz += inc;
if ( sz < 0 ) sz = 0;
if ( sz > 6 ) sz = 6;
startSz = sz;
if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];
cEl.style.fontSize = szs[ sz ];
for ( i = 0 ; i < tgs.length ; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
}
// hide broken images
function hideBroken() {
var showAlt = true;
ai = document.getElementsByTagName("img");
for (im=0; im < ai.length; im++) {
try {
if (ai[im].fileSize <= 0 && ai[im].src.match(".jpg$|.gif$|.png$|.bmp$")) {
if ( ai[im].alt != "" && showAlt ) {
ax = document.createTextNode("(" + ai[im].alt + ")");
ai[im].parentNode.insertBefore(ax, ai[im]);
}
ai[im].style.display = "none";
}
} catch (e) {}
}
}