	hs.graphicsDir = '/highslide/graphics/';
	hs.align = 'center';
	hs.transitions = ['expand', 'crossfade'];
	hs.wrapperClassName = 'dark borderless floating-caption';
	hs.fadeInOut = true;
	hs.dimmingOpacity = .75;
    hs.loadingText = 'Ielādē...';
    hs.closeTitle = 'Aiavērt';
	hs.fullExpandTitle  = 'Palielināt attēlu';
	hs.loadingTitle  = 'Spiest lai atceltu';
	hs.focusTitle  = 'Spiest lai izvirzītu uz priekšu';
	hs.creditsText  = '';
	hs.creditsTitle  = '';
	hs.previousText  = 'Iepriekšējā';
	hs.nextText  = 'Nākošā';
	hs.moveText  = 'Pārvietot';
	hs.closeText  = 'Aivērt';
	hs.closeTitle  = 'Aizvērt (esc)';
	hs.resizeTitle  = 'Mainīt izmēru';
	hs.playText  = 'Sākt spēlēt';
	hs.playTitle  = 'Spēlēt (spacebar)';
	hs.pauseText  = 'Pause';
	hs.pauseTitle  = 'Sākt spēlēt  (spacebar)';
	hs.previousTitle  = 'Iepriekšējā (arrow left)';
	hs.nextTitle  = 'Nākošā (arrow right)';
	hs.moveTitle  = 'Pārvietot';
	hs.fullExpandText  = 'Pilnais izmērs';
	hs.number = 'Attēls %1 no %2';
	hs.restoreTitle  = '';

	// Add the controlbar
	if (hs.addSlideshow) hs.addSlideshow({
		//slideshowGroup: 'group1',
		interval: 5000,
		repeat: false,
		useControls: true,
		fixedControls: 'fit',
		overlayOptions: {
			opacity: .6,
			position: 'bottom center',
			hideOnMouseOut: true
		}
	});

    
function genpasts(prefix,postfix)
{
	if (prefix!='' && postfix!='')
	{
		var pasts=prefix;
			pasts=pasts+'@';
			pasts=pasts+postfix;

		document.write('<a href="mailto:'+pasts+'"  <font>'+pasts+'</font></a>');
	}
	else document.write('-');
}
function submituserform(action,lang){
        //var dataString = jQuery("#userForm").serialize();//'folder='+action
        jQuery('#loadingUserForm').show();
        var name = jQuery("#F_LOGIN_NAMEA").val();
        var pass = jQuery("#F_LOGIN_PASSWORDA").val();
        var dataString = 'F_USER_NAMEA='+ name+'&F_USER_PASSWORDA='+pass;
        if(lang!=''){lang = '/'+lang;}
        var link = lang+'/login/';
		jQuery.ajax({
            type: "POST",
            url: "/lv/login/",
            //jQuery("#userForm").serialize(),
            data: dataString,//jQuery('#userAuthForm').serialize(),//
            success: function(data) {
              //jQuery('#id_parent_menu').html("<div id='message'></div>");
              if(data==1){
                window.location.href = lang+'/';
              }else{
                  jQuery('#userFormDiv').html(data)
                  //.append(data)
                  .hide()
                  .fadeIn(1500, function() {
                    jQuery('#loadingUserForm').hide();
                    //$('#message').append("<img id='checkmark' src='images/check.png' />");
                  });
              }
            }
     });

    return false;
}

function submitComment(){
    var name = jQuery('#name').val();
    var comment = jQuery('#comment').val();
    if(name.length<2 || comment.length<10 || jQuery('#code').val()!=jQuery('#code_hidden').val()){

        jQuery('#commentFormWin').addClass("loadingForm");
        if(name.length<2){jQuery('#name_warning').show();}else{jQuery('#name_warning').hide();}
        if(comment.length<10){jQuery('#comment_warning').show();}else{jQuery('#comment_warning').hide();}
        if(jQuery('#code').val()!=jQuery('#code_hidden').val()){jQuery('#code_warning').show();}else{jQuery('#code_warning').hide();}
        jQuery.ajax({
            type: "POST",
            url: "/lv/news/get_new_code/",
            data: jQuery('#commForm').serialize(),
            success: function(data) {
              jQuery('#security_code').html(data)
            }
        });
        jQuery('#commentFormWin').removeClass("loadingForm");
    }else{
        document.getElementById('commForm').submit();
    }
}

function searchKeyPress(e,button,arg){
    // look for window.event in case event isn't passed in
    if (window.event) { e = window.event; }
    if (e.keyCode == 13){
        if(button=='submituserbutton'){
            submitloginform(arg);
        }else if(button=='submituserform'){
            submituserform('');
        }else if(button == 'submitforgotpassword'){
            document.userform.submit();
        }
        //document.getElementById(button).click();
    }
}

function changeLang(field,val){
    if(val==1){
        jQuery("#"+field).hide();
        var field = field + '_active';
        jQuery("#"+field).show();
    }else{
        jQuery("#"+field).show();
        var field = field + '_active';
        jQuery("#"+field).hide();
    }
}

function questionSubmit(l,lang){
    jQuery('#question_loading').show();
    var inputs = jQuery("input, textarea, select");
    var queryString = inputs.serialize();

    jQuery.ajax({
        type: "POST",
        url: '/'+lang+'/questions/',
        data: queryString,
        success: function(data) {
            jQuery('#questionFormDiv').html(data);
            jQuery('#question_loading').hide();
        }
    });
}
function submitloginform(lang){
    //jQuery('#loginmessageform').hide();
    jQuery('#message').hide();
    jQuery('#loading').addClass("loadingregform");
    var inputs = jQuery("input");
    var queryString = inputs.serialize();
    var link = '/'+lang+'/login/?message=true';
	jQuery.ajax({
        type: "POST",
        url: link,
        data: queryString,
        success: function(data) {

            if(data=='true'){
                window.location.reload();
            }else{
                jQuery('#message').html(data);
                jQuery('#loading').removeClass("loadingregform");
                jQuery('#message').show();
            }
        }
    });
}
function tooglestate(id){
    if(id==0){
        jQuery('#jurper').hide();
    }else{
        jQuery('#jurper').show();
    }
}
function addproduct(id){
    var count = parseFloat(jQuery('#count'+id).val())+1;
    var price = parseFloat(jQuery('#price'+id).html());

    //alert(count+'   '+price);

    sum = Math.round((count * price+0.00001) * 100)/100;
    sum = sum.toFixed(2);
    jQuery('#sum'+id).html(sum);
    jQuery('#count'+id).val(count);
    //var pvn = Math.round((sum - (sum / 1.21))* 100)/100;
    //pvn = pvn.toFixed(2);
    //jQuery('#pvn'+id).html(pvn);
}
function remproduct(id){
    var count = parseFloat(jQuery('#count'+id).val());

    if(count>1){
        var price = parseFloat(price = jQuery('#price'+id).html());
        count = count - 1;
        //alert(count+'   '+price);
        sum = Math.round((count * price+0.00001) * 100)/100;
        sum = sum.toFixed(2);
        jQuery('#sum'+id).html(sum);
        jQuery('#count'+id).val(count);
        //var pvn = Math.round((sum - (sum / 1.21))* 100)/100;
        //pvn = pvn.toFixed(2);
        //jQuery('#pvn'+id).html(pvn);
    }
}
function change_image(image){
    var image = '<a href="/images/gallery/large/'+image+'" class="highslide" onclick="return hs.expand(this)" ><img src="/images/gallery/small/'+image+'" width="180px" alt="" border="0" /></a><div class="highslide-heading"></div>';
    //jQuery("#gallery_image").fadeIn("slow");
    //jQuery("#gallery_image").html(image);

    jQuery("#gallery_image").fadeOut("fast", function(){
			jQuery("#gallery_image").html(image);
			jQuery("#gallery_image").fadeIn("slow");
	});

}

function showhideseconds(){
    if(jQuery('#voice_mail').attr('checked')){
        jQuery('#seconds').show();
    }else{
        jQuery('#seconds').hide();
    }
}


