/* Javascript file to check if the main page has opened up in the frameset, if not it reloads the page with the frameset */

doLoad();

function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
function doLoad() {
	if (top.location == self.location){
		if (parent.document.URL){
			callingURL = parent.document.URL;
			if (callingURL.indexOf('http://')!=-1){
				callingURL = callingURL.substring(callingURL.indexOf('http://')+7,callingURL.length);
			}
			if (callingURL.indexOf('/')!=-1){
				linkURL = callingURL.substring(callingURL.indexOf('/')+1,callingURL.length);
				top.location.href = "/?" + linkURL;
				return;
			}
		}
	}
	if (top.basket) {
		if(Right(top.basket.location.href,16)=="basketoffers.cfm") top.basket.location.href="/Basket.cfm?action=display";
	}
	if (top.frames['titlebar'].document.getElementById('tab_Scopes')) {
		top.frames['titlebar'].checkTab();
	}
}
function oldoutputAdvert1()
{
document.writeln('<div align="center">');
document.writeln('<img src="/Images/Adverts/acc_footer.gif" width="376" height="466" border="0" usemap="#MapAdvert1" />');
document.writeln('<map name="Map" id="MapAdvert1">');
document.writeln('<area shape="rect" coords="19,46,174,143" href="/Categories/ShootingAccessories/GunSlips/" />');
document.writeln('<area shape="rect" coords="198,46,359,144" href="/Categories/ShootingAccessories/GunSlips/" />');
document.writeln('<area shape="rect" coords="20,145,175,240" href="/Categories/ShootingAccessories/Bipods/" />');
document.writeln('<area shape="rect" coords="198,145,358,239" href="/Categories/Shooting/Pellets" />');
document.writeln('<area shape="rect" coords="20,242,174,340" href="/Categories/Shooting/Targets" />');
document.writeln('<area shape="rect" coords="198,242,359,340" href="/Categories/ShootingAccessories/GunLampsFilters" />');
document.writeln('<area shape="rect" coords="20,342,175,438" href="/Categories/ShootingAccessories/RifleSlingsSwivels" />');
document.writeln('<area shape="rect" coords="198,342,359,439" href="/Categories/Shooting/PrechargingSystems" />');
document.writeln('</map>');
document.writeln('</div>');
}





function outputAdvertItem(title,img,linkadd)
{	
document.writeln('	 <div style="float:left;width:150px;margin:10px 5px 10px 5px;padding:0;">');
document.writeln('          <a href="'+linkadd+'" style="font-size: 12px;color:#333;text-decoration: none;">');
document.writeln('          <h3 style="text-align:left;margin:0;font-size: 12px;color:#333;font-weight:bold;text-decoration:none;">'+title+'</h3>');
document.writeln('          </a>');
document.writeln('          <a href="'+linkadd+'">');
document.writeln('			<img src="/Images/Adverts/Accessories/'+img+'" style="display:block;margin:3px;border:1px solid #777;">');
document.writeln('          </a>');
document.writeln('          <a href="'+linkadd+'" style="color:#cc0000;font-size: 9px;font-weight:bold;text-decoration: none;">');
document.writeln('          <p style="text-align:right;margin:0;color: #cc0000;font-size: 9px;font-weight:bold;text-decoration:underline;">Click Here</p>');
document.writeln('          </a>');
document.writeln('    	</div>');	
}
function outputAdvertItems() 
{
outputAdvertItem('Guncases','guncase.jpg','/Categories/ShootingAccessories/GunSlips/');
outputAdvertItem('Gunslips','gunslip.jpg','/Categories/ShootingAccessories/GunSlips/');
outputAdvertItem('Bipods and Supports','supports.jpg','/Categories/ShootingAccessories/Bipods/');
outputAdvertItem('Pellets','pellets.jpg','/Categories/Shooting/Pellets');
outputAdvertItem('Targets','targets.jpg','/Categories/Shooting/Targets');
outputAdvertItem('Hunting Lamps','huntinglamps.jpg','/Categories/ShootingAccessories/GunLampsFilters');
outputAdvertItem('Slings and Swivels','slings.jpg','/Categories/ShootingAccessories/RifleSlingsSwivels');
outputAdvertItem('Precharging and Pumps','precharge.jpg','/Categories/Shooting/PrechargingSystems');
}	
function outputAdvert1()
{
document.writeln('  <div style="display: block;text-align: center;">');
document.writeln('	<div style="width: 350px;padding:0;margin:20px auto 20px auto;border: 1px solid #777;">');
document.writeln('	<h2 style="background: #cccccc;padding:2px;margin:0;border-bottom: 1px solid #777;font-size: 16px;color: #333;text-align:center;">Accessories</h2>');
document.writeln(' 	<div style="padding:5px 0px 5px 0px;background: #eeeeee;">');
document.writeln('		<div style="clear:both;"></div>');
outputAdvertItems();
document.writeln('    	<div style="clear:both;"></div>');
document.writeln('    </div>');
document.writeln('</div>');
document.writeln('</div>');
}



function writeFooter()
{
document.writeln('<hr class="Footer_Rule" />')
document.writeln('<div id="Page_Footer">')
document.writeln('<a href="#top">Top</a> | <a href="/." target="_top">Home</a> | <a href="/sections/popups/sitemap.cfm">Sitemap</a> | <a href="/sections/popups/contact.html">How To Contact Us</a> | <a href="mailto:sales@uttings.com">Email Us</a><br />')
document.writeln('<a href="/sections/popups/terms.html">Terms &amp; Conditions</a> | <a href="/sections/popups/delivery.html">Delivery Charges</a><br />')
document.writeln('<a href="/sections/popups/comments.html">Customer Comments</a> | <a href="/sections/popups/companydetails.html">Company Details</a><br />')
document.writeln('</div>')
document.writeln('<div id="Page_Footer_Copyright">Copyright &copy; ' + getFY() + ' uttings.com</div>')
}
function writeFooter2()
{
document.writeln('<hr class="Footer_Rule" />')
document.writeln('<div id="Page_Footer">')
document.writeln('<a href="#top">Top</a> | <a href="/." target="_top">Home</a> | <a href="/sections/popups/sitemap.cfm">Sitemap</a> | <a href="/sections/popups/contact.html">How To Contact Us</a> | <a href="mailto:sales@uttings.com">Email Us</a><br />')
document.writeln('<a href="/sections/popups/airgunlaw2.html">Airgun Laws</a> | <a href="/sections/popups/terms.html">Terms &amp; Conditions</a> | <a href="/sections/popups/delivery.html">Delivery Charges</a><br />')
document.writeln('<a href="/sections/popups/faq.html">Frequently Asked Questions</a> | <a href="/sections/popups/comments.html">Customer Comments</a> | <a href="/sections/popups/companydetails.html">Company Details</a><br />')
document.writeln('<a href="/sections/popups/join.html">Clubs</a> | <a href="/sections/popups/young.html">Youngsters Shooting</a> | <a href="/sections/popups/org.html">Organisations</a> | <a href="/sections/popups/mags.html">Magazines</a>')
document.writeln('</div>')
document.writeln('<div id="Page_Footer_Copyright">Copyright &copy; ' + getFY() + ' uttings.com</div>')
}
function getFY() { var D = new Date; var YE 
          YE = Math.round(D.getTime() / 31556952000) + 1970 
          return YE + (D.getYear()-YE)%100 } 

