/* ajaxrating.js */
function rateImg(rating,imgId) {
 var httpRequest;
 if (window.XMLHttpRequest) { // Mozilla, Safari, ...
 httpRequest = new XMLHttpRequest();
 if (httpRequest.overrideMimeType) {
 httpRequest.overrideMimeType('text/xml');
 // See note below about this line
 }
 }
 else if (window.ActiveXObject) { // IE
 try {
 httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
 }
 catch (e) {
 try {
 httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
 }
 catch (e) {}
 }
 }
 if (!httpRequest) {
 alert('Giving up :( Cannot create an XMLHTTP instance');
 return false;
 }
 httpRequest.onreadystatechange = function() {
 //alertContents(httpRequest);
 if (httpRequest.readyState ==4 && httpRequest.status == 200){
 results = httpRequest.responseText.split(",");
 document.getElementById('current-rating'+imgId).style.width = results[1]*10 + '%';
 document.getElementById('uservotes_'+imgId).innerHTML = "("+results[0]+" Votes)";
 document.getElementById('results'+imgId).innerHTML = " Thanks for voting";
 }
 };
 url = '/perl/ajaxrate.cgi?rate='+rating+'&ID='+imgId;
 httpRequest.open('GET', url, true);
 httpRequest.send('');
 }
/* END ajaxrating.js */
/* ajax.js */
function $(e){if(typeof e=='string')e=document.getElementById(e);return e};
function collect(a,f){var n=[];for(var i=0;i<a.length;i++){var v=f(a[i]);if(v!=null)n.push(v)}return n};
 ajax={};
 ajax.x=function(){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(e){return new XMLHttpRequest()}}};
 ajax.serialize=function(f){var g=function(n){return f.getElementsByTagName(n)};var nv=function(e){if(e.name)return encodeURIComponent(e.name)+'='+encodeURIComponent(e.value);else return ''};var i=collect(g('input'),function(i){if((i.type!='radio'&&i.type!='checkbox')||i.checked)return nv(i)});var s=collect(g('select'),nv);var t=collect(g('textarea'),nv);return i.concat(s).concat(t).join('&');};
 ajax.send=function(u,f,m,a){var x=ajax.x();x.open(m,u,true);x.onreadystatechange=function(){if(x.readyState==4)f(x.responseText)};if(m=='POST')x.setRequestHeader('Content-type','application/x-www-form-urlencoded');x.send(a)};
 ajax.get=function(url,func){ajax.send(url,func,'GET')};
 ajax.gets=function(url){var x=ajax.x();x.open('GET',url,false);x.send(null);return x.responseText};
 ajax.post=function(url,func,args){ajax.send(url,func,'POST',args)};
 ajax.update=function(url,elm){var e=$(elm);var f=function(r){e.innerHTML=r};ajax.get(url,f)};
 ajax.submit=function(url,elm,frm){var e=$(elm);var f=function(r){e.innerHTML=r};ajax.post(url,f,ajax.serialize(frm))};
/* END ajax.js */
function addToFavorites()
 {if (window.external) { window.external.AddFavorite(window.location, document.title); }
 else { alert("Netscape users, please press <CTRL>D to bookmark this page."); }
}
function goUrl(Selected) {var newURL = Selected.options[Selected.selectedIndex].value;
 if (newURL!==" ") {location.href = newURL;}
 }
function switchMenu(obj) {
 var el = document.getElementById(obj);
 if ( el.style.display != 'none' ) {
 el.style.display = 'none';
 } else {
 el.style.display = '';
 }
}
registerEvent(window, 'onload', function () { hideObjects('paging_button', 'paging_button2'); });
/* utils.js */
function unregisterEvent(object, event, handler) {
 if (!(object && event && handler))
 {  return;}
 var events = object[event + 'Events'];
 if (!events)
 { return;}
 for (var i = 0; i <events.length; i++){
 if (object[event + 'Events'][i] == handler){
 return object[event + 'Events'].splice(i, 1);}}
}
function _eventHandler(event) {
 if (!event) {event = window.event;}
 var events = this['on' + event.type + 'Events'];
 if (!events){return;}
 for (var i = 0; i <events.length; i++) {
 this.eventMethod = events[i];
 if (this.eventMethod(event) === false) {
 this.eventMethod = null;
 return false;
 }
 this.eventMethod = null;
 }
}
function registerEvent(object, event, handler) {
 if (!(object && event && handler)) {return;}
 var events = object[event + 'Events'];
 if (!events) {
 object[event + 'Events'] = object[event] ? [object[event], handler] : [handler];
 object[event] = _eventHandler;
 } else {
 object[event + 'Events'][events.length] = handler;
 }
}
function hideObjects() {
 var args = hideObjects.arguments;
 for (var i = 0; i <args.length; i++) {
 var obj = document.getElementById(args[i]);
 if (obj) {obj.style.display = 'none';}
 }
}
 function like(id,productid,p_title,p_linkid) {
 document.getElementById("unlike"+id).style.display="inline";
 document.getElementById("like"+id).style.display="none";
 ajax.update('/perl/like.cgi?do=like&amp;PID='+id+'&amp;P_Title='+p_title+'&amp;P_LinkID='+p_linkid,"Update"+productid);
 }
 function unlike(id,productid) {
 document.getElementById('unlike'+id).style.display="none";
 document.getElementById('like'+id).style.display="inline";
 ajax.update('/perl/like.cgi?do=unlike&amp;PID='+id,"Update"+productid);
 }
var ref = escape(parent.window.document.referrer);
var tag = 'http://www.theukhighstreet.com/perl/sitestats.cgi?Title=' + Title + '&Referer=' + ref + '&GroupType=' + GroupType + '&GroupID=' + GroupID;
document.write('<img border="0" src="'+ tag +'" width="1" height="1" alt="">');
 function insert_db () {
 FB.getLoginStatus(function(response) {
 if (response.session) {
 mylogin();
 } else {
	FB.login(function(response) {
 if (response.session) {
 mylogin();
 }
	}
 // ,{perms:'email'}
 );
 }
 });
 }
 function share_on_fb(id,p_title,productid,p_description,p_image,title,p_linkid,type) {
 FB.init({appId: 'fe8f223b4b65fe8fe6676bd228269c99'});
 var var_attachment, actionlinks;
 if (type=='product'){
 var_attachment = {'name': p_title,'href':'http://www.theukhighstreet.com/_PD'+productid,'caption':p_description,'media':[{'type':'image','src': p_image,'href':'http://www.theukhighstreet.com/_PD'+productid}]};
 actionlinks = [{ 'text':'View this product','href':"http://www.theukhighstreet.com/_PD"+productid},{'text':'See all products from' + title, 'href': 'http://www.theukhighstreet.com/_P'+p_linkid}];
 } else if (type=='special') {
 var_attachment = {'name': p_title,'href':'http://www.theukhighstreet.com/special/'+p_linkid+'/'+id,'caption':'This is a special offer for '+title+' on TheUKHighStreet.com.','media':[{'type':'image','src': p_image,'href':'http://www.theukhighstreet.com/_L'+p_linkid}]};
 actionlinks = [{ 'text':'View this offer','href':"http://www.theukhighstreet.com/special/"+p_linkid+'/'+id},{'text':'See all offers from' + title, 'href': 'http://www.theukhighstreet.com/_S'+p_linkid}];
 }
 var share = {
 method : 'stream.publish',
 message : "",
 attachment: var_attachment,
 action_links: actionlinks,
 user_prompt_messsage: 'Add a comment:'
 };
 FB.ui(share, function(response) { console.log(response);});
 }
function mylogin() {
 var url = gup('url');
 var fbuser = FB.getSession() ? FB.getSession().uid : null;
 if (fbuser) {
 ajax.update('/perl/fblogin.cgi?login=1&amp;fbuser=' + fbuser+'&amp;url='+url, 'logindiv');
 var loginbar = document.getElementById("loginbar");
 loginbar.innerHTML =
 "<ul><li class='welcome'>Welcome. You are signed in with your Facebook account.</li>" + "<li class='fb-square'><fb:profile-pic uid='loggedinuser' size='square' facebook-logo='true'/></li><li><a href='/perl/user.cgi?logout=1'>LOGOUT</a></li>" + '<li><a href="/forum/do=message_list">MESSAGES</a></li><li><a href="/perl/myshops.cgi">MYSHOPS</a></li><li>MY PROFILE</li></ul>';
 if (document.getElementById('myshops_right')){
 document.getElementById('myshops_right').innerHTML = "You are now logged in. Refresh the page to see your Myshops list";
 }
 if (document.getElementById('logoutdiv')){
 document.getElementById('logoutdiv').innerHTML="";
 }
 }
}
function gup( name )
{
 name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
 var regexS = "[\\?&]"+name+"=([^&#]*)";
 var regex = new RegExp( regexS );
 var results = regex.exec( window.location.href );
 if( results == null )
 return "";
 else
 return results[1];
}
