﻿
function getSourceElement(evt) {
   if ( window.event) {
      return window.event.srcElement;
   } else {
      return evt.target;
   }
}

function mseOver (evt) {
	ths = getSourceElement(evt) ;
	ths.style.borderStyle = 'groove' ; //'ridge' ;
}

function mseDown (evt) {
	ths = getSourceElement(evt) ;
	ths.style.borderStyle = 'inset' ;
	ths.style.color = 'white' ;
}

function mseUp (evt,loc) {
	ths = getSourceElement(evt) ;
	if ( ths.style.borderStyle.substring(0,5) != 'inset' )
		return ;
	ths.style.borderStyle = 'outset' ;
	ths.style.color = 'black' ;
	if ( ths.getAttribute('hspLink') != null )
		document.location = ths.getAttribute('hspLink') ;
}

function mseOut (evt) {
	if ( ! getSourceElement )
		return ;
	ths = getSourceElement(evt) ;
	ths.style.borderStyle = 'outset' ;
}


//// THIS MUST BE EXECUTED AT THE BOTTOM OF <BODY>
function HspSetupHspDivs () {
	var allDivs = document.getElementsByTagName('DIV') ;
	for ( var idx=0; idx < allDivs.length; idx += 1 ) {
  	var div = allDivs[idx] ;
		if ( div.getAttribute('hspClass') == null )
			continue ;
		switch ( div.getAttribute('hspClass') )
		{
			case 'Button':
				div.onmouseover = mseOver ;
				div.onmousedown = mseDown ;
				div.onmouseup   = mseUp ; //function () {mseUp(div,'contest/form.htm');} ; // won't work in damn IE 6
				if ( div.getAttribute('hspLink') != null )
					div.onclick = null ;
				//else
				//	div.setAttribute('hspLink', div.onclick) ;
				div.onmouseout  = mseOut ; //function () { var fuckMs = new String; fuckMs=idx; mseOut(fuckMs); } ; // won't work in damn IE 6
				break ;
		}
	}
}
HspSetupHspDivs() ;


var clicky={init:function(){clicky.img=new Image();clicky.img_base="http://in.getclicky.com/in.php?site_id=17972&srv=db2&r="+Math.random();if(clicky.isset("clicky_custom_session")){for(i in clicky_custom_session){clicky.img_base+="&custom["+clicky.enc(i)+"]="+clicky.enc(clicky_custom_session[i]);}}var lang=navigator.appName=='Netscape'?navigator.language:navigator.browserLanguage;clicky.img.src=clicky.img_base+'&title='+clicky.enc(document.title)+'&href='+clicky.enc(location.pathname+location.search)+'&ref='+clicky.enc(document.referrer)+'&res='+screen.width+'x'+screen.height+'&lang='+lang.substr(0,2);clicky.add_event(window,"load",clicky.advanced);},isset:function(e){return(typeof(window[e])!="undefined");},enc:function(e){return encodeURIComponent(e);},img_src:function(e,type){obj=clicky.get_target(e);var txt=clicky.get_text(obj).substr(0,60);var href=clicky.get_href(obj);if(type=="download")href=href.replace(/^https?:\/\/([^\/]+)/i,"");clicky.img.src=clicky.img_base+"&type="+type+"&title="+clicky.enc(txt)+"&href="+clicky.enc(href);clicky.pause();},download:function(e){clicky.img_src(e,"download");},outbound:function(e){clicky.img_src(e,"outbound");},pause:function(){var now=new Date();var stop=now.getTime()+1000;while(now.getTime()<stop)var now=new Date();},get_text:function(e){do{var txt=e.text?e.text:e.innerText;if(txt)return txt;if(e.alt)return e.alt;if(e.title)return e.title;if(e.src)return e.src;e=clicky.get_parent(e);}while(e);return"";},get_href:function(e){do{if(e.href&&!e.src)return e.href;e=clicky.get_parent(e);}while(e);return"";},get_parent:function(e){return e.parentElement?e.parentElement:e.parentNode;},get_target:function(e){if(!e)var e=window.event;var t=e.target?e.target:e.srcElement;if(t.nodeType&&t.nodeType==3)t=t.parentNode;return t;},add_event:function(e,event,func){if(e.addEventListener){e.addEventListener(event,func,false);}else if(e.attachEvent){e.attachEvent("on"+event,func);}},advanced:function(){if(clicky.isset("clicky_advanced_disable"))return;var dtypes=clicky.isset("clicky_download_types")?clicky_download_types:"7z|aac|avi|csv|doc|exe|flv|gif|gz|jpe?g|js|mp(3|4|e?g)|mov|pdf|phps|png|ppt|rar|sit|tar|torrent|txt|wma|wmv|xls|xml|zip";var ltypes=clicky.isset("clicky_link_types")?clicky_link_types:"https?|ftp|telnet|ssh|ssl|mailto";var is_download=new RegExp("\\.("+dtypes+")$","i");var is_link=new RegExp("^("+ltypes+"):","i");var is_link_internal=new RegExp("^https?:\/\/(.*)"+location.host.replace(/^www\./i,""),"i");var a=document.getElementsByTagName('a');for(var i=0;i<a.length;i++){if(is_link.test(a[i].href)&&a[i].className.indexOf("clicky_ignore")==-1){if(is_link_internal.test(a[i].href)){if(is_download.test(a[i].href)){clicky.add_event(a[i],"mouseup",clicky.download);}}else{clicky.add_event(a[i],"mouseup",clicky.outbound);}}}}};clicky.init();
