
  
var Webfolio = {
	
		Corners : {
			
					Load: function()
					{
						// portfolio
						$('div#portfolio').corners();
					
						$('div#portfolio div.p-item div.item-img').corners();
					
						// post item image
						$('div.post-item div.entry div.image a.small-img').corners();
						$('div.post-item div.entry div.detail div.detail-img').corners();
						$('div.post-item div.entry div.header div.crn').corners();
						
						// comments
						$('div.comments div.header').corners();
						$('div.comments div.form').corners();	

						// contact form
						$('div.extended.form').corners();	
						
						// admin links
						$('p.adm-links').corners();	
						
					}
		},
				
		Carousel : {
			
					Load: function(count)
					{
						if($("#portfolio-carousel").length > 0)
						{


							if(ShowCaseSetting.Cycle){

								$("#portfolio-carousel").jCarouselLite({
									btnNext: "div#portfolio div.buttons div.next",
									btnPrev: "div#portfolio div.buttons div.prev",
									visible: count,
									auto: ShowCaseSetting.Auto, 
									speed: ShowCaseSetting.Speed
									
								});

							}else{
							
								$("#portfolio-carousel").jCarouselLite({
									btnNext: "div#portfolio div.buttons div.next",
									btnPrev: "div#portfolio div.buttons div.prev",
									visible: count
								});
							}
						}
					},
					
					Init : function(count)
					{
						setTimeout("Webfolio.Carousel.Load("+ count +")", 1000);	
					}
		},
		
		Lightbox : {
					
					Init : function()
					{

						$(function() {
						   $('a.lightbox').lightBox({
							overlayBgColor: '#000',
							overlayOpacity: 0.6,
							imageLoading:  _themePath + 'images/lightbox-ico-loading.gif',
							imageBtnClose: _themePath + 'images/lightbox-btn-close.gif',
							imageBtnPrev:  _themePath + 'images/lightbox-btn-prev.gif',
							imageBtnNext:  _themePath + 'images/lightbox-btn-next.gif',
							containerResizeSpeed: 350
						   });
						});


					}
		},

		Form :  {
			
				IsValid :  function(strFieldText,strCommentText, isAdmin)
					{

						// Define fileds 
						var _author		= document.getElementById("author");
						var _email		= document.getElementById("email");	
						var _comment	= document.getElementById("comment");
						var _isAdmin	= isAdmin == '' ? false : true;
						
						var _regEx = "^[\\w\\-]+[\\.\\w\\-]*[\\@]+[\\w\\-\\.]+\\.[A-Z_a-z]{2,}$";

						// Check fileds

						if(_isAdmin) {

							if(_comment.value != "" && _comment.value.length > 10){
								return true;
							} else {
								strFieldText= strCommentText != '' ? strCommentText : 'Say something!';								
							}

						} else {
						// Author
						if(_author.value != '' && _author.value.length > 2){
					
								// Email
								if(RegExp(_regEx).test(_email.value)) {
									
									// Comment
									if(_comment.value != "" && _comment.value.length > 10){
															 return true;
														} else {
															strFieldText= strCommentText != '' ? strCommentText : 'Say something!';
														}

									} else {
										_email.style.color='red';
									}	

							} else {
								_author.style.color='red';
							}
						
						}

						Webfolio.Form.Show(strFieldText)

						return false;
					},

				Show :  function(strText)
					{
					if(strText != '')
						{
							alert(strText);
						}
				}

		}
}
  
  
$(function(){ 
	Webfolio.Corners.Load();
	Webfolio.Lightbox.Init();
});
