
$(document).ready(function() {
  
  
  
  
    $('.socialsharing .share-hyperlink').mouseover(function () {
      var timer = window.setTimeout("$('.socialsharing').children('.sharinglogo').css('display','block');", 1500);
      cleartimeout(timer);
    });
   
    $('.socialsharing .share-hyperlink').mouseout(function () {
      var timer = window.setTimeout("$('.socialsharing').children('.sharinglogo').css('display','none');", 1500);
      cleartimeout(timer);
    });
   

    $('.sharingdoit .sharedoit-hyperlink').mouseover(function () {
      var timer = window.setTimeout("$('.sharingdoit').children('.sharingdoitlogo').css('display','block');", 1500);
      cleartimeout(timer);
    });
   
    $('.sharingdoit .sharedoit-hyperlink').mouseout(function () {
      var timer = window.setTimeout("$('.sharingdoit').children('.sharingdoitlogo').css('display','none');", 1500);
      cleartimeout(timer);
    });

              

     $('.sharingdoit .sharedoit-hyperlink').click(function () {
      $('.sharingdoit').children('.ikearsharedoit-icons').css('display','block');
      return false;
    });
   
    $('.sharingdoit .sharedoit-hyperlink').blur(function () {
    //  $('.sharingdoit').children('.ikearsharedoit-icons').css('display','none');
      return false;
    });



     $('.socialsharing .share-hyperlink').click(function () {
      $('.socialsharing').children('.ikearshare-icons').css('display','block');
      return false;
    });
   
    $('.socialsharing .share-hyperlink').blur(function () {
   //   $('.socialsharing').children('.ikearshare-icons').css('display','none');
      return false;
    });
    
  
  
if (jQuery.browser.msie) {
if(jQuery.browser.version == 7) {
	/*
	var zIndexNumber = 1000;
	 $('div').each(function() {
	  $(this).css('zIndex', zIndexNumber);
	  zIndexNumber -= 10;
	 });	  
*/

}
}
    
  $('#accordion .jScrollPaneDragV').css('height','38px');
  $('.blog-info .jScrollPaneDragV').css('height','38px');
  $('.terms-cond .jScrollPaneContainerV').css('width','280px');
  $('#terms-info-box').css('width','260px');
  //$('.temp-3 #content-right').css('z-index','1');
  //  $('.temp-3 #content-right').css('width','213px');
  if(Drupal.settings.blogpage == 'yes') {
  	$('#stream_content').css('height','330px'); 
  }
  
  /* $("#right-side").mousemove(function(e){
      var relativeY = e.pageY - this.offsetTop;
     if(relativeY <= 650 && relativeY >= 90) {
      var currlocs = relativeY - 65;
       $('#right-side .arrow-bg').animate({ top: currlocs }, { duration: 450, queue: false });
      }else {
	$('#right-side .arrow-bg').animate({ top: 300 }, { duration: 500, queue: false });
      }
    });
   
   $("#left-side").mousemove(function(e){
      var relativeY = e.pageY - this.offsetTop;
     if(relativeY <= 650 && relativeY >= 90) {
      var currlocs = relativeY - 65;
       $('#left-side .arrow-bg').animate({ top: currlocs }, { duration: 450, queue: false });
      }else {
	$('#left-side .arrow-bg').animate({ top: 300 }, { duration: 500, queue: false });
      }
    });*/
   
  /* $("#right-side").mouseleave(function(){
     $('#right-side .arrow-bg').animate({ top: 300 }, { duration: 500, queue: false });
   });
    $("#left-side").mouseleave(function(){
     $('#left-side .arrow-bg').animate({ top: 300 }, { duration: 500, queue: false });
   });*/
  
 
  if(Drupal.settings.currentpage == 'home') {
	  $.post(Drupal.settings.fullpath + "/homebackround", {page: Drupal.settings.currentpage},
			function(content) {
					if(content){
					  $('.background-0').css('background','none');
					  $('.background-0').css('background','url('+ content +')');
					  $('.background-0').css('height','650px');
	        }
	  });
  }
  
  $('.right-bg').css('display','block');
  //$('.left-bg').css('display','block');
  
/*
  if(Drupal.settings.currentpage == 'stories') {
      $.post(Drupal.settings.fullpath + "/homebackround", {page: Drupal.settings.currentpage, nid: Drupal.settings.storynid},
			function(content) {
					if(content){
					 if(content) { 
					    $('.background-1').css('background','none'); 	
	 				    $('.background-1').css('background-image','url('+ content +')');
					    $('.background-1').css('height','650px');
					  }
	        }
	  });
  }
*/

					
 
/*
 if(Drupal.settings.currentpage == 'stories') {
      
      

	//	onImage["home"] = new Image()
	//	onImage["home"].src = "../images/homeOn.gif"; 
      
      
      $.post(Drupal.settings.fullpath + "/homebackround", {page: Drupal.settings.currentpage, nid: Drupal.settings.storynid},
			function(content) {
					if(content){
					 if(content) { 
					   
					  //  $('.background-1').css('background','none'); 	
	 				   // $('.background-1').css('background-image','url('+ content +')');
					   // $('.background-1').css('height','650px');
					  }
	        }
	  });
	  alert(onImage["story-1"].src);
  }
*/


  $('.explorehomestory').click(function() {   
    if(this.id){
	  var nid = this.id;
	  splitnid = nid.split('-');
	  //var aliasedpath = $('#exphid-'+ splitnid[1]).val();
	  window.location.href = Drupal.settings.fullpath + '/stories/' +  splitnid[1] + '/explore';
	  //window.location.href = Drupal.settings.fullpath + '/' + aliasedpath;
        }
  });

	   $('#email-popup .close-pop').click(function(){
       $('#email-popup').css('display','none');
        return false;
 });
 
     
                         

           if(Drupal.settings.currentpage == 'stories') {
      
                var onImage = new Array();
 					 var newsplitcontent = $('#allpaths').val();
      			       splittedcontent = newsplitcontent.split('#####');
      			       for(i=0;i<=(splittedcontent.length);i++){
      			         if(splittedcontent[i] && splittedcontent[i] != 'undefined') {
					       onImage["story-"+i] = new Image()
						   onImage["story-"+i].src = splittedcontent[i];
						 }
						 //alert(onImage["story-"+i].src);
						}
			}			
					
						$('.right-bg').click(function(){
						    deltano = $('#arrow-next').val();
							totalbgs = $('#total-backs').val();
                                                        newarrow = parseInt(deltano) + 1;
							$('.left-bg').css('display','block');
                                                        bgurl = onImage["story-"+newarrow].src;
                                                       $('.background-1').css('background-image','url('+ bgurl +')');
                                                       $('.background-1').show(5000);
						      //  $('.background-1').show("slide", { direction: "right" },170);
						       $('#arrow-next').val(newarrow);
                                                       
                                                        var capdel = $('#deltano1').val();
                                                        capdel = parseInt(capdel) + 1;
                                                        $('#deltano1').val(capdel);
                                                       
                                                     if((parseInt(newarrow) + 1) >= totalbgs) {
							$('.right-bg').css('display','none');
	      				           }
	      				           $('#slide-pop-info').css('display','none');
			  			   return false;
                                              });
                                                
                                             $('.left-bg').click(function(){
                                                 $('.right-bg').css('display','block');
						    deltano = $('#arrow-next').val();
							totalbgs = $('#total-backs').val();
                                                        newarrow = parseInt(deltano) - 1;
							$('.left-bg').css('display','block');
                                                         bgurl = onImage["story-"+newarrow].src;
                                                       $('.background-1').css('background-image','url('+ bgurl +')');
                                                       $('.background-1').show(5000);
						      //$('.background-1').show("slide", { direction: "left" },170); 
			  			   			  	
                                                       var capdel = $('#deltano1').val();
                                                       capdel = parseInt(capdel) - 1;
                                                       $('#deltano1').val(capdel);                         
                                                                                		   
			  			   $('#arrow-next').val(newarrow);
                                                     if((parseInt(newarrow)) < 1) {
							$('.left-bg').css('display','none');
                                                      }
                                                    $('#slide-pop-info').css('display','none');  
			  			   return false;
                                              });   
               
                         
 
 
 });
 

function moreideapagination(count,overalldiv,nid) {
  $.post(Drupal.settings.fullpath  + "/moreideaspaginate", { count: count, overalldiv: overalldiv, nid: nid },
   function(data){
     newdata = data.split('#####');
   //  alert(newdata[1]);
     $('.ideapoped .'+overalldiv).attr('src',newdata[0]);
     $('.ideapoped .'+overalldiv).attr('alt',newdata[2]);
     $('.ideapoped .'+overalldiv).attr('title',newdata[2]);
//     $('.ideapoped .idea-content').html('');
     $('.ideapoped .idea-content').html(newdata[1]);
    // $('.ideapoped .idea-content').html('xyz');
     return false;
   });
   return false;
}


function morefloorpagination(count,overalldiv,nid) {
  $.post(Drupal.settings.fullpath  + "/floorplanpaginate", { count: count, overalldiv: overalldiv, nid: nid },
   function(data){
     newdata = data.split('#####');
     $('.floorpoped .'+overalldiv).attr('src',newdata[0]);
     $('.floorpoped .idea-content').html('');
     $('.floorpoped .idea-content').html(newdata[1]);
     return false;
   });
   return false;
}

function imagechange(nid,delta,divid,imgcache) {
  $('#slide-pop-info').css('display','none');
  $.post(Drupal.settings.fullpath +"/imagechange", { nid: nid, delta: delta, divid: divid, imgcache: imgcache },
   function(data) {
    var content = data.split('####');
   // $('.'+divid).fadeOut(300);
    $('.'+divid).attr('src',Drupal.settings.fullpath + "/" + content[0]);
    $('.'+divid).attr('alt',content[2]);
    $('.'+divid).attr('title',content[2]);
   // $('.'+divid).fadeIn(300);
    $('#deltano').val(content[1]);
    $('#deltano2').val(content[1]);
    $('#deltano3').val(content[1]);
    
    s.t({pageName:'IKEA FAMILY LIVE>Click on images in scroll'});
    //callTrackInfo('IKEA FAMILY LIVE>Click on images in scroll');
    return false;
   });
   return false;
}

function changeimgcaption(nid,tmpno) {
  if(tmpno == 'tmp-2') {
  var delta = $('#deltano').val();
  }
  else if(tmpno == 'tmp-3') {
   var delta = $('#deltano3').val();
  }
  else if(tmpno == 'tmp-1') {
   var delta = $('#deltano1').val();
  }
  else {
  var delta = $('#deltano2').val();
  }
  $.post(Drupal.settings.fullpath +"/changeimgcaption", { nid: nid, delta: delta },
   function(data) {
    $('#slide-pop-info').fadeIn(500);
    $('.captioncontent').html('');
    $('.captioncontent').html(data);
    s.t({pageName:'IKEA FAMILY LIVE>Clicks on caption button'});
//    callTrackInfo('IKEA FAMILY LIVE>Clicks on caption button');
    return false;
   });
  return false;
 }
 
 function changeimgcaptionpopup(nid,delta) {
 $.post(Drupal.settings.fullpath +"/changeimgcaption", { nid: nid, delta: delta },
   function(data) {
    $('#slide-pop-info').fadeIn(500);
    $('.captioncontent').html('');
    $('.captioncontent').html(data);
    return false;
   });
  return false;
 }

function close_imgcappop() {
  $('#slide-pop-info').fadeOut(500);
  return false;
}

function close_temp5pop() {
  $('#image-show-pop').fadeOut(500);
  return false;
}
 
function temp5_popup(filepath,imgclass,nid,delta,alt) {
   var largeimgpath = "<img src='" + Drupal.settings.fullpath+'/sites/default/files/imagecache/temp5_popup/'+filepath + "' class='tmp5pop' alt="+alt+" title = "+alt+" />";
  
 var content = '<div class="myShadow-box-R"><div class="myShadow-box-L"><div class="myShadow-content">' + largeimgpath + '<span class="clear"></span><div id="slide-pop-info" class="myShadow-box-B"><div class="myShadow-box-R"><div class="myShadow-box-L"><div class="myShadow-content"><div class="captioncontent"><p>Stories of innovation The lamp is a surprise. It can handle nine kilos tugging on its petals – yet it appears fragile. The lamp grows as you put it together, petal by petal.Designer Marcus Arvonen . IKEA PS MASKROS pendant lamp</p></div><a class="removed close-pop" href="#" onclick="return close_imgcappop();">clos</a></div></div></div></div><a class="removed slide-info" onclick="return changeimgcaptionpopup('+ nid +',' + delta + ');" href="#">slide-info</a></div><a href="#" class="removed close-pop" onclick="return close_temp5pop();">clos</a></div></div>';

  $('#image-show-pop').html(content); 
  $('#image-show-pop').show();
   return false;
}
 

function housepagination(count,overalldiv) {
 var nid = $('#housenid').val();
  
$.post(Drupal.settings.fullpath  + "/housepaginate", { count: count, overalldiv: overalldiv, nid: nid },
   function(data){
     newdata = data.split('#####');
     $('.'+overalldiv).html('');
     $('.'+overalldiv).html(newdata[0]);
     $('.tabs-page').html('');
     $('.tabs-page').html(newdata[1]);
     s.t({pageName:'IKEA FAMILY LIVE>Clicks on bottom right nav'});
   //  callTrackInfo('IKEA FAMILY LIVE>Clicks on bottom right nav');
     return false;
   });
return false;
} 
 
 
function pagination(count,overalldiv) {
  
  var newtid = $('#exptedtid').val();
  var liked = $('#exptedliked').val();
  
$.post(Drupal.settings.fullpath  + "/paginate", { count: count, overalldiv: overalldiv, newtid: newtid, liked: liked },
   function(data){
     newdata = data.split('#####');
     $('.'+overalldiv).html('');
     $('.'+overalldiv).html(newdata[0]);
     $('.tabs-page').html('');
     $('.tabs-page').html(newdata[1]);
     s.t({pageName:'IKEA FAMILY LIVE>Clicks on bottom right nav'});
//     callTrackInfo('IKEA FAMILY LIVE>Clicks on bottom right nav');
     return false;
   });
return false;
} 


function easyupdatepagination(count,overalldiv,tid) {
  
  var liked = $('#exptedliked').val();
  
$.post(Drupal.settings.fullpath  + "/easyupdatepaginate", { count: count, overalldiv: overalldiv, tid: tid,liked: liked },
   function(data){
     newdata = data.split('#####');
     $('.'+overalldiv).html('');
     $('.'+overalldiv).html(newdata[0]);
     $('.tabs-page').html('');
     $('.tabs-page').html(newdata[1]);
     s.t({pageName:'IKEA FAMILY LIVE>Clicks on bottom right nav'});
     //callTrackInfo('IKEA FAMILY LIVE>Clicks on bottom right nav');
     return false;
   });
return false;
} 




function explorepagination(count,overalldiv) {
 var imgtags = $('#imgtags').val();
 var imgcategory = $('#imgcategory').val();
 var imgpage = $('#imgpage').val();
 var imgliked = $('#imgliked').val();
 
$.post(Drupal.settings.fullpath  + "/explorepaginate", { count: count, overalldiv: overalldiv, imgtags: imgtags, imgcategory: imgcategory, imgpage: imgpage, imgliked: imgliked },
   function(data){
     newdata = data.split('#####');
     $('.'+overalldiv + ' ul').html('');
     $('.'+overalldiv + ' ul').html(newdata[0]);
     $('.tabs-page').html('');
     $('.tabs-page').html(newdata[1]);
     s.t({pageName:'IKEA FAMILY LIVE>Clicks on bottom right nav'});
  //   callTrackInfo('IKEA FAMILY LIVE>Clicks on bottom right nav');
     return false;
   });
return false;
} 




function galpagination(count,overalldiv) {
 var galsort = $('#galsort').val();
 var galtid = $('#galtid').val();
$.post(Drupal.settings.fullpath  + "/gallerypaginate", { count: count, overalldiv: overalldiv, galtid: galtid, galsort: galsort },
   function(data){
     newdata = data.split('#####');
     $('.'+overalldiv).html('');
     $('.'+overalldiv).html(newdata[0]);
     $('.page-navi').html('');
     $('.page-navi').html(newdata[1]);
     s.t({pageName:'IKEA FAMILY LIVE>Clicks on bottom right nav'});
//     callTrackInfo('IKEA FAMILY LIVE>Clicks on bottom righ nav');
     return false;
   });
return false;
} 


function tagspagination(tid,overalldiv,count) {
$.post(Drupal.settings.fullpath  + "/tagspaginate", { tid: tid, overalldiv: overalldiv, count: count },
   function(data){
     newdata = data.split('#####');
     $('#gallerytag').val(tid);
     $('.'+overalldiv).html('');
     $('.'+overalldiv).html(newdata[0]);
     $('.filter-gallery').html('');
     $('.filter-gallery').html(newdata[2]);
     $('.page-navi').html('');
     $('.page-navi').html(newdata[1]);
     return false;
   });
return false;
} 


function sortpagination(sort,overalldiv,count) {
  var tid = $('#gallerytag').val();
$.post(Drupal.settings.fullpath  + "/sortgallery", { tid: tid, overalldiv: overalldiv, count: count, sort: sort },
   function(data){
     newdata = data.split('#####');
     $('#gallerysort').val(sort);
     $('.'+overalldiv).html('');
     $('.'+overalldiv).html(newdata[0]);
     $('.page-navi').html('');
     $('.page-navi').html(newdata[1]);
     return false;
   });
return false;
} 

function galleryemail() {
 $('#gallery-list-image-popup').css('display','none');
 $('#terms').attr('checked', false);
 $('#emailpopups').css('display','block');
 $('#emailpopups').css('position','relative');
 $('#email-popup').css('position','absolute');
 $('#email-popup').css('left','-294px');
 $('#email-popup').css('top','-325px');
 $('#email-popup').css('display','block');
 s.t({pageName:'IKEA FAMILY LIVE>Clicks on email us button'});
// callTrackInfo('IKEA FAMILY LIVE>Clicks on email us button');
 return false;
}

function sendemail() {
  var terms = $('#terms:checked').val();
  if(terms != 'on') {
    alert('Please Check Terms & Conditions!');
  }else{
    window.location.href = "mailto:LIVE@IKEAFAMILYLIVE.com?subject=PICTURES";
    $('#email-popup').css('display','none');
  }
  return false;
}

 
function gallerypopups(nid) {
  $.post(Drupal.settings.fullpath  + "/gallerypop", { nid: nid },
   function(data){
     $('#email-popup').css('display','none');
     $('#gallery-list-image-popup').html('');
     $('#gallery-list-image-popup').fadeOut(700);
     $('#gallery-list-image-popup').html(data);
     $('#gallery-list-image-popup').fadeIn(700);
     $('#gallery-list-image-popup').css('display','block');
     s.t({pageName:'IKEA FAMILY LIVE>Clicks on pics'});
//     callTrackInfo('IKEA FAMILY LIVE>Clicks on pics');
     return false;
   });
  return false;
}

function roomspopups(nid,delta,picsflag) {
  $.post(Drupal.settings.fullpath  + "/roomspop", { nid: nid, delta: delta, picsflag: picsflag },
   function(data){
    // s.pageName = 'IKEA FAMILY LIVE>Clicks on individual pics';
     $('#email-popup').css('display','none');
     $('#gallery-list-image-popup').fadeOut(700);
     $('#gallery-list-image-popup').html(data);
     $('#gallery-list-image-popup').fadeIn(700);
     s.t({pageName:'IKEA FAMILY LIVE>Clicks on individual pics'});
     //callTrackInfo('IKEA FAMILY LIVE>Clicks on individual pics');
     return false;
   });
  return false;
}

function galclose() { 
       $('#gallery-list-image-popup').css('display','none');
       return false;
}

function facebooklikegalclose() {
  $('#gallery-list-image-popup').css('display','none');
  var nid = $('#exploreajaxnid').val();
  var delta = $('#exploreajaxdelta').val();
  var path = $('#exploreajaxpath').val();
  $.post(Drupal.settings.fullpath  + "/facebooklikeitrooms", { nid: nid, delta: delta, path: path },
   function(data){
     
  });   

  return false;
}

function savefivestar(rate, nid) {
  $.post(Drupal.settings.fullpath  + "/rategallery", { rate: rate, nid: nid },
   function(data){
     if(data) {
	    split = data.split('####');
	    if(split[0]) {
		  $('.fivestaravg').html('');
		  $('.fivestaravg').html(split[0]);
		} 
		if(split[1]) {
		  $('.fivestarrank').html('');
		  $('.fivestarrank').html(split[1]);
		}
		if(split[2]) {
		  for(var t=1; t<=5; t++) {
		    $('#star-'+t).attr("src",Drupal.settings.fullpath + "/sites/all/themes/ikea/images/css/rate-star.png");
		  }
		  for(var t=1; t<=parseInt(split[2]); t++) {
		    $('#star-'+t).attr("src",Drupal.settings.fullpath + "/sites/all/themes/ikea/images/css/rated-star.png");
		  }
		}
/*
		if(split[3] && split[3] == 'half') {
		  next = parseInt(split[2])
		  next = next + 1;
		  $('#star-'+next).attr("src",Drupal.settings.fullpath + "/sites/all/themes/ikea/half-rated-star.png");
		}
*/
	  }
	 s.t({pageName:'IKEA FAMILY LIVE>On pop up pics - Clicks on Rate it'}); 
	// callTrackInfo('IKEA FAMILY LIVE>On pop up pics - Clicks on Rate it');
     return false;
   });
  return false;
}


/*
function changefivstar(number) {
  var source = $('#star-' + number).attr("src");
  if(source != Drupal.settings.fullpath + "/sites/all/themes/ikea/images/css/rated-star.png") {
 //   $('#star-' + number).attr("src",Drupal.settings.fullpath + "/sites/all/themes/ikea/images/css/rated-star.png");
  }
  return false;
}

function removefivstar(number) {
  var source = $('#star-' + number).attr("src");
//  alert(source);
 // alert(Drupal.settings.fullpath + "/sites/all/themes/ikea/images/css/rated-star.png");
  if(source != Drupal.settings.fullpath + "/sites/all/themes/ikea/images/css/rated-star.png" && source != Drupal.settings.fullpath + "/sites/all/themes/ikea/images/css/rate-star.png") {
  //  $('#star-' + number).attr("src",Drupal.settings.fullpath + "/sites/all/themes/ikea/images/css/rate-star.png");
  }
  return false;
}

*/
function likeit_homestories(nid,ipaddr,userid) {
	$.post(Drupal.settings.fullpath + "/likeithomestories", {nodeid : nid, userid : userid, ipaddr : ipaddr},
		function(content) {
		  if(content)	 {
			if(content == 1) {
			   $('.like-it').addClass('smile');
			   s.t({pageName:'IKEA FAMILY LIVE>Clicks on Like it'}); 
			   //callTrackInfo('IKEA FAMILY LIVE>Clicks on Like it');
			}
		  }
		   return false;
         }); 
         return false;
  }
  
  function likeit_roomstories(nid,delta,ipaddr,userid) {
	$.post(Drupal.settings.fullpath + "/likeitroomstories", {nodeid : nid,delta : delta, userid : userid, ipaddr : ipaddr},
		function(content) {
		  if(content)	 {
			if(content == 1) {
			   $('.like-it').addClass('smile');
			   s.t({pageName:'IKEA FAMILY LIVE>Clicks on Like it'}); 
			  // callTrackInfo('IKEA FAMILY LIVE>Clicks on Like it');
			}
		  }
		   return false;
         }); 
         return false;
  }  
  
function change_next_home_template1(nodeid) {
  deltano = $('#arrow-next').val();
  totalbgs = $('#total-backs').val();
  $('.left-bg').css('display','block');
   $.post(Drupal.settings.fullpath  + "/changetemplate1", { nodeid: nodeid, deltano : deltano, totalbgs : totalbgs },
	 function(content) {
	   if(content){
	                  var splitcontent = content.split('####');
		  if(splitcontent[0]) {
			//  $('.background-1').css('background','none').hide('slow');
			  //$('.background-1').hide("slide", { direction: "right" });
			  $('.background-1').css('background-image','url('+ splitcontent[0] +')');
			  $('.background-1').show("slide", { direction: "right" }); 
			  //$('.background-1').css('height','650px').show("slide", { direction: "right" });
			  $('#arrow-next').val(splitcontent[1]);
                          var capdel = $('#deltano1').val();
                           capdel = parseInt(capdel) + 1;
                           $('#deltano1').val(capdel);
	      }
	      
	     if(parseInt(splitcontent[2]) == 1) {
		$('.right-bg').css('display','none');
	      }
	    }
            return false;
	 });	 
	  return false;
}


function change_prev_home_template1(nodeid) {
  deltano = $('#arrow-next').val();
  totalbgs = $('#total-backs').val();
  $('.right-bg').css('display','block');
  $.post(Drupal.settings.fullpath  + "/changeprevtemplate1", { nodeid: nodeid, deltano : deltano, totalbgs : totalbgs },
	 function(content) {
	   if(content){
	                  var splitcontent = content.split('####');
		  if(splitcontent[0]) {
			 // $('.background-1').css('background','none').hide('slow');
			 // $('.background-1').hide("slide", { direction: "left" });
			  $('.background-1').css('background-image','url('+ splitcontent[0] +')');
			  //$('.background-1').css('height','650px').show('slow');
			  $('.background-1').show("slide", { direction: "left" }) 
//			  $('.background-1').css('height','650px').show("slide", { direction: "left" });
			  $('#arrow-next').val(splitcontent[1]);
                           var capdel = $('#deltano1').val();
                           capdel = parseInt(capdel) - 1;
                           $('#deltano1').val(capdel);
	      }
	      
	     if(parseInt(splitcontent[2]) == 1) {
		$('.left-bg').css('display','none');
	      }
	    }
            return false;
	 });
	  return false;	 
}

//function save_box_pos(boxname,posleft,postop) {
//   $.post(Drupal.settings.fullpath + "/saveboxpositions", {boxname: boxname, posleft: posleft, postop: postop},
//           function(content) {
//            
//           });   
//} 
 
function callTrackInfo(trackText)
{
 var trackInfo = trackText;
 s.pageName = trackInfo;
 s.track();
}
 

function OmnitureTrack(str) {
  callTrackInfo(str);
}

function approveit(nid) {
  window.location = Drupal.settings.fullpath + "/node/" + nid + "/approve";
}

function textareaMaxLength(field, evt, limit) {
  var evt = (evt) ? evt:event;
  var charCode =
    (typeof evt.which != "undefined") ? evt.which :
   ((typeof evt.keyCode != "undefined") ? evt.keyCode : 0);

  if (!(charCode >= 13 && charCode <= 126)) {
    return true;
  }
  /*$('.remain-chars').html('');
  var remain = limit - field.value.length; 
  $('.remain-chars').html('Characters left are '+ remain);*/
  return (field.value.length < limit);
}
