var fc={},setterGetterReady=false;var Url={encode:function(string){return escape(this._utf8_encode(string))},decode:function(string){return this._utf8_decode(unescape(string))},_utf8_encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c)}else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128)}else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128)}}return utftext},_utf8_decode:function(utftext){var string="",i=0,c,c1,c2;c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++}else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2}else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3}}return string}};gsReady=function(){return setterGetterReady};hasValue=function(val){var notEmpty=false;if(val!==undefined){switch(typeof val){case"string":if(val!==""){notEmpty=true}break;case"number":if(parseInt(val)>0){notEmpty=true}break}}return notEmpty};function getMovie(movieName){if(navigator.appName.indexOf("Microsoft")!=-1){return window[movieName]}else{return document[movieName]}}$(document).ready(function(){getRef=function(){fc=getMovie('getset')};setReady=function(){setterGetterReady=true;var frmArr=$('form');if(frmArr!==undefined&&frmArr.length>0){return true}else{return false}};setFc=function(fldObj){var fcObj={};fcObj.type="general";for(var i in fldObj){if(hasValue(fldObj[i])){switch(i.toLowerCase()){case"stocknum":case"stocknumber":fcObj.stocknum=fldObj[i];fcObj.type='inventory';break;case"vin":fcObj.vin=fldObj[i];fcObj.type='inventory';break;case"type":fcObj.type=fldObj[i];break;case"year":case"modelyear":case"model_year":fcObj.year=fldObj[i];break;case"make":fcObj.make=fldObj[i];break;case"model":fcObj.model=fldObj[i];break;case"trim":case"trimlevel":case"trim_level":fcObj.trim=fldObj[i];break;case"imagepath":fcObj.imagepath=fldObj[i];break;case"formsid":if(fldObj[i]==="167"){fcObj.type="inventory"}break}}}fc.setFCValues(fcObj)};prePop=function(cki){};getFC=function(){var tmp=fc.getFCValues();for(var i in tmp){if(typeof tmp[i]!=='object'){tmp[i]=Url.decode(tmp[i])}}return tmp};$('body').prepend("<div id='getset'></div>");swfobject.embedSWF('/Assets/PromotionCenter/Certificate/Flash/setter-getter.swf','getset','1','1','8,0,0,0',false,{siteid:s,servername:servername},{wmode:'transparent',allowScriptAccess:'always'},{},getRef);$('form').submit(function(ev){var fldArr=$(this).serialize().split('&');var fldObj={};for(var i=0;i<fldArr.length;i++){var tmp=fldArr[i].split('=');fldObj[tmp[0]]=tmp[1]||""}setFc(fldObj);return true});echo=function(){if(window.console){console.log(arguments)}else{alert(arguments)}}});
