
function compare_addPhone(phn_id)
{if(phn_id==''||phn_id==null)
{reportMsgBox("Error: No phones Specified");return false;}
var compare_str=readCookie('compare_str');if(compare_str=="")
{compare_str=phn_id;createCookie('compare_str',compare_str,1);return true;}
else
{compare_str+="|"+phn_id;createCookie('compare_str',compare_str,1);return true;}}
function addCompareRow(phn_id,phn_name)
{var compareBasketConDIV=document.getElementById("compareBasketConID");var compareBasketFooterDIV=document.getElementById("compareBasketFooterID");compareBasketConDIV.style.display='block';compareBasketFooterDIV.style.display='block';phn_name_full=phn_name;if(phn_name.length>18)
{phn_name=phn_name.substring(0,18)+"..";}
var phn_block='<div id="compareBasketPhoneBlockID" class="compareBasketPhoneBlock">';phn_block+=' <a onmouseover="Tip(\''+phn_name_full+'\', CLICKCLOSE, true, BGCOLOR, \'#fff\', FONTSIZE, \'10px\', FONTWEIGHT, \'bold\', FONTCOLOR, \'#bf3802\', BORDERWIDTH, 1, BORDERCOLOR, \'#827F79\', DELAY, 0, FADEIN, 0, FADEOUT, 0, COPYCONTENT, false, CENTERMOUSE, true, OFFSETY, 10, ABOVE, true);" onmouseout="UnTip();"><div class="compareBasketPhoneNameDIV">'+phn_name+'</a></div>';phn_block+=' <div class="compareBasketRemoveDIV" onmouseover="this.className=\'compareBasketRemoveDIVHover\';" onmouseout="this.className=\'compareBasketRemoveDIV\';" onclick="removeFromCart('+phn_id+');"><!-- --></div>';phn_block+='</div>';var compareBasketConDIV=document.getElementById("compareBasketConID");var phoneConDIV=document.createElement("div");phoneConDIV.id="compareBasketPhnConID"+phn_id;phoneConDIV.innerHTML=phn_block;compareBasketConDIV.appendChild(phoneConDIV);}
function countCompareBasket()
{var compare_str=readCookie('compare_str');var basketCount=0;if(compare_str!=null&&compare_str!="")
{basketCount=compare_str.split("|").length;}
return basketCount;}
function addToCart(phn_id,phn_name)
{if(countCompareBasket()<10)
{if(readCookie('compare_str')==null)
{createCookie('compare_str',phn_id,1);addCompareRow(phn_id,phn_name);}
else
{if(!compare_isExist(phn_id))
{compare_addPhone(phn_id);addCompareRow(phn_id,phn_name);}
else
{reportMsgBox("Phone already in Compare Basket");}}}
else
{reportMsgBox("10 Phones can be Compared at a time");}}
