
var INT_TK_AFF_ID=3,INT_TK_HOST='templatekingdom.com',INT_TK_WEBROOT='http://www.templatekingdom.com',INT_CurrentUri='',INT_WL_TKP=['35','2689','39179','56923'];INT_TK_DETECTED_AFF_ID=null;var aSources={'39179':{'url':'http://www.crystalgraphics.com/web/webtemplates.main.asp','anchorText':'CrystalGraphics.com'},'56923':{'host':'designs.openwebdesign.org','url':'http://www.openwebdesign.org/','anchorText':'Open Web Design'}};var aSourceTKUrls=['/','http://www.templatekingdom.com','http://templatekingdom.com','http://templatekingdom.com/','http://www.templatekingdom.com','http://www.templatekingdom.com/'];INT_Uri={parse:function(str){var o=INT_Uri.options,m=o.parser[o.strictMode?"strict":"loose"].exec(str),uri={},i=14;while(i--){uri[o.key[i]]=m[i]||"";}
uri[o.q.name]={};uri[o.key[12]].replace(o.q.parser,function($0,$1,$2){if($1){uri[o.q.name][$1]=$2;}});return uri;},options:{strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},debugObject:function(obj){var strMsg='';switch(typeof obj){case'string':alert(obj);break;case'object':for(var property in obj){strMsg+='\n '+property+' => '+obj[property];}
alert(strMsg);break;default:alert(obj.toString());break;}},in_array:function(needle,haystack){var found=false,key;strict=false;for(key in haystack){if((strict&&haystack[key]===needle)||(!strict&&haystack[key]==needle)){found=true;break;}}
return found;}};function initPage(){INT_CurrentUri=INT_Uri.parse(location.href);aSearchParams=INT_CurrentUri.queryKey;strTemplateKey='';srcAddToCartButton=INT_TK_WEBROOT+'/themes/default/images/buttons/buy-template.gif';var urlTemplateViewPage=INT_CurrentUri.source.replace(/\/demo/,'');aTemplateInfo=INT_CurrentUri.source.match(/\/demo\/([^\/]*)\/([^\/]*)\/([^\/]*)\//);strTemplateKey=aTemplateInfo[3];var urlTemplateBuyPage=INT_TK_WEBROOT+'/Cart/action/add/templateId/'+strTemplateKey+'/';if(aSearchParams['tkp']){INT_TK_DETECTED_AFF_ID=aSearchParams['tkp'];}else{for(affId in aSources){aSourceInfo=aSources[affId];if(aSourceInfo['host']){if(INT_CurrentUri.host==aSourceInfo['host']){INT_TK_DETECTED_AFF_ID=affId;break;}}}}
if(INT_TK_DETECTED_AFF_ID){var affId=INT_TK_DETECTED_AFF_ID;var cookieExpiryDate=new Date();cookieExpiryDate.setFullYear(cookieExpiryDate.getFullYear()+1);urlTemplateBuyPage+='?tkp='+affId;strCookie='INT_TK_AFFILIATE='+affId+';'+' expires='
+cookieExpiryDate.toUTCString()+';'+' path=/; domain='+INT_TK_HOST;document.cookie='INT_TK_AFFILIATE='+affId+';'+' expires='
+cookieExpiryDate.toUTCString()+';'+' path=/; domain='+INT_TK_HOST;if(INT_Uri.in_array(affId,INT_WL_TKP)){changeWhiteLabelSourceLinks(affId);return;}}
var strHTML=''+'            <div id="tkOptions">'
+'              <!-- Add to Cart Button -->'
+'              <a href="'+urlTemplateBuyPage+'"'
+'              title="Buy this Template" rel="nofollow"><img '
+'    src="'+srcAddToCartButton+'" border="0"'
+'    alt="Buy this Template" title="Buy this Template" /></a>'
+'            </div>'+'';objUiDiv_Options=document.createElement('div');objUiDiv_Options.setAttribute('id','id_UiDiv_Options');objUiDiv_Options.setAttribute('style',getStyleInfo());document.body.appendChild(objUiDiv_Options);objUiDiv_Options.innerHTML=strHTML;}
function changeWhiteLabelSourceLinks(affId){if(aSources[affId]&&aSources[affId]['url']&&aSources[affId]['anchorText']){strSourceUrl=aSources[affId]['url'];strSourceAnchorText=aSources[affId]['anchorText'];aAnchorTags=document.getElementsByTagName('a');for(var i=0;i<aAnchorTags.length;i++){oAnchorTag=aAnchorTags[i];if(oAnchorTag.href&&INT_Uri.in_array(oAnchorTag.href,aSourceTKUrls)){oAnchorTag.href=strSourceUrl;oAnchorTag.innerHTML=strSourceAnchorText;if(oAnchorTag.title){oAnchorTag.title='';}}
if(oAnchorTag.href.search(/templatekingdom/i)!=-1){oAnchorTag.href=strSourceUrl;if(oAnchorTag.title){oAnchorTag.title='';}}}}}
function getStyleInfo(){var strStyleInfo=''+'    margin: 10px;'+'    padding: 5px 10px;'
+'    background-color: #808080;'+'    overflow: auto;'
+'    opacity: 0.9;'+'    font-size: 0.9em;'
+'    color: #333;'+'    text-align: left;'
+'    z-index: 9999;'+'    position: absolute;'+'    top: 0;'
+'    right: 0;';return strStyleInfo;}
