
var ajax = new sack();
var ajax2 = new sack();
function loadcontent(fileName){
	ajax.requestFile = fileName;
	ajax.method = 'GET';
	ajax.element = 'Content';
	ajax.runAJAX();
}
function loadpage(fileName,page_name){
	ajax.setVar("page_name", page_name);
	ajax.requestFile = fileName;
	ajax.method = 'GET';
	ajax.element = 'Content';
	ajax.runAJAX();
}

function addtocompare(fileName,fileName2,offer){
	var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

	 var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
	
	if (document.getElementById('addtocompare_button_off-'+offer)) {document.getElementById('addtocompare_button_off-'+offer).style.display='none'; }
	if (document.getElementById('addtocompare_button_feat_off-'+offer)) {document.getElementById('addtocompare_button_feat_off-'+offer).className='addToCompare featuredCompare compared_compare_btn1'; }
	if (document.getElementById('addtocompare_button_feat_info_off-'+offer)) {document.getElementById('addtocompare_button_feat_info_off-'+offer).className='moreInfo featuredInfo compared_info_btn1'; }
	if (document.getElementById('addtocompare_button_simple_off-'+offer)) {document.getElementById('addtocompare_button_simple_off-'+offer).className='addToCompare simpleInfo compared_compare_btn2'; }
	if (document.getElementById('addtocompare_button_simple_info_off-'+offer)) {document.getElementById('addtocompare_button_simple_info_off-'+offer).className='moreInfo simpleInfo compared_info_btn2'; }
	if (document.getElementById('off-'+offer))
	{
		if (document.getElementById('off-'+offer).className=='product featured') {document.getElementById('off-'+offer).className='product featured_compared';}
		if (document.getElementById('off-'+offer).className=='product simple') {document.getElementById('off-'+offer).className='product simple_compared';}
		if (document.getElementById('off-'+offer).className=='singleOffer') {document.getElementById('off-'+offer).className='singleOffer_compared';}
	}
	

	//document.getElementById('compare_alert').style.display='block';
	
	document.getElementById('compare_alert').style.top=parseInt((scrOfY+myHeight/2)-50)+'px';
	document.getElementById('compare_alert').style.left=parseInt((scrOfX+myWidth/2)-100)+'px';
	//document.getElementById('glass_background').style.display='block';
	document.getElementById('glass_background').style.top=parseInt(scrOfY)+'px';
	document.getElementById('glass_background').style.left=parseInt(scrOfX)+'px';
	ajax2.setVar("add_offer", offer);
	ajax2.setVar("remove_offer", "0");
	ajax2.requestFile = fileName2;
	ajax2.method = 'GET';
	ajax2.element = 'compare_alert';
	ajax2.runAJAX();
	

	var g=setTimeout("closealert(document.getElementById('closealert_call1').innerHTML,document.getElementById('closealert_call2').innerHTML)",2500);

	var t=setTimeout("closealert2(document.getElementById('closealert_call1').innerHTML,document.getElementById('closealert_call2').innerHTML)",500);

	
	ajax.setVar("add_offer", offer);
	ajax.setVar("remove_offer", "0");
	ajax.requestFile = fileName;
	ajax.method = 'GET';
	ajax.element = 'CompareDivWesterlike';
	ajax.runAJAX();
	
	//window.setTimeout(document.getElementById('user_submit').onclick,0);
}
function closealert(error,offer) {
if(error == 'yes') { 
if (document.getElementById('addtocompare_button_off-'+offer)) {document.getElementById('addtocompare_button_off-'+offer).style.display='block'; }
	if (document.getElementById('addtocompare_button_feat_off-'+offer)) {document.getElementById('addtocompare_button_feat_off-'+offer).className='addToCompare featuredCompare'; }
	if (document.getElementById('addtocompare_button_feat_info_off-'+offer)) {document.getElementById('addtocompare_button_feat_info_off-'+offer).className='moreInfo featuredInfo'; }
	if (document.getElementById('addtocompare_button_simple_off-'+offer)) {document.getElementById('addtocompare_button_simple_off-'+offer).className='addToCompare simpleCompared'; }
	if (document.getElementById('addtocompare_button_simple_info_off-'+offer)) {document.getElementById('addtocompare_button_simple_info_off-'+offer).className='moreInfo simpleInfo'; }
if(document.getElementById('off-'+offer)) {
		if (document.getElementById('off-'+offer).className=='product featured_compared') {document.getElementById('off-'+offer).className='product featured';}
		if (document.getElementById('off-'+offer).className=='product simple_compared') {document.getElementById('off-'+offer).className='product simple';}
		if (document.getElementById('off-'+offer).className=='singleOffer_compared') {document.getElementById('off-'+offer).className='singleOffer';}
	}
	
	
}
document.getElementById('compare_alert').style.display='none';
document.getElementById('glass_background').style.display='none';
}
function closealert2(error,offer) {
if(error == 'yes') { 
if (document.getElementById('addtocompare_button_off-'+offer)) {document.getElementById('addtocompare_button_off-'+offer).style.display='block'; }
	if (document.getElementById('addtocompare_button_feat_off-'+offer)) {document.getElementById('addtocompare_button_feat_off-'+offer).className='addToCompare featuredCompare'; }
	if (document.getElementById('addtocompare_button_feat_info_off-'+offer)) {document.getElementById('addtocompare_button_feat_info_off-'+offer).className='moreInfo featuredInfo'; }
	if (document.getElementById('addtocompare_button_simple_off-'+offer)) {document.getElementById('addtocompare_button_simple_off-'+offer).className='addToCompare simpleCompared'; }
	if (document.getElementById('addtocompare_button_simple_info_off-'+offer)) {document.getElementById('addtocompare_button_simple_info_off-'+offer).className='moreInfo simpleInfo'; }
if(document.getElementById('off-'+offer)) {
		if (document.getElementById('off-'+offer).className=='product featured_compared') {document.getElementById('off-'+offer).className='product featured';}
		if (document.getElementById('off-'+offer).className=='product simple_compared') {document.getElementById('off-'+offer).className='product simple';}
		if (document.getElementById('off-'+offer).className=='singleOffer_compared') {document.getElementById('off-'+offer).className='singleOffer';}
	}
	

}
if (document.getElementById('closealert_call1').innerHTML == 'yes')
{
document.getElementById('compare_alert').style.display='block';
document.getElementById('glass_background').style.display='block';
}
}

function removefromcompare(fileName,offer){
	if (document.getElementById('addtocompare_button_off-'+offer)) {document.getElementById('addtocompare_button_off-'+offer).style.display='block'; }
	if (document.getElementById('addtocompare_button_feat_off-'+offer)) {document.getElementById('addtocompare_button_feat_off-'+offer).className='addToCompare featuredCompare'; }
	if (document.getElementById('addtocompare_button_feat_info_off-'+offer)) {document.getElementById('addtocompare_button_feat_info_off-'+offer).className='moreInfo featuredInfo'; }
	if (document.getElementById('addtocompare_button_simple_off-'+offer)) {document.getElementById('addtocompare_button_simple_off-'+offer).className='addToCompare simpleCompared'; }
	if (document.getElementById('addtocompare_button_simple_info_off-'+offer)) {document.getElementById('addtocompare_button_simple_info_off-'+offer).className='moreInfo simpleInfo'; }
	if(document.getElementById('off-'+offer)) {
		if (document.getElementById('off-'+offer).className=='product featured_compared') {document.getElementById('off-'+offer).className='product featured';}
		if (document.getElementById('off-'+offer).className=='product simple_compared') {document.getElementById('off-'+offer).className='product simple';}
		if (document.getElementById('off-'+offer).className=='singleOffer_compared') {document.getElementById('off-'+offer).className='singleOffer';}
	}
	
	ajax.setVar("add_offer", "0");
	ajax.setVar("remove_offer", offer);
	ajax.requestFile = fileName;
	ajax.method = 'GET';
	ajax.element = 'CompareDivWesterlike';
	ajax.runAJAX();
}
function goToURL2(url) {
window.location = url;
}
function ShowHide(div) {
	if (document.getElementById(div).style.display == 'block') 
	{ document.getElementById(div).style.display='none'; }
	else { document.getElementById(div).style.display='block'; }
}
function ShowHideOffers(num,resulttext,pages) {
	for(i=1;i<=pages;i++)
	{
		if (i == num) 
		{ 
			document.getElementById('OffersDiv'+i).style.display='block'; 
			document.getElementById('pagenum'+i+'top').className='page active'; 
			document.getElementById('pagenum'+i+'bottom').className='page active'; 
		}
		else 
		{ 
			document.getElementById('OffersDiv'+i).style.display='none'; 
			document.getElementById('pagenum'+i+'top').className='page inactive'; 
			document.getElementById('pagenum'+i+'bottom').className='page inactive'; 
		}
	}
	document.getElementById('resultnum').innerHTML = resulttext;
        window.scrollTo(0,0);
}
function ShowHideArticles(num,resulttext,pages) {
	for(i=1;i<=pages;i++)
	{
		if (i == num) 
		{ 
			document.getElementById('ArticlesDiv'+i).style.display='block'; 
			document.getElementById('pagenum'+i+'top').className='page active'; 
			document.getElementById('pagenum'+i+'bottom').className='page active'; 
		}
		else 
		{ 
			document.getElementById('ArticlesDiv'+i).style.display='none'; 
			document.getElementById('pagenum'+i+'top').className='page inactive'; 
			document.getElementById('pagenum'+i+'bottom').className='page inactive'; 
		}
	}
	document.getElementById('resultnum').innerHTML = resulttext;
	window.scrollTo(0,0);
}