﻿cj.evt.add(window, 'load', function(){
	var cf = document.getElementById('contact_form');
	if(cf){
		cf.onsubmit = function(){
			if(!cj.form.chk(this, ['uname,text', 'email,email', 'message,text'])){
				return false;
			}
			return true;
		}
	}
	var i, j, n, set, src;
	var imgs = document.getElementsByTagName('img');
	for(var i=0; i<imgs.length; i++){
		n = imgs[i];
		if(!n.className || !/\{.*\}/.test(n.className)) continue;
		try{ set = eval('('+n.className+')')}catch(e){};
		if(typeof set != 'object' || !set.src) continue;
		n.style.cursor = 'pointer';
		n.img = cj.util.createElm('img', {});
		n.img.src = set.src;
		n.onclick = function(){
			cj.popup.popImg(this.img);
		}
	}
	
	(function(){
		n = document.getElementById('leftMenu');
		if(n){
			n.pos = cj.util.getElementPos(n);
			n.style.left = n.pos.left + 'px';
			n.style.top = n.pos.top + 'px';
			n.style.width = n.offsetWidth + 'px';
			n.style.height = n.offsetHeight + 'px';
			n.style.position = 'absolute';
			n.roll = function(){
				var t = this;
				var sp = cj.util.getScrollPos();
				y = (sp.top<t.pos.top) ? t.pos.top : sp.top;
				t.style.top = y + 'px';
			}
			cj.evt.add(window, 'scroll', function(){n.roll()});
			n.roll();
		}
	})();
});
