// ----------------------------------------------
// REALOGY - Base User Interface Tools
//
// Date: Apr 25, 2006
// Devl: Derek Alldritt
// Revision: 1.0
// ----------------------------------------------

function quickSearch() {
	if (document.quickSearchForm.qt.value > "") {
		document.quickSearchForm.submit();
	} else {
		alert("Please input a search term to continue");
	}
}

function quickSearch1() {
        if (document.quickSearchForm1.qt.value > "") {
                document.quickSearchForm1.submit();
        } else {
                alert("Please input a search term to continue");
        }
}


// ----------------------------------------------
// StyleSwitcher functions written by Paul Sowden
// http://www.idontsmoke.co.uk/ss/
// - - - - - - - - - - - - - - - - - - - - - - -
// For the details, visit ALA:
// http://www.alistapart.com/stories/alternate/
//
// nifty StyleSwitcher scripts modified by Aaron Jones 10/10/2002
// ----------------------------------------------

function setActiveStyleSheet(title, reset) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
  if (reset == 1) {
	  createCookie("wstyle", title, 365);
  }
}
function setStyle() {
	var style = readCookie("wstyle");
	if (style != null) {
		setActiveStyleSheet(style, 0);
	}
}


// ----------------------------------------------
// Cookie functions
// ================
// - Pretty self explanitory, I hope.
// ----------------------------------------------

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = ";expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+";domain=.affinion.quarry.com;path=/;";
}
function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}


// ----------------------------------------------
// HyperLink functions
// ===================
// - Rolls one graphic to another in say, a menu.
// ----------------------------------------------

function roll(file, tag) {
	document.images[tag].src = file;
}

// ----------------------------------------------
// FLASH LOAD FUNCTION - INDEX.CFM
// - This is an interesting work around to a 
//   patent infringement.  This function MUST
//   call the object as part of the patent
//   workaround.  Lovely.
// ----------------------------------------------

function writeFlash() {
		document.write('<div class="FlashHeader">');
		document.write('<object  width="776" height="230" id="flashbanner" align="middle">');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<param name="movie" value="/flash/flashbanner.swf" />');
		document.write('<param name="loop" value="false" />');
		document.write('<param name="menu" value="false" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="play" value="true" />');
		document.write('<param name="wmode" value="opaque" />');
		document.write('<param name="bgcolor" value="#ffffff" />');
		document.write('<embed src="/flash/flashbanner.swf" loop="false" play="true" menu="false" quality="high" wmode="opaque" bgcolor="#ffffff" width="776" height="230" name="home_flash02" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
		document.write('</div>');
}

// ----------------------------------------------
// FLASH LOAD FUNCTION - /solutions/marketing_channels.cfm
// - This is an interesting work around to a 
//   patent infringement.  This function MUST
//   call the object as part of the patent
//   workaround.  Lovely.
// ----------------------------------------------

function writeMarketingFlash() {
		document.write('<div class="FlashHeader">');
		document.write('<object  width="660" height="520" id="flashbanner" align="middle">');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<param name="movie" value="/flash/marketingbanner.swf" />');
		document.write('<param name="loop" value="false" />');
		document.write('<param name="menu" value="false" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="play" value="true" />');
		document.write('<param name="wmode" value="opaque" />');
		document.write('<param name="bgcolor" value="#ffffff" />');
		document.write('<embed src="/flash/marketingbanner.swf" loop="false" play="true" menu="false" quality="high" wmode="opaque" bgcolor="#ffffff" width="660" height="520" name="home_flash02" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
		document.write('</div>');
}

// EOF

