/***********************************************
* DD Tab Menu II script- ? Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//Set tab to intially be selected when page loads:
//[which tab (1=first tab), ID of tab content to display]:
var initialtab=[1, "sc1"]

//Turn menu into single level image tabs (completely hides 2nd level)?
var turntosingle=0 //0 for no (default), 1 for yes

//Disable hyperlinks in 1st level tab images?
var disabletablinks=0 //0 for no (default), 1 for yes

////////Stop editting////////////////

var previoustab=""

if (turntosingle==1)
document.write('<style type="text/css">\n#tabcontentcontainer{display: none;}\n</style>')

function expandcontent(cid, aobject){
if (disabletablinks==1)
aobject.onclick=new Function("return false")
if (document.getElementById && turntosingle==0){
highlighttab(aobject)
if (previoustab!="")
document.getElementById(previoustab).style.display="none"
document.getElementById(cid).style.display="block"
previoustab=cid
}
}

function highlighttab(aobject){
if (typeof tabobjlinks=="undefined")
collectddimagetabs()
for (i=0; i<tabobjlinks.length; i++)
tabobjlinks[i].className=""
if (aobject != null)
 {
  aobject.className="current"
 }
}

function collectddimagetabs(){
var tabobj=document.getElementById("slidetabsmenu")
tabobjlinks=tabobj.getElementsByTagName("a")
}

/*2010-3-30 begin*/
function newPopup(url) {
	popupWindow = window.open(
		url,'popUpWindow','height=320,width=320,left=250,top=220,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=yes')
}
/*****************/
function setVisible(obj_id, ref_obj)
{
	obj = document.getElementById(obj_id);
	obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
	placeIt (obj_id, ref_obj);
}
function placeIt(obj_id, ref_obj)
{
	obj = document.getElementById(obj_id);
	x = findPos (ref_obj)[0]-339;
	y = findPos (ref_obj)[1]-120;
	obj.style.left = x + 'px' ;
	obj.style.top = y + 'px' ;
}
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}
function setDivText(option) {
switch (option) {
	case 'free_shipping':
	divText = '<span style="font-size:14px;font-weight:bold;color:#cc0000;">Free Shipping!</span><br><br>We provide <strong>Free Shipping</strong> for this product!<br /><br />DHL Worldwide Express shipping service will be used to deliver the product to your address. Usually, the shipping time for DHL Worldwide Express is only <strong>3-5</strong> days. For further details, please click <a href="/conditions.html#privacy" target="_blank"><strong>HERE</strong></a>.<br /><br /><strong>NOTE</strong>: This Free Shipping is only available to the following countries:<br / ><br / ><span style="color:#cc0000;">United States, Canada, Hong Kong and Macau.</span>';
	break;
	case 'wholesale_info':
	divText = '<span style="font-size:14px;font-weight:bold;color:#cc0000;">Wholesale Information</span><br><br><span style="color:#cc0000;">We offer discounted wholesale prices for every product in our store. The minimum order quantity starts from a very small number to give you more flexibility and the wholesale price varies depending on the size of your order.</span><br /><br />You can find wholesale price info on the <strong>Add To Cart</strong> tab. For bulk orders, you can also negotiate with our <a href="/index.php?main_page=page_wholesale#contact" target="_blank">Account Managers</a> for a even better price.<br /><br />The wholesale price list for each product can be downloaded <a href="/index.php?main_page=page_wholesale#pricelist" target="_blank"><strong>HERE</strong></a>.';
	break;
	case 'payment_methods':
	divText = '<span style="font-size:14px;font-weight:bold;color:#cc0000;">Payment Methods Available</span><br><br>We make paying for your orders easy by providing several convenient payment options:<br/><br/><ul><li>PayPal</li><li>Credit Cards</li><li>Western Union</li><li>Wire Transfer</li></ul><br/>For retail purchases in our webstore, you can pay with PayPal or Credit Card.<br /><br />For bulk orders closed with our <a href="/index.php?main_page=page_wholesale#contact" target="_blank">Account Managers</a>, you can pay with PayPal, Western Union or Wire Transfer. For detailed information about these payment methods, please visit our <a href="/index.php?main_page=page_directpayment" target="_blank"><strong>Direct Payment Page</strong></a>.';
	break;
	case 'shipping_methods':
	divText = '<span style="font-size:14px;font-weight:bold;color:#cc0000;">Shipping Methods</span><br><br><span style="color:#cc0000;">When you place an order with ManyADeal Online, you are emailed a confirmation of your order. Once your order is shipped, you will receive an email with the tracking information.</span> <br /><br />ManyADeal Online offers three different shipping methods (Availability varies depending on which country you are from):<br/><br/><ul><li>DHL Express: Normally takes 3 to 5 days;</li><li>EMS Express: Normally takes 5 to 7 days;</li><li>TNT Express: Normally takes 8 to 12 days;</li></ul><br/>You can choose whichever method suits you best when you place an order.<br/>For further details, please click <a href="/conditions.html#privacy" target="_blank"><strong>HERE</strong></a>.';
	break;
	case 'well_packaged':
	divText = '<span style="font-size:14px;font-weight:bold;color:#cc0000;">Professionally Packaged Products</span><br><br>All orders will be shipped out from our warehouse in China using express shipping services such as DHL, EMS and TNT. To avoid damages during transit, all products purchased from our store will be packaged by a professional delivery team and examined carefully before handed over to the shipping courier. ';
	break;
	}
document.getElementById('pop_text_para').innerHTML = divText;
}

/*2010-3-30 end*/

function do_onload(){
if (document.getElementById("slidetabsmenu") != null)
{
collectddimagetabs()
expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])
}
//do_tabmagic()
//ShowTabs()
var w3c=(document.getElementById)?true:false;
var ns4=(document.layers)?true:false;
var ie4=(document.all && !w3c)?true:false;
 
	obj_event = (ie4)?document.all['event_bg']:document.getElementById('event_bg');
	if (obj_event) events_onload();

}

function do_tabmagic(focustab) {
	if (focustab != undefined){
		previoustab=initialtab[1]
		initialtab=[focustab, "sc"+focustab]
	}
	//Hack for Attribs to be default checked
	var attribcontainer = document.getElementById('productAttributes_tab')
	if (attribcontainer != undefined) {
		var attritems = attribcontainer.getElementsByTagName("input");
	}
	if (attritems != undefined) {
		for (var n = 0; n<attritems.length; n++){
			if (attritems[n].getAttribute('checked') == "checked") {
			  attritems[n].checked=true;
			}
		}	
	}
	// Hide real versions and remove _tab suffix to replace real versions.
	var tabmain= document.getElementById('tabcontentcontainer')
	if (tabmain != undefined) {
		var tabContainer= tabmain.getElementsByTagName("*");
	}
	var productDetails= document.getElementById('productDetailsList');
	var productDetailstab= document.getElementById('productDetailsList_tab');
	if (tabContainer != undefined) {
		var hackArr = new Array();
		var NewArr = new Array();
		
		hackArr[0] = document.getElementById('cartAdd');
		hackArr[1] = document.getElementById('productDetailsList');
		hackArr[2] = document.getElementById('productAttributes');
		hackArr[3] = document.getElementById('productQuantityDiscounts');
		hackArr[4] = document.getElementById('productAdditionalImages');
		hackArr[5] = document.getElementById('alsoPurchased');
		hackArr[6] = document.getElementById('crossSell');
		hackArr[7] = document.getElementById('reviewsDefault');
		hackArr[8] = document.getElementById('productDescription');
		hackArr[9] = document.getElementById('attribsOptionsText');
		hackArr[10] = document.getElementById('productMainImage');
		hackArr[11] = document.getElementById('productName');
		hackArr[12] = document.getElementById('productPrices');
		hackArr[13] = document.getElementById('freeShippingIcon');
		
		NewArr[0] = document.getElementById('cartAdd_tab');
		NewArr[1]  = document.getElementById('productDetailsList_tab');
		NewArr[2] = document.getElementById('productAttributes_tab');
		NewArr[3]  = document.getElementById('productQuantityDiscounts_tab');
		NewArr[4]  = document.getElementById('productAdditionalImages_tab');
		NewArr[5] = document.getElementById('alsoPurchased_tab');
		NewArr[6] = document.getElementById('crossSell_tab');
		NewArr[7]  = document.getElementById('reviewsDefault_tab');
		NewArr[8]  = document.getElementById('productDescription_tab');
		NewArr[9]  = document.getElementById('attribsOptionsText_tab');
		NewArr[10] = document.getElementById('productMainImage_tab');
		NewArr[11] = document.getElementById('productName_tab');
		NewArr[12] = document.getElementById('productPrices_tab');
		NewArr[13] = document.getElementById('freeShippingIcon_tab');
		

		for (var j = 0; j<hackArr.length; j++){
			if (hackArr[j] != undefined) {
				 for (var i = 0; i<tabContainer.length; i++){
				 sTmp = tabContainer[i].id.split("_");
					 if(hackArr[j].id == sTmp[0]) {
						////alert(sTmp[0] + '(' + j + ') = ' + hackArr[j].id + '(' + j + ')');
						////alert(hackArr[j].innerHTML);
						 hackArr[j].style.display="none";
						 hackArr[j].innerHTML='';
						 hackArr[j].outerHTML='';
						 break;
					 }
				 }	
			}
		}

		if (hackArr[8] != undefined) {
			hackArr[8].style.display="none";
		}				

		for (var j = 0; j<NewArr.length; j++){
			if (NewArr[j] != undefined) {
				for (var i = 0; i<tabContainer.length; i++){
					if(tabContainer[i].id == NewArr[j].id)  {
						sTmp = NewArr[j].id.split("_");
						NewArr[j].id=sTmp[0];
						break;
					}
				}	
			}
		}
	}
	
	
}

function ShowTabs() {
	var tppblock = document.getElementById('tpptabBlock')
	if (tppblock != undefined) {
		tppblock.style.display = 'block';
	}
}

if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload
