/**
 *  jQuery Plugin highlightFade (jquery.offput.ca/highlightFade)
 *  (c) 2006 Blair Mitchelmore (offput.ca) blair@offput.ca
 */
/**
 * This is version 0.7 of my highlightFade plugin. It follows the yellow fade technique of Web 2.0 fame
 * but expands it to allow any starting colour and allows you to specify the end colour as well.
 *
 * For the moment, I'm done with this plug-in. Unless I come upon a really cool feature it should have
 * this plug-in will only receive updates to ensure future compatibility with jQuery.
 *
 * As of now (Aug. 16, 2006) the plugin has been written with the 1.0.1 release of jQuery (rev 249) which
 * is available from http://jquery.com/src/jquery-1.0.1.js
 *
 * A note regarding rgb() syntax: I noticed that most browsers implement rgb syntax as either an integer 
 * (0-255) or percentage (0-100%) value for each field, that is, rgb(i/p,i/p,i/p); however, the W3C 
 * standard clearly defines it as "either three integer values or three percentage values" [http://www.w3.org/TR/CSS21/syndata.html] 
 * which I choose to follow despite the error redundancy of the typical behaviour browsers employ.
 *
 * Changelog:
 *
 *    0.7:
 *        - Added the awesome custom attribute support written by George Adamson (slightly modified)
 *        - Removed bgColor plugin dependency seeing as attr is customizable now...
 *    0.6:
 *        - Abstracted getBGColor into its own plugin with optional test and data retrieval functions
 *        - Converted all $ references to jQuery references as John's code seems to be shifting away
 *          from that and I don't want to have to update this for a long time.
 *    0.5:
 *        - Added simple argument syntax for only specifying start colour of event
 *        - Removed old style argument syntax
 *        - Added 'interval', 'final, and 'end' properties
 *        - Renamed 'color' property to 'start'
 *        - Added second argument to $.highlightFade.getBGColor to bypass the e.highlighting check
 *    0.4:
 *        - Added rgb(%,%,%) color syntax
 *    0.3:
 *        - Fixed bug when event was called while parent was also running event corrupting the
 *          the background colour of the child
 *    0.2:
 *        - Fixed bug where an unspecified onComplete function made the page throw continuous errors
 *        - Fixed bug where multiple events on the same element would speed each subsequent event
 *    0.1:
 *        - Initial Release
 * 
 * @author          Blair Mitchelmore (blair@offput.ca)
 * @version         0.5
 */
jQuery.fn.highlightFade = function(settings) {
	var o = (settings && settings.constructor == String) ? {start: settings} : settings || {};
	var d = jQuery.highlightFade.defaults;
	var i = o['interval'] || d['interval'];
	var a = o['attr'] || d['attr'];
	var ts = {
		'linear': function(s,e,t,c) { return parseInt(s+(c/t)*(e-s)); },
		'sinusoidal': function(s,e,t,c) { return parseInt(s+Math.sin(((c/t)*90)*(Math.PI/180))*(e-s)); },
		'exponential': function(s,e,t,c) { return parseInt(s+(Math.pow(c/t,2))*(e-s)); }
	};
	var t = (o['iterator'] && o['iterator'].constructor == Function) ? o['iterator'] : ts[o['iterator']] || ts[d['iterator']] || ts['linear'];
	if (d['iterator'] && d['iterator'].constructor == Function) t = d['iterator'];
	return this.each(function() {
		if (!this.highlighting) this.highlighting = {};
		var e = (this.highlighting[a]) ? this.highlighting[a].end : jQuery.highlightFade.getBaseValue(this,a) || [255,255,255];
		var c = jQuery.highlightFade.getRGB(o['start'] || o['colour'] || o['color'] || d['start'] || [255,255,128]);
		var s = jQuery.speed(o['speed'] || d['speed']);
		var r = o['final'] || (this.highlighting[a] && this.highlighting[a].orig) ? this.highlighting[a].orig : jQuery.curCSS(this,a);
		if (o['end'] || d['end']) r = jQuery.highlightFade.asRGBString(e = jQuery.highlightFade.getRGB(o['end'] || d['end']));
		if (typeof o['final'] != 'undefined') r = o['final'];
		if (this.highlighting[a] && this.highlighting[a].timer) window.clearInterval(this.highlighting[a].timer);
		this.highlighting[a] = { steps: ((s.duration) / i), interval: i, currentStep: 0, start: c, end: e, orig: r, attr: a };
		jQuery.highlightFade(this,a,o['complete'],t);
	});
};

jQuery.highlightFade = function(e,a,o,t) {
	e.highlighting[a].timer = window.setInterval(function() { 
		var newR = t(e.highlighting[a].start[0],e.highlighting[a].end[0],e.highlighting[a].steps,e.highlighting[a].currentStep);
		var newG = t(e.highlighting[a].start[1],e.highlighting[a].end[1],e.highlighting[a].steps,e.highlighting[a].currentStep);
		var newB = t(e.highlighting[a].start[2],e.highlighting[a].end[2],e.highlighting[a].steps,e.highlighting[a].currentStep);
		jQuery(e).css(a,jQuery.highlightFade.asRGBString([newR,newG,newB]));
		if (e.highlighting[a].currentStep++ >= e.highlighting[a].steps) {
			jQuery(e).css(a,e.highlighting[a].orig || '');
			window.clearInterval(e.highlighting[a].timer);
			e.highlighting[a] = null;
			if (o && o.constructor == Function) o.call(e);
		}
	},e.highlighting[a].interval);
};

jQuery.highlightFade.defaults = {
	start: [255,255,128],
	interval: 50,
	speed: 400,
	attr: 'backgroundColor'
};

jQuery.highlightFade.getRGB = function(c,d) {
	var result;
	if (c && c.constructor == Array && c.length == 3) return c;
	if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))
		return [parseInt(result[1]),parseInt(result[2]),parseInt(result[3])];
	else if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))
		return [parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55];
	else if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))
		return [parseInt("0x" + result[1]),parseInt("0x" + result[2]),parseInt("0x" + result[3])];
	else if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))
		return [parseInt("0x"+ result[1] + result[1]),parseInt("0x" + result[2] + result[2]),parseInt("0x" + result[3] + result[3])];
	else
		return jQuery.highlightFade.checkColorName(c) || d || null;
};

jQuery.highlightFade.asRGBString = function(a) {
	return "rgb(" + a.join(",") + ")";
};

jQuery.highlightFade.getBaseValue = function(e,a,b) {
	var s, t;
	b = b || false;
	t = a = a || jQuery.highlightFade.defaults['attr'];
	do {
		s = jQuery(e).css(t || 'backgroundColor');
		if ((s  != '' && s != 'transparent') || (e.tagName.toLowerCase() == "body") || (!b && e.highlighting && e.highlighting[a] && e.highlighting[a].end)) break; 
		t = false;
	} while (e = e.parentNode);
	if (!b && e.highlighting && e.highlighting[a] && e.highlighting[a].end) s = e.highlighting[a].end;
	if (s == undefined || s == '' || s == 'transparent') s = [255,255,255];
	return jQuery.highlightFade.getRGB(s);
};

jQuery.highlightFade.checkColorName = function(c) {
	if (!c) return null;
	switch(c.replace(/^\s*|\s*$/g,'').toLowerCase()) {
		case 'aqua': return [0,255,255];
		case 'black': return [0,0,0];
		case 'blue': return [0,0,255];
		case 'fuchsia': return [255,0,255];
		case 'gray': return [128,128,128];
		case 'green': return [0,128,0];
		case 'lime': return [0,255,0];
		case 'maroon': return [128,0,0];
		case 'navy': return [0,0,128];
		case 'olive': return [128,128,0];
		case 'purple': return [128,0,128];
		case 'red': return [255,0,0];
		case 'silver': return [192,192,192];
		case 'teal': return [0,128,128];
		case 'white': return [255,255,255];
		case 'yellow': return [255,255,0];
	}
};
var message = new Array();
var $cntr =1;
var $locationing = "";
var $nolocation =  "<a href=\"javascript:addFormField();\" class=\"addlink\">Add Another</a>";

message[0] = 'State';
message[1] = "You have selected first item";
message[2] = "You have selected the second item";
message[3] = "You have selected the last item";

function Adderko(num){
		num2 = num+1;
		Cookier('councount',num2)
}
function textshow(id){
	if(id >29){
		var message_index
		$("#message_display").text('');
	}
}
function addFormField() {
	var id = getCookie('councount');
	$("#property").append("<tr id='row" + id + "'><td align='right' width='50%'><span id='message_display'>Location " + id + " Zipcode</span></td><td><input name='Location" + id + "_zipcode' value='' onchange=\"Cookier(Location " + id + " Zipcode,'Location " + id + " Zipcode')\"> <a href='#' onClick='removeFormField(\"#row" + id + "\"); return false;' class='addlink'>x</a></td></tr>");
	
	$('#row' + id).highlightFade({
		speed:1000
	});
	textshow(id);
	id = (id - 1) + 2;
	$cntr = id;
	Cookier('councount',$cntr)
}

function removeFormField(id) {
	$(id).remove();
	var y = getCookie('councount');
	if(y > 2){
		y = y-1
		Cookier('councount',y);
	}
}

function historyFormField(){
	var num = getCookie('councount');

	for (var i =2; i< num;i++ ){
		$("#property").append("<tr id='row" + i + "'><td align='right' width='50%'><span id='message_display'>Location " + i + " Zipcode</span></td><td><input name='Location" + i + "_zipcode' value='"+getCookie('Location " + i + " Zipcode')+"' onchange=\"Cookier(Location " + i + " Zipcode,'Location " + i + " Zipcode')\"> <a href='#' onClick='removeFormField(\"#row" + i + "\"); return false;' class='addlink'>x</a></td></tr>");
	
	}
	
}

$(document).ready(function(){
			var whatwedoid
			$("#whatwedoid").text('"We mind your most important financial transaction so you can sleep well at night!"');
			var escrowworkid
			$("#escrowworkid").text('"We work with you in mind"');
			var getstartedid
			$("#getstartedid").text('"With closing tracker you have 24/7 access to your file"');
			var thumbnailist
			$("#thumbnailist").text('');
			$('#whatwedoid').highlightFade({
				color:'aqua',
				speed:600
			});
			$('#escrowworkid').highlightFade({
				color:'aqua',
				speed:600
			});
			$('#getstartedid').highlightFade({
				color:'aqua',
				speed:600
			});
});

function Cookier(name, value){
	document.cookie = name+"="+value;
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

function Switcher(show){
		var homepage
		$("#homepage").text('');
		
		var mainer
		$("#mainer").text('');
		
		Cookier('thumbnailist', 1)
		var thumbnailist
		$("#thumbnailist").append('<table width="100%"  border="0" cellpadding="20" cellspacing="0"><tbody id="mainer"></tbody></table>');
		
		if(show == 'whatwedo'){


			
			
			Cookier('whatwedoid', 1)
			$("#mainer").append('<tr><td valign="top"  style="background:url(images/blue-grad.jpg) left top repeat-x #002953;">	<a name="whatwedo" id="whatwedo"></a><div class="check-title">What We Do</div><span id="whatwedoid" style="color:#FFFFFF; font-style:italic;">We mind your most important financial transaction so you can sleep well at night!</span><br />Southwest Escrow Corp. brings together the best of both worlds — state-of–the-art technology and good old-fashioned customer service — to bring you innovative solutions and personalized service for your escrow needs. Whether it be the purchase or sale of a home or commercial property, short sales and foreclosures, or refinance escrows, we can help.</td>');
			$('#whatwedoid').highlightFade({
				color:'aqua',
				speed:600
			});
			

		}else if(show == 'escrowwork'){
			
			$("#mainer").append('<td valign="top" bgcolor="#002F5E"><a name="escrowwork" id="escrowwork"></a><div class="check-title">How Escrow works?</div><span id="escrowworkid" style="color:#FFFFFF; font-style:italic;">We work with you in mind</span><br />The principals to the escrow, namely the buyer, the seller, the lender and the borrower -  cause escrow instructions, most usually in writing, to be created, signed and delivered to the escrow officer.  The escrow officer will process the escrow, in accordance with the escrow instructions, and when all conditions required in the escrow are met or achieved, the escrow will be "closed."</td>');

			Cookier('escrowworkid', 1)
			$('#escrowworkid').highlightFade({
				color:'aqua',
				speed:600
			});


		}else if(show == 'getstarted'){
			
			$("#mainer").append('<td width="33%" valign="top" bgcolor="#002F5E" style="border-left:1px solid #002040;"><a name="getstarted" id="getstarted"></a><div class="check-title">Get Started Now</div>			<span id="getstartedid" style="color:#FFFFFF; font-style:italic;">"Closing Tracker" coming soon</span><br />Southwest Escrow Corporation offers a level of technical expertise, insight and resources quite unmatched in the industry. Our wealth of experience cuts across varied industries and types of project, ranging from complex deals to the standard transactions.  Let our team help guide your transaction through to a smooth and successful closing. Check out our Online Tools. <a id="getstartlink" style="color:#ffffff;" href="contactus.php"><br /><strong><em><u>For online support and response, submit requests here</u></em></strong></a></td>');
			Cookier('getstartedid', 1)
			$('#getstartedid').highlightFade({
				color:'aqua',
				speed:600
			});
			
		}else{
			var homepage
			$("#homepage").text('');
		}
}

function SwitchBack(show){
		var homepage
		$("#homepage").text('');
		$("#homepage").append('<div class="title-wrap"><div class="title">Welcome to Southwest Escrow Corporation</div></div><span><strong>Southwest Escrow Corporation</strong> owned by Lyn Kerby and Patricia Carter is a woman owned Minority Company. We are proud to be a part of the legacy of being the oldest independent escrow company in Los Angeles County boasting establishment in 1935, proof of our unwavering commitment to serving the public and the community to which we belong. </span><p>We are a full-service independently owned company whose only business is escrow service. Unlike other firms in the industry, Southwest Escrow Corp. is not a division or part of any real estate or mortgage broker business, insurance or title company, bank or savings loan association. Licensed by the State of California Department of Corporations, our operations and standards are subject to strict regulations and are considered above par. This means our clients are assured that they are receiving only the top-notch quality escrow service they so richly deserve.</p><p>Southwest Escrow Corp. brings together the best of both worlds — state-of–the-art technology and good old-fashioned customer service — to bring you innovative solutions and personalized service for your escrow needs. Indeed, you can depend on our impeccable reputation for your business transactions, whether it be the purchase or sale of a home or commercial property, short sales and foreclosures, or refinance escrows.</p><p>This website gives an overview of our available services. Should you have any questions or would want to have more information, please give us a call at (310) 674-7660. Our friendly and courteous Escrow Agents and Officers are available 24/7 to entertain your queries or arrange for appointments.</p>');
		
		/*$('#homepage').highlightFade('aqua')({
			speed:2000
		});*/ 
		
}


