document.write('<script type="text/javascript" src="/jsc/htm.js"></script>');
document.write('<script type="text/javascript" src="/jsc/_page/ads.js"></script>');
//document.write('<script type="text/javascript" src="/jsc/jquery.js"></script>');
//document.write('<script type="text/javascript" src="/jsc/jquery.color.js"></script>');

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
var __digoogler = 'iPad';
function f_BelowTopBanner() {
document.write('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ');
document.write('<a href="/">Home</a> &nbsp; | &nbsp;');
document.write('<a href="/Specials/Back-to-School.aspx">Back to School</a> &nbsp; | &nbsp;');
document.write('<a href="/view/Latest-Deals-Coupons.aspx">Latest Deals and Coupons</a> &nbsp; | &nbsp;');
document.write('<a href="/Specials/Coupon.aspx">Latest Coupons</a> &nbsp; | &nbsp;');
document.write('<a href="/view/Deal-of-the-Day.aspx">Deal of the Day</a> &nbsp; | &nbsp;');
document.write('<a href="/view/Search-All-Deals.aspx">Top 6 Deals</a> &nbsp; | &nbsp;');
document.write('<a href="/view/Most-Viewed-Deals-Coupons.aspx">Most Viewed</a> &nbsp; | &nbsp;');
document.write('<a href="/DealCouponSiteList.aspx">Deal & Coupon Sites</a> &nbsp; | &nbsp;');
document.write('<a href="/DealCouponOneDaySiteList.aspx">One Day Deal Sites</a>');
}
function getImageTop(elem) {
 yPos = elem.offsetTop;
 tempEl = elem.offsetParent;
 while (tempEl != null) {
  yPos += tempEl.offsetTop;
  tempEl = tempEl.offsetParent;
 }
 return yPos;
}
function getImageLeft(elem) {
 xPos = elem.offsetLeft;
 tempEl = elem.offsetParent;
 while (tempEl != null) {
  xPos += tempEl.offsetLeft;
  tempEl = tempEl.offsetParent;
 }
 return xPos;
}
function ShowFullImg(sImg) {
 if (!document.getElementById("imgPop")) { AddDiv("divImg",""); AddImg("divImg","imgPop"); }
 var imgPop=document.getElementById('imgPop');
 var divImg=document.getElementById('divImg');
 if(!imgPop || !divImg || !sImg) return;
 imgPop.src=sImg.src;
 divImg.style.left = getImageLeft(sImg) + 'px' ;
 divImg.style.top = getImageTop(sImg) + 'px' ;
 CurrImgItemID = sImg.id;
 ShowByID("divImg");
}
function HideImg() { HideByID("divImg"); }
function HideByID(_ID) {with(document.getElementById(_ID).style){visibility="hidden";display="none";}}
function ShowByID(_ID) {with(document.getElementById(_ID).style){visibility="visible";display="";}}
function SetShowFullImg() {
var allHTMLTags=document.getElementsByTagName("img");
for (i=0; i<allHTMLTags.length; i++)
   if (allHTMLTags[i].className=="tnail") 
   {var imgtochk = allHTMLTags[i]; //.complete)
    if (imgtochk.id == "imgPop") continue;
    if (imgtochk.src == "") continue;
    if (imgtochk.src.indexOf("http://feed") >= 0) { if (imgtochk.src.indexOf("dealitem") < 0) continue;}
    if (imgtochk.src.indexOf(".com/image-") >= 0) continue;
    if (imgtochk.src.indexOf("assoc-amazon") >= 0) continue;   
    if (typeof imgtochk.naturalWidth != "undefined" && imgtochk.naturalWidth == 0){imgtochk.width="0";continue;} 
    imgtochk.onmouseover=new Function('ShowFullImg(this)');
   }
var allHTMLTags=document.getElementsByTagName("div");
for (i=0; i<allHTMLTags.length; i++)
   if (allHTMLTags[i].className=="red_star score") 
   {allHTMLTags[i].title='No of times this item is viewed';}
}
function ShowSD(_ID) {HideByID("sd1");HideByID("sd2");HideByID("sd3");HideByID("sd4");ShowByID(_ID);}
function RipDeal(strSearch) {
 strSearch = strSearch.replace(/\+/g, "-")
 strSearch = strSearch.replace(/ /g, "-")
 strSearch = strSearch.replace(/\%2b/gi, "-")
 window.open('/Shopping/Compare/Coupons/Deals/' + strSearch + '.aspx', '_blank')
}

function AddDiv(DivID, DivinnerHTML) {
 var newDiv=document.createElement('div');
 newDiv.id=DivID;
 newDiv.className='divImg';
 newDiv.innerHTML=DivinnerHTML;
 document.body.appendChild(newDiv);
}
function AddImg(divID, imgID) {
 var ni = document.getElementById(divID);
 var newimg = document.createElement('img');
 newimg.id = imgID;
 newimg.className='imgPop';
 newimg.onmouseout=new Function('HideImg(this)'); 
 newimg.onclick=new Function('ShowDescr(this)'); 
 ni.appendChild(newimg);
}

function ShowDescr() {
var DescrSrc;
CurrImgItemID = CurrImgItemID.substr(3);
if ((CurrImgItemID *1) > 200000){DescrSrc = "/Deal/" + CurrImgItemID + "/ShowDetail.aspx";}
if ((CurrImgItemID *1) > 0 && (CurrImgItemID *1) < 200000){DescrSrc = "/DOD/" + CurrImgItemID + "/ShowDetail.aspx";}
if (window == top) window.location.href = DescrSrc;
else top.location.href = DescrSrc;  
} 
function f_SendtoFriend(SendtoFriendURL, SendtoFriendSub, SendtoFriendText){
var winSendtoFriendURL='/SendtoFriend/?action=1&url=' + encodeURIComponent(SendtoFriendURL) + '&sub=' + encodeURIComponent(SendtoFriendSub) + '&text=' + encodeURIComponent(SendtoFriendText);
winSendtoFriend = window.open(winSendtoFriendURL,'SendtoFriend', 'width=330,height=610,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,copyhistory=no,resizable=no,left=20,top=40,screenX=0,screenY=0');winSendtoFriend.focus();
}
function GoToPage(PageNo){
document.getElementById("p").value = PageNo;
//document.getElementById("p1").value = PageNo;
document.getElementById("formpaging").submit();
}
function SetBookMark(){ 
var dealtitle , dealurl;
dealtitle = "Dealitem.com: Daily Deals at one place for Smart People."; 
dealurl = "http://www.Dealitem.com";
if (window.sidebar) 
{ // Mozilla Firefox Bookmark
	window.sidebar.addPanel(dealtitle, dealurl,"");
} else if( window.external ) 
{ // IE Favorite
	window.external.AddFavorite( dealurl, dealtitle); }
else if(window.opera && window.print) 
{ // Opera Hotlist
	return true; 
}
}
function ShowDealTV(){
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;
}
//alert(myHeight);
myHeight = 565;
newwindow=window.open('DealitemBargainsTV.aspx','TV','height=' + myHeight + ',width=650,left=100,top=10,resizable=yes,scrollbars=no,toolbar=no,status=no,title=no');
}
function f_SendtoFriend2(SendtoFriendID,SendtoFriendIDNo){
var SendtoFriendURL, SendtoFriendSub, SendtoFriendText,SendtoFriendA;
if(SendtoFriendIDNo==1){
SendtoFriendSub=document.getElementById("da" + SendtoFriendID).firstChild.data;
SendtoFriendURL='http://Dealitem.com/Deal/'+SendtoFriendID+'/ShowDetail.aspx';
}else{
SendtoFriendSub=document.getElementById("la" + SendtoFriendID).firstChild.data;
SendtoFriendURL='http://Dealitem.com'+document.getElementById("la" + SendtoFriendID).href;
}
var winSendtoFriendURL='/SendtoFriend/?action=1&url=' + encodeURIComponent(SendtoFriendURL) + '&sub=' + encodeURIComponent(SendtoFriendSub) + '&text=' + encodeURIComponent(SendtoFriendText);
winSendtoFriend = window.open(winSendtoFriendURL,'SendtoFriend', 'width=330,height=610,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,copyhistory=no,resizable=no,left=20,top=40,screenX=0,screenY=0');winSendtoFriend.focus();
return false;
}
function _digoogler(){ window.location = 'http://www.dealitem.com/Search/?cx=partner-pub-4529939482294707%3Abyfa6d2a5r2&cof=FORID%3A11&ie=ISO-8859-1&q=' + __digoogler + '&siteurl=dealitem.com%2Fsearch%2F#1400'; } 
function _dilogin(userName,userRole){document.getElementById('_DILoginBlock').innerHTML='<span class="content_12_arial_yellow"><a href="/DealCouponUserHome.aspx">My Account</a></span><br /><span class="content_12_arial_white">Welcome ' + userName + '</span> &nbsp; &nbsp; <span class="content_12_arial_yellow"><a href="#" onclick="javascript:_dilogoff()">Log off</a></span>';return false;}
function _dilogoff(){document.createElement('DIV').innerHTML='<iframe width=0 height=0 src="/DealCouponUserLogOff.aspx" onload="location.reload(true);"></iframe>';document.body.appendChild(d);return false;}
