/*
 Fading News Items. To add a new item use
 "number":"text here"

 Only put comma after the item i.e "number":"text here",
 if there is a succeeding item after the one you have added.

 if your text contains the character " (double quote) escape the double quote character with backslash i.e \"
 so the script wont break.
*/
$('img').src='';
var newsitems=[
  {"img":"images/seat_thumbnail.jpg","text":"<strong class=\"Ocolor\">SEAT UAE</strong><br />Seat in the UAE has decided to add the Creativo CRM tool to their web site. The CRM will assist Seat in capturing all their existing and potential clients. It will further support the communication department to actively inform both groups of their activities, new services and products. These communications can be sent out via sms or e-Newsletter."},
  {"img":"images/creativonews_thumbnail.jpg","text":"<strong class=\"Ocolor\">CREATIVO NEWSLETTER</strong><br />We decided to widen our e-Marketing options and tools as well as our back end solutions. For companies operating in a highly competitive market or market segment, e-Marketing can be an extremely price competitive option to reach a specific target group and achieve not only higher recognition but also a much stronger market position."},
  {"img":"images/geant_thumbnail.jpg","text":"<strong class=\"Ocolor\">FU-COM GROUP</strong><br />FU-Com decided to engage in e-Newsletter broadcasts for its companies Geant, Le Marche and Last Chance. Creativo is in the process of installing its CRM tool on the back of the respective web sites to capture e-Newsletter requests by their customers. Through the CRM of Creativo the respective clients will be extracted and addressed."},
  {"img":"images/edmonton_thumbnail.jpg","text":"<strong class=\"Ocolor\">EDMONTON ADMIRE PROPERTIES</strong><br />One of Dubaiīs finest real estate developer, Edmonton Admire has launched their web site developed by Creativo. The site is giving an in-depth inside on their philosophy and is also highlighting on Edmontonīs three prestigious developments Edmonton Azur, Elm and Grove. "},
]
/*
var newsitems={
  "1":"One of Dubaiīs finest real estate developer, Edmonton Admire has launched their web site developed by Creativo. The site is giving an in-depth inside on their philosophy and is also highlighting on Edmontonīs three prestigious developments Edmonton Azur, Elm and Grove.",
  "2":"One of Dubaiīs finest real estate developer, Edmonton Admire has launched their web site developed by Creativo. The site is giving an in-depth inside on their philosophy and is also highlighting on Edmontonīs three prestigious developments Edmonton Azur, Elm and Grove.",
  "3":"One of Dubaiīs finest real estate developer, Edmonton Admire has launched their web site developed by Creativo. The site is giving an in-depth inside on their philosophy and is also highlighting on Edmontonīs three prestigious developments Edmonton Azur, Elm and Grove."
}
*/
/*
 Services Auto change. To add a new item use
 {"img":"path to image","text":"Teaser Text Here"}

 Only put comma after the item i.e {"img":"path to image","text":"Teaser Text Here"},
 if there is a succeeding item after the one you have added.

 if your text contains the character " (double quote) escape the double quote character with backslash i.e \"
 so the script wont break.
*/


var servicesitems=[
  {"img":"images/website-teaser.png","text":"When developing consumer web sites, we are focusing first and foremost on the requirement of the client."},
  {"img":"images/hosting-teaser.png","text":"All CreativO clients will enjoy the benefits of a dedicated server owned by CreativO. Server time is 99.8% guaranteed. Spam packages are installed making your web mail nearly spam free."},
  {"img":"images/emarketing-teaser.png","text":"eMarketing and its various disciplines can be used successfully as a branding tool to achieve long term strategic goals and/or as short term result oriented response vehicle."},
  {"img":"images/cms-teaser.png","text":"Whether you are a small-to-medium-size business or a large enterprise CreativO CMS easily scales to meet the publishing needs of the most demanding websites, and can be used worldwide."},
  {"img":"images/broadcasting-teaser.png","text":"Direct mail through the internet is a communication tool more and more professional companies are using. We is offering this mail service using either our own database or the clientīs database."},
  {"img":"images/webapp-teaser.png","text":"Unique to Creativo is our development process and phased approach implementing and launching your custom web application. Our process of setting and meeting client goals has been proven time and time again."},
]

function replaceElement(selector,color,font){
  sIFR.useStyleCheck = true;
  sIFR.activate(font);
  sIFR.replace(font, {
    wmode:'opaque',
    selector: selector,
    css: {
      '.sIFR-root':{ 'color': color}
    }
  });

}

function replaceLinks(selector,color,hover,font){
  sIFR.replace(font, {
    wmode:'opaque',
    selector: selector
    ,css: [
      '.sIFR-root {}'
      ,'a { text-decoration: none }'
      ,'a:link{color: #545454}'
      ,'a:hover { color: #e86013}'
    ]
  });

 //sIFR.debug.ratios({src: 'swf/optimaRegular.swf', selector: selector });
}

function news_initCallback(carousel) {
  $('.jcarousel-control a').bind('click', function() {
      carousel.scroll($.jcarousel.intval($(this).text()));
      return false;
  });
};

function services_initCallback(carousel){
  $('#slistener').remove();
  $('body').append('<b id="slistener"></b>');
  $('#slistener').bind('click', function(event,data) {
      carousel.scroll(data);
      return false;
  });
};

$('document').ready(function(){
  //Effects for news item

  $('.control ul li').each(function(){$(this).remove()});
  var ul=$('#newscarousel ul');
  var divcontrol=$('.jcarousel-control');
  ctr=1;
  $('#newscarousel ul li').each(function(){$(this).remove();});
  for(var item in newsitems){
    ul.append('<li><p class="thumb"><img src="'+newsitems[item]['img']+'"/></p><p class="newsitem">'+newsitems[item]['text']+'</p><b style="clear:both;"></b></li>');
    divcontrol.append('<a href="#">'+ctr+'</a>');
    ctr++;
  }

  $('#servicescarousel ul li').each(function(){$(this).remove()});
  var uls=$('#servicescarousel ul');
  var str;
  for(var j in servicesitems){
	str='<li style="width:240px !important;"><p><img src="'+servicesitems[j]['img']+'" alt="Website Design Development" title="Website Design Development" />';
	str+='</p><p class="medtext-desc">'+servicesitems[j]['text']+'</p></li>';
	uls.append(str);
  }


  //Effects for Auto Change teaser
  var ctr=1;
  var len=servicesitems.length;

  setInterval(function(){
    if(ctr>len) ctr=1;
    $('#slistener').trigger('click',[ctr]);
    ctr++;
  },5000);



  //SIFR

  //Initialize fonts here. Create different objects for different fonts

  //replaceElement('.news-textcontent p.sifr','#7B7776',optima);
  //replaceElement('.medtext-desc','#969291',optima);
  //replaceElement('.cl-container p.feedback,.cl-container p.cl_poster','#7B7776',optima);
  //replaceElement('.cl-container p.cl_name','#FE6501',optima);
  //replaceLinks('.articles-container ul li','#545454','#e86013',optima);


  //Sliders Init

  $("#newscarousel").jcarousel({
      scroll: 1,
      initCallback: news_initCallback,
      // This tells jCarousel NOT to autobuild prev/next buttons
      buttonNextHTML: null,
      buttonPrevHTML: null
  });

  $("#servicescarousel").jcarousel({
      scroll: 1,
      initCallback: services_initCallback,
      // This tells jCarousel NOT to autobuild prev/next buttons
      buttonNextHTML: null,
      buttonPrevHTML: null
  });

  //Sliders Init

});

  var optima = {
    src: 'swf/optimaRegular.swf'
    ,ratios: [7, 1.32, 11, 1.31, 13, 1.24, 14, 1.25, 19, 1.23, 27, 1.2, 34, 1.19, 42, 1.18, 47, 1.17, 48, 1.18, 69, 1.17, 74, 1.16, 75, 1.17, 1.16]
  };

  /*
  var gothic = {
    src: 'swf/gothic.swf'
    ,ratios: [7, 1.32, 11, 1.31, 13, 1.24, 14, 1.25, 19, 1.23, 27, 1.2, 34, 1.19, 42, 1.18, 47, 1.17, 48, 1.18, 69, 1.17, 74, 1.16, 75, 1.17, 1.16]
  };
  */
  if(typeof sIFR == "object"){
    replaceElement('.contentwrapper h2','#68584D',optima);
  }

