//Start of script
function trace(v){
console.log(v);
}
// Ljs library by Author
//version 1.00
window.ljs=function(){
var obj=this;
window.ljsobj=this;
//classes to initialize
//obj.greetings={};
this.init=function(){
//alert('Hello from Ljs library!');
//var g=new greetings();
//this.greetings=g;
// initialize classes
this.greetings=new ljs_greetings();
//this.jq=$;
this.str=new ljs_strings();
this.htmlcnt=new ljs_html();
this.st=new ljs_stiles();
this.tr=new ljs_transform();
this.evt=new ljs_events();
this.ajax=new ljs_ajax();
this.window=new ljs_window();
};
this.createobj=function(objtype){
if ( objtype=='scroller' ) {
//alert('create scroller object');
this.scroller=new ljs_scroller();
//this.scroller=new lscroller();
//trace(this.scroller);
}
};
};
window.ljs_greetings=function(){
var obj=this;
this.init=function(){
alert('Hello from greetings class!');
};
this.say_hello=function(){
alert('Hello World!');
};
this.say_bye=function(){
alert('Bye!');
};
};
window.ljs_strings=function(){
var obj=this;
this.init=function(){
//alert('Hello from greetings class!');
};
this.toint=function(str){
return(parseInt(str));
};
};
window.ljs_events=function(){
var obj=this;
this.addevent=function(objid,evtname,func){
//alert('added event to '+objid+', evnt '+evtname+', function '+func );
if ( evtname=='click' ) {
$('#'+objid).click(func);
} else if ( evtname=='change' ) {
}
};
};
window.ljs_stiles=function(){
var obj=this;
this.init=function(){
//alert('Hello from greetings class!');
};
this.set=function(objid,stname,val){
//alert('Set style for '+objid+', '+stname+' '+val);
$('#'+objid).css(stname,val);
};
this.get=function(objid,stname){
//alert('Set style for '+objid+', '+stname+' '+val);
return $('#'+objid).css(stname);
};
};
window.ljs_transform=function(){
var obj=this;
this.animate=function(objid,stname,val,speed,func){
//Options
var sp=1000;
var gradations=10;
var fn=function(){
//alert('Complete!');
};
if ( speed ) {
sp=speed;
}
if ( func ) {
fn=func;
}
//alert('Animate style for '+objid+', '+stname+' to '+val);
//$('#'+objid).animate({stname:val},5000,function(){});
val=ljsobj.str.toint(val);
//$('#'+objid).css('margin-left',50);
if ( stname=='height' ) {
$('#'+objid).animate({'height':val},sp,fn);
//alert('Animate height for '+objid+', '+stname+' to '+val);
//ljs.st.set(objid,'height',val);
//var h=ljs.st.get(objid,'height');
//alert(ljs.str.toint(h));
//alert(ljs.str.toint(ljs.st.get(objid,'height')));
}
if ( stname=='width' ) {
$('#'+objid).animate({'width':val},sp,fn);
}
if ( stname=='margin-left' ) {
$('#'+objid).animate({'margin-left':val},sp,fn);
}
if ( stname=='margin-top' ) {
$('#'+objid).animate({'margin-top':val},sp,fn);
}
};
};
window.ljs_ajax=function(){
var obj=this;
this.load=function(objid,url){
//alert( 'loading '+url+' url to '+objid );
$('#'+objid).load(url);
}
this.post=function(url,snddata,callback){
//alert( 'loading '+url+' url to '+objid );
$.post(url,snddata,callback);
};
};
window.ljs_html=function(){
var obj=this;
obj.insert=function(objid,cnt){
$('#'+objid).html(cnt);
}
obj.append=function(objid,cnt){
var exst=$('#'+objid).html();
$('#'+objid).html(exst+''+cnt);
}
};
window.ljs_window=function(){
var obj=this;
this.create=function(prm){
//alert(prm);
u=prm['uniqueid'];
w=prm['width'];
h=prm['height'];
wstr='';
wstr+='
';
wstr+='
';
wstr+='Window content';
wstr+='
';
wstr+='
';
//ljs.htmlcnt.insert('div1', wstr);
}
this.show=function(){
}
this.hide=function(){
}
};
//Scroller
window.ljs_scroller=function(){
var obj=this;
this.init=function(in_prm){
//alert('init scroller');
//Prm
var prm={};
prm['un']='my_scr';
prm['width']=220;
prm['height']=280;
prm['cnt_addstyle']='';
prm['target']='scr_cnt';
prm['autoplay']=1;
prm['interval']=5000;//interval for change in autoplay mode
prm['fwidth']=220;//frames width
prm['fheight']=200;//frames height
prm['f_addstyle']='';//Frames additiional style
prm['controlheight']=60;//controls container height
prm['prevbut_left']=20;
prm['prevbut_width']=30;
prm['prevbut_height']=20;
prm['prevbut_addstyle']='border:1px solid #e0e0e0;';//background-image:url(images/prev_button.png);
prm['nextbut_left']=160;
prm['nextbut_width']=30;
prm['nextbut_height']=20;
prm['nextbut_addstyle']='border:1px solid #505050;';//background-image:url(images/next_button.png);
prm['fcontainer_addstyle']='margin-top:5px;';//Frames container additional style
prm['controls_addstyle']='border:0px solid blue;';//controls container additional styles
prm['img_width']=100;//Images width
prm['img_addstyle']='';//images additional styles
prm['img_c_addstyle']='border:1px solid #a0a0a0;';//styles for images class
prm['img_c_h_addstyle']='opacity:0.7;';//styles for hover images class
prm['titles_addstyle']='';//Titles additional style
prm['titlelink_addstyle']='font-weight:bold;';
prm['title_c_addstyle']='color:#303030;';
prm['title_c_h_addstyle']='color:red;';
var b={};
b[1]={url:'images/1_s.jpg',title:'Image 1'};
b[2]={url:'images/2_s.jpg',title:'Image 2'};
b[3]={url:'images/3_s.jpg',title:'Image 3'};
b[4]={url:'images/4_s.jpg',title:'Image 4'};
b[5]={url:'images/5_s.jpg',title:'Image 5'};
b[6]={url:'images/6_s.jpg',title:'Image 6'};
b[7]={url:'images/7_s.jpg',title:'Image 7'};
prm['imgs']=b;
for ( var i in in_prm ) {
//trace(i);
prm[i]=in_prm[i];
}
//trace(prm);
obj.prm=prm;
//init global variables in class
obj.curframe=1;
obj.countframes=0;
obj.vizibleframes=0;
obj.tintrvl=0;
obj.playing=0;
obj.create();
};
this.create=function(){
//alert('create');
var prm=obj.prm;
obj.vizibleframes=parseInt(prm['width']/prm['fwidth']);
//trace(obj.vizibleframes);
var html='';
html+='';
html+='';
var l=0;
for( var i in prm.imgs ) {
l++;
}
obj.countframes=l;
var w=l*prm['fwidth'];
//frames container div
html+='
';
for( var i in prm.imgs ) {
var b=prm.imgs[i];
html+='
';
if ( b['url'] ) {
html+='

';
}
if ( b['title'] ) {
html+='
';
}
html+='
';
//html+=' '+b['url'];
}
//clear both div
html+='
';
html+='
';
html+='
';
html+='
';
html+='
';
html+='
';
html+='
';
//stop button
//html+='
Stop
';
html+='
';
html+='
';
//prm['target']
//trace(prm['target']);
//trace(ljs_obj.htmlcnt);
ljsobj.htmlcnt.insert(prm['target'],html);
//ljs.htmlcnt.insert(prm['target'],html);
//prev button
ljsobj.evt.addevent(prm['un']+'_prev','click',
function(evt){
obj.prev();
if ( obj.playing ) {
obj.stop();
}
} );
//Next button
ljsobj.evt.addevent(prm['un']+'_next','click',
function(evt){
obj.next()
if ( obj.playing ) {
obj.stop();
}
} );
//ljs.evt.addevent(prm['un']+'_stop','click',function(evt){ obj.stop() } );
if ( prm['autoplay'] ) {
obj.play();
}
};
this.play=function(){
var prm=obj.prm;
//trace(obj.tintrvl);
obj.tintrvl = setInterval(function() {
obj.next();
}, prm['interval']);
//trace(obj.tintrvl);
obj.playing=1;
};
this.gotoframe=function(framenum){
var prm=obj.prm;
left=(framenum-1)*prm['fwidth'];
ljsobj.tr.animate(prm['un']+'_fcontainer','margin-left',-left);
};
this.prev=function(){
//alert('Prev');
var prm=obj.prm;
if ( obj.curframe<=1 ) {
return;
}
obj.curframe--;
obj.gotoframe(obj.curframe);
};
this.next=function(){
//alert('Next');
var prm=obj.prm;
if ( obj.curframe>=(obj.countframes-obj.vizibleframes+1) ) {
obj.curframe=1;
} else {
obj.curframe++;
}
obj.gotoframe(obj.curframe);
};
this.stop=function(){
clearInterval(obj.tintrvl);
obj.playing=0;
};
};
//Start of script
//function trace(msg) {
// console.log(msg);
//}
//Class loader
window.lloader=function(){
var o=this;
//Required parameters:
//o.uniqueid='imgloaderuique';
//o.mode='image';
//default parameters:
o.minimgwidth=300;
o.minimgheight=100;
o.loadtryinterval=1000;
o.loadmaxtrycount=50;
//---
o.newimginterval;
o.trycount=0;
o.tryattempts={};
o.init=function(prm){
//Required parameters
if(!prm['uniqueid'] || !prm['mode'] ){
return;
}
//Reset defalult parameters
for(var key in prm ){
o[key]=prm[key];
}
o.newimgid=o.uniqueid+'_newimg';
};
o.testimgload=function(){
//console.log( 'testing loaded');
o.trycount++;
if(o.trycount>o.loadmaxtrycount ){
window.clearInterval(o.newimginterval);
o.trycount=0;
//Handle loading error, when too match to wite for loading
}
if(document.getElementById(o.newimgid)!=null && typeof(document.getElementById(o.newimgid)) != 'undefined' ){
var myimgheight=document.getElementById(o.newimgid).height;
var myimgwidth=document.getElementById(o.newimgid).width;
} else {
myimgwidth=0;
myimgheight=0;
}
if( myimgwidth>o.minimgwidth ){ //&& myimgheight>o.minimgheight
//console.log('cler interval try count '+o.trycount);
window.clearInterval(o.newimginterval);
o.trycount=0;
var dimensions={};
dimensions['width']=myimgwidth;
dimensions['height']=myimgheight;
o.triggerloaded(dimensions);
}
};
o.shownewimage=function(){
$('#'+o.uniqueid+'_imgcontainerdiv' ).css('display','block');
};
//Load function to call from outside
o.load=function( newimagewrapperid, umgurl, callback ){
o.newimagewrapperid=newimagewrapperid;
o.loadedcallback=callback;
//console.log('Called load function');
if(o.mode=='image'){
var newimagehtml='
';
$('#'+newimagewrapperid ).html(newimagehtml);
//Set interval to chack periodically whether image is loaded
if($.browser.msie){
callback();
}else{
o.newimginterval=window.setInterval( o.testimgload , o.loadtryinterval );
}
//if is image
}
};
//Trigger event, that image is loaded
o.triggerloaded=function(data){
//execute the callback function
o.loadedcallback(data);
};
//Class lloader
};
window.l_ajax_post=function(){
var o=this;
this.send=function(datatosend,url,callback){
$.post(url,datatosend,callback);
};
};
window.l_frontbg=function(){
var o=this;
o.isopen=0;
//Options
o.uniqueid='frontbg_un'
o.cntsource='';
o.bg_zindex=9900;//background z-index
o.bg_bgcolor='#000000';//background background color
o.bg_opacity=0.5;//background opacity
o.bg_addstyles='';
o.cnt_zindex=9910;//container z-index
o.cnt_w=500;//container width
o.cnt_h=300;//container height
o.cnt_bright=20;//container right position, when appearing from bottom
o.cnt_tvisible=30;//visible top part, when appearing from bottom
o.cnt_bbtmopen=-10;//the bottom position of box after opening
o.cnt_addstyles='border:0px solid green;background-color:#f0f0f0;box-shadow:5px 5px 5px #505050;';
o.cnt_inner_addstyles='border:1px solid #e0e0e0;background-color:#ffffff;';
//Popup modes 'simple','frombottom','fromright'
o.popup_mode='simple';
this.init=function(prm){
//alert('Init');
if ( !prm['uniqueid'] ) {
return false;
}
//Options
for( var i in prm ){
o[i]=prm[i];
}
o.bgid=o.uniqueid+'_bg';
o.cntid=o.uniqueid+'_cnt';
o.cnt_inner=o.uniqueid+'_cntinner';
o.closebut=o.uniqueid+'_closebut';
};
this.create=function(){
//alert('Create');
this.set_background();
this.insert_container();
};
this.show=function(){
//$('#'+o.bgid).show();
//$('#'+o.cntid).show('slow');
};
this.open=function(){
if ( o.popup_mode=='simple' ) {
//Simply fade in (previeously we have sat the position of the box )
$('#'+o.bgid).show();
$('#'+o.cntid).fadeIn('slow',function(){o.isopen=1});
} else if ( o.popup_mode=='frombottom' ) {
$('#'+o.cntid).animate({bottom:o.cnt_bbtmopen},300,
function(){
o.isopen=1;
$('#'+o.openbut).css('display','none');
$('#'+o.closebut).css('display','block');
});
}
}
this.close=function(){
if ( o.popup_mode=='simple' ) {
$('#'+o.bgid).hide();
$('#'+o.cntid).fadeOut('slow',function(){o.isopen=0;});
} else if ( o.popup_mode=='frombottom' ) {
$('#'+o.cntid).animate({bottom:o.cnt_bbtmclosed},300,
function(){
o.isopen=1;
$('#'+o.closebut).css('display','none');
$('#'+o.openbut).css('display','block');
});
}
}
this.set_background=function(){
//alert('Background');
var cnt='';
cnt+='
';
$('body').append(cnt);
};
this.insert_container=function(){
var cnt='';
if ( o.popup_mode=='simple' ) { //create container box in the middle of the page
o.cnt_mleft=-parseInt(o.cnt_w/2);
o.cnt_mtop=-parseInt(o.cnt_h/2);
cnt+='';
cnt+='
';
cnt+='
';
//here goes content
cnt+='
';
cnt+='
';
} else if ( o.popup_mode=='frombottom' ) { //create container box in the right bottom, under the page content
//alert($( window ).width());
o.cnt_bbtmclosed=-parseInt(o.cnt_h-o.cnt_tvisible);
cnt+='';
cnt+='
';
//Show open/close button
if ( !o.isopen ) {
//alert('closed');
cnt+='
Open';
cnt+='
x';
} else if ( o.isopen ) {
//alert('is open');
cnt+='
Open';
cnt+='
x';
}
cnt+='
';
cnt+='
';
//here goes content
cnt+='
';
cnt+='
';
}
$('body').append(cnt);
//Insert content from source, if provided
if ( o.cntsource ) {
var str=$('#'+o.cntsource).html();
$('#'+o.cntsource).remove();
$('#'+o.cnt_inner).html(str);
}
$('#'+o.openbut).click(
function(evt){
//alert('Open');
o.open();
}
);
$('#'+o.closebut).click(
function(evt){
//alert('Close');
o.close();
}
);
$('#'+o.closebut).mouseover(
function(evt){
$(this).css('color','#ff0000');
}
);
$('#'+o.closebut).mouseout(
function(evt){
$(this).css('color','#303030');
}
);
};
};
//----------------------------------------------------------------------------
//Class lslideshow
window.lslideshow=function(){
//Dep lloader
var o=this;
o.curslideid=0;
o.prevslideid=0;
o.imgloader={};
o.slideinterval=0;
o.frames_positions=new Array();
//Required parameters
//target, uniqueid, images(array), width, height
//Default parameters
o.slidechangeinterval=15000;
o.textbackground='#75c5f0';
o.textcolor='#ffffff';
o.texfonsize=16;
o.textbg_opacity=0.9;
o.texbg_addstyles='';
o.texttop=0;
o.textheight=40;
o.textadditionalstyles='';
o.scrollerwidth=200;
o.scrollerheight=120;
o.scrollertop=50;
o.buttonstop=10;
o.init=function(prm){
if( !prm['target'] || !prm['uniqueid'] ){
//alert('Please specify target div and inuque id for this slide show');
return;
}
for(var key in prm ){
o[key]=prm[key];
}
//console.log(o.images[0]);
o.curimgwrapperid=o.uniqueid+'_curimgwrapper';
o.newimgwrapperid=o.uniqueid+'_newimgwrapper';
o.bartextwrapper=o.uniqueid+'_bartextwrapper';
o.scrollerwrapper_id=o.uniqueid+'_scrwrap';
o.scrollerband_id=o.uniqueid+'_scrb';
o.scr_prevbutton_id=o.uniqueid+'_scrprevbtn';
o.scr_nextbutton_id=o.uniqueid+'_scrnextbtn';
o.sldshow_prevbutton_id=o.uniqueid+'_sshprevbtn';
o.sldshow_nextbutton_id=o.uniqueid+'_sshnextbtn';
o.imagewidth=o.width;
o.slidescount=0;
for(var i in o.images ){
o.slidescount++;
}
//trace('slides count: '+o.slidescount);
if( $( window ).width()<1000 ){
o.create_simple();
return;
}
o.create();
//Scroller buttons
$( '#'+o.scr_nextbutton_id ).unbind('click');
$( '#'+o.scr_nextbutton_id ).click(
function(){
o.stopplay();
o.shownextslide();
}
);
$( '#'+o.scr_prevbutton_id ).unbind('click');
$( '#'+o.scr_prevbutton_id ).click(
function(){
o.stopplay();
o.showprevslide();
}
);
//Slide show prev next
$( '#'+o.sldshow_nextbutton_id ).unbind('click');
$( '#'+o.sldshow_nextbutton_id ).click(
function(){
o.stopplay();
o.shownextslide();
}
);
$( '#'+o.sldshow_prevbutton_id ).unbind('click');
$( '#'+o.sldshow_prevbutton_id ).click(
function(){
o.stopplay();
o.showprevslide();
}
);
var loaderprm={};
loaderprm['mode']='image';
loaderprm['uniqueid']=o.uniqueid+'_ldr';//o.uniqueid+'_newimg'
//loaderprm['minimgwidth']=200;
//loaderprm['minimgheight']=200;
o.imgloader=new lloader();
o.imgloader.init(loaderprm);
o.calc_frames_positions();
o.startplay();
};
o.create=function(){
$('#'+o.target).css('width', o.width+'px');
o.height=o.width*o.proportion;
$('#'+o.target).css('height', o.height+'px');
o.buttonstop=o.height-140;
$('#'+o.target).css('position','relative');
var targethtml='';
targethtml+='';
targethtml+='';
//Show image name
targethtml+='';
targethtml+='
';
targethtml+='
';
targethtml+='
';
targethtml+='
';
targethtml+='
';
$('#'+o.target).html(targethtml);
var prevnextbuttons=o.show_prevnextbuttons();
$('#'+o.prevnextbut_target).html(prevnextbuttons);
//var scrollerhtml=o.show_scroller();
//$('#'+o.scroller_target).html(scrollerhtml);
};
o.create_simple=function(){
$('#'+o.target).css('width', o.width+'px');
var imgs=o.images;
var image_url=imgs[0].url;
$('#'+o.target).html('
');
$('#'+o.padding_div_id).css('height', o.simple_height );
}
//Scroller
o.show_scroller=function(){
var targethtml='';
targethtml+='';
return targethtml;
};
//Prev next buttons
o.show_prevnextbuttons=function(){
var targethtml='';
targethtml+='';
targethtml+='
';
targethtml+='
';
targethtml+='
';
targethtml+='
';
targethtml+='
';
return targethtml;
};
o.shownextslide=function(){
//console.log('show next slide ');
if( o.curslideid>=o.slidescount-1 ){
o.curslideid=0;
}else{
o.curslideid++;
}
o.showslide(o.curslideid);
};
o.showprevslide=function(){
if( o.curslideid==0 ){
o.curslideid=o.slidescount-1;
}else{
o.curslideid--;
}
o.showslide(o.curslideid);
};
o.showslide=function(id){
//trace('Show slide called for '+id );
//return;
$('#'+o.bartextwrapper ).html(' ');
var prms={};
$('#'+o.newimgwrapperid).css('display','none');
$('#'+o.newimgwrapperid).css( 'opacity', 0 );
//trace( 'loadiing ... '+o.images[id].url );
o.imgloader.load(
o.newimgwrapperid,
o.images[id].url,
function(data)
{
//resize loadeed image to fit given vidth in options
var loadedimgid=o.uniqueid+'_ldr_newimg';
$('#'+loadedimgid).css( 'width', o.imagewidth );
$('#'+o.newimgwrapperid).css('display','block');
var imgh=$('#'+loadedimgid).height();
//trace( 'width: '+o.imagewidth+', height: '+imgh+' url: '+o.images[id].url );
//trace( 'loaded: '+o.images[id].url );
var ttop=imgh-o.textheight;
//Place text bar in bottom
$('#'+o.uniqueid+'_tb').css('top',ttop );
//make padding div some height
$('#'+o.padding_div_id).css('height', o.height+o.padding_div_distance );
//$('#'+o.padding_div_id).css('height',700);
//console.log('loaded '+id+' image width:'+data['width']+' height:'+data['height']); //('image loaded '+id );
//Show loaded image
$('#'+o.newimgwrapperid).animate({opacity: 1}, 900,
function(){
//console.log('animation complete '+id );
$('#'+o.curimgwrapperid).html('
');
$('#'+o.bartextwrapper ).html(o.images[id].text);
}
);
//o.display_scroller_frame(id);
}
);
};
this.display_scroller_frame=function(id){
//$('#'+o.scrollerband_id).animate({left: -o.frames_positions[id]}, 300,
//function(){
//}
//);
};
this.startplay=function(){
o.curslideid=0;
o.showslide(0);
o.slideinterval=window.setInterval( o.shownextslide , o.slidechangeinterval );
};
o.stopplay=function(){
window.clearInterval(o.slideinterval);
};
o.get_scroller_frames=function(){
var html_c='';
for (var i=0; i'+o.images[i].description+'';
}
return html_c;
};
o.calc_frames_positions=function(){
for (var i=0; i0){
$('#'+to['band_div']).animate( {marginLeft:-to.framespositions[num]}, 500, function(){} );
}if(num==0){
//$('#'+to['band_div']).css('margin-left', to.framespositions[1] );
$('#'+to['band_div']).animate( {marginLeft:-to.framespositions[0]}, 500, function(){} );
}
};
this.show_prev=function(){
if(to.curframe<1){
//return;
//to.framescount-to.visibleframes-1
to.showframe(to.framescount-to.visibleframes-1);
}else{
//to.curframe--;
to.showframe(to.curframe-1);
}
}
this.show_next=function(){
//alert('current frame was '+to.curframe);
if(to.curframe>=to.framescount-to.visibleframes-1){
to.showframe(0);
}else{
//alert('next button');
//to.curframe++;
to.showframe(to.curframe+1);
}
//alert('current frame is '+to.curframe);
}
this.get_frames_positions=function(){
//to['frames_width'] to['framespositions']
for(var i=0; i