// JavaScript Document

// Font size for blog titles

/*$(document).ready(function() {

	//alert('yes');


	$('.update_title').each(function(){
	
		var l = $(this).text().length;
		
		//alert(l);
		
		if (l <= 14){
			$(this).css({"font-size":"38px", "line-height":"42px"})
		}
		else if (14 < l && l <= 26){
			$(this).css({"font-size":"30px", "line-height":"38px"})
		}
		else if (26 < l && l <= 36){
			$(this).css({"font-size":"24px", "line-height":"32px"})
		}
		else{
			$(this).css({"font-size":"18px", "line-height":"26px"})
		}
		
		//var t = $(this).text();
		//alert(t);
		
		//d = t.slice(12);
		
		//$(this).text(d);
	
	});

 });*/


// OO Comment form JS
$(document).ready(function() {
	
	//Constructor
	function formField(id,valueN,valueO){
		this.id=id;
		this.valueN=valueN;
		this.valueO=valueO;
		//alert('The '+id+' field needs a value of '+value);
	}
	
	//New methods for the 'formField' class
	function fillVal(){
		var thisId = '#'+this.id;
		var thisValN = this.valueN;
		var thisValO = this.valueO;
		//alert(thisId+","+thisVal);
		if($(thisId).val()==thisValO){
			$(thisId).val(thisValN);	
		}
	}
	
	function focusVal(){
		var thisId = '#'+this.id;
		var thisVal = this.valueN;
		$(thisId).focus(function(){
			//alert(thisId+','+thisVal);
			if($(this).val()==thisVal){
				$(this).val('');	
			}
		});	
	}
	
	function blurVal(){
		var thisId = '#'+this.id;
		var thisVal = this.valueN;
		$(thisId).blur(function(){
			if($(this).val()==""){
				$(this).val(thisVal);	
			}
		});	
	}
	
	//Set the method prototypes
	formField.prototype.fillVal=fillVal;
	formField.prototype.focusVal=focusVal;
	formField.prototype.blurVal=blurVal;
	
	//Create data array
	var thisField = new Array(11); 
	thisField[0]= new formField("comment_textarea","Type something!","");
	thisField[1]= new formField("comment_name","enter a screen name","");
	thisField[2]= new formField("comment_url","URL (optional)","http://");
	thisField[3]= new formField("comment_email","enter a your email address","");
	thisField[4]= new formField("comment_captcha","copy the text below","");
	thisField[5]= new formField("contact_name","Who are you?","");
	thisField[6]= new formField("contact_message","What can we do for you?","");
	thisField[7]= new formField("contact_email","What is your email address?","");
	thisField[8]= new formField("contact_subject","Message subject","");
	thisField[9]= new formField("contact_captcha","Copy the text below","");
	thisField[10]= new formField("header_search_input","search","");
	thisField[11]= new formField("mce-EMAIL","your email address","");
	thisField[12]= new formField("contact_budget","Approximate budget?","");	
	
	//thisField[2].focusVal();
	//alert(thisField.length);
	
	//Call the method in the object
	for(i=0; i<thisField.length; i++){
		thisField[i].fillVal();
		thisField[i].focusVal();
		thisField[i].blurVal();
	}
	

});




// Flash timing

function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}


function StopFlashMovie()
{
	var flashMovie=getFlashMovieObject("flashSlider01");
	flashMovie.StopPlay();
}

function PlayFlashMovie()
{
	var flashMovie=getFlashMovieObject("flashSlider01");
	flashMovie.Play();
	//embed.nativeProperty.anotherNativeMethod();
}

// Insert quote marks before and after block quotes

function insertQuote() {
	  	var newSpan = document.createElement("span");
		newSpan.className='left_quote';
		var spans = document.getElementsByTagName('blockquote');
		var i = 0;
		for(i=0; i<spans.length; i++){
			//alert(i);
			spans[i].parentNode.insertBefore(newSpan,spans[i]);
		}
}	

$(document).ready(function() {
 	insertQuote();
});

