function pulse()

{

 if (document.getElementById('effects'))
	 {
		 Effect.Pulsate('effects');
	 }
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}



function removeEmail(theObj)
{
	if (theObj.value!='')
	{theObj.value='';}
}
function removePassword(theObj)
{
		if (theObj.value!='')
		{theObj.value='';}
}

function convertToUpperCase( obj )
{
	
	var Str = obj.value;
	var strUpper ;
	if (Str)
	{
		strUpper= Str.toUpperCase();
		//alert(strUpper);
		obj.value=strUpper;
	}
}


function clearDeltioForm()
{	
	 for (var i = 0; i < 10; i++)
	 {
	 		$('Deltio_displayName'+i).innerHTML='';	 		
	 		$('col1'+i).style.display='none';
 	 		$('col2'+i).style.display='none';

	 }
	$('totalFormAmount').innerHTML=''; 
}


function pausecomp(millis)
{
	var date = new Date();
	var curDate = null;
	
	do { curDate = new Date(); }
	while(curDate-date < millis);
} 


function forceLang(obj)
{
    var Str = obj.value;
    var str = '';
    var c = '';
    for (var i = 0; i < Str.length; i++)
    {
        c = Str.substring(i, i + 1);
        if (c == 'A' || c == 'a' || c == 'a' || c == '?')
        {
            c = '?'
        }
        if (c == 'B' || c == 'b' || c == 'ß')
        {
            c = '?'
        }
        if (c == 'C' || c == 'c' || c == '?')
        {
            c = '?'
        }
        if (c == 'D' || c == 'd' || c == 'd')
        {
            c = '?'
        }
        if (c == 'E' || c == 'e' || c == 'e' || c == '?')
        {
            c = '?'
        }
        if (c == 'F' || c == 'f' || c == 'f')
        {
            c = 'F'
        }
        if (c == 'G' || c == 'g' || c == '?')
        {
            c = 'G'
        }
        if (c == 'H' || c == 'h' || c == '?' || c == '?')
        {
            c = '?'
        }
        if (c == 'I' || c == 'i' || c == '?' || c == '?' || c == '?' || c == '?')
        {
            c = '?'
        }
        if (c == 'J' || c == 'j' || c == '?')
        {
            c = '?'
        }
        if (c == 'K' || c == 'k' || c == '?')
        {
            c = '?'
        }
        if (c == 'L' || c == 'l' || c == '?')
        {
            c = '?'
        }
        if (c == 'M' || c == 'm' || c == 'µ')
        {
            c = '?'
        }
        if (c == 'N' || c == 'n' || c == '?')
        {
            c = '?'
        }
        if (c == 'O' || c == 'o' || c == '?' || c == '?')
        {
            c = '?'
        }
        if (c == 'P' || c == 'p' || c == 'p')
        {
            c = '?'
        }
        if (c == 'Q' || c == 'q' || c == ';')
        {
            c = ''
        }
        if (c == 'R' || c == 'r' || c == '?')
        {
            c = '?'
        }
        if (c == 'S' || c == 's' || c == 's' || c == '?')
        {
            c = 'S'
        }
        if (c == 'T' || c == 't' || c == 't')
        {
            c = '?'
        }
        if (c == 'U' || c == 'u' || c == '?')
        {
            c = 'T'
        }
        if (c == 'V' || c == 'v' || c == '?' || c == '?')
        {
            c = 'O'
        }
        if (c == 'W' || c == 'w' || c == '?')
        {
            c = 'S'
        }
        if (c == 'X' || c == 'x' || c == '?')
        {
            c = '?'
        }
        if (c == 'Y' || c == 'y' || c == '?' || c == '?' || c == '?' || c == '?')
        {
            c = '?'
        }
        if (c == 'Z' || c == 'z' || c == '?')
        {
            c = '?'
        }
        str = str + c
    }
    obj.value = str;
}



function FixFlash()
{
	theObjects = document.getElementsByTagName("object");
	for (var i = 0; i < theObjects.length; i++) 
	{
		theObjects[i].outerHTML = theObjects[i].outerHTML;
	}
}



function initializeGmaps()
{



    if (GBrowserIsCompatible())
    {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(37.984257, 23.762054), 9);

        // Add 10 markers to the map at random locations
        var bounds = map.getBounds();
        var southWest = bounds.getSouthWest();
        var northEast = bounds.getNorthEast();
        var lngSpan = northEast.lng() - southWest.lng();
        var latSpan = northEast.lat() - southWest.lat();


        var baseIcon = new GIcon();
        baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
        baseIcon.iconSize = new GSize(20, 34);
        baseIcon.shadowSize = new GSize(37, 34);
        baseIcon.iconAnchor = new GPoint(9, 34);
        baseIcon.infoWindowAnchor = new GPoint(9, 2);
        baseIcon.infoShadowAnchor = new GPoint(18, 25);


        function createMarker(point, index, info)
        {
            // Create a lettered icon for this point using our icon class
            var letter = String.fromCharCode("A" .charCodeAt(0) + index);
            var letteredIcon = new GIcon(baseIcon);
            letteredIcon.image = "http://s48.development.atcom.gr/www.telemarketing.gr/templates/default/images/icon_map.png";

            markerOptions = 
            {
                icon: letteredIcon
            };
            var marker = new GMarker(point, markerOptions);

            GEvent.addListener(marker, "click", function()
            {
                marker.openInfoWindowHtml("Marker <b>" + info + "</b>"); 
            }
            );
            return marker;
        }

        for (var i = 0; i < 10; i++)
        {
            var point = new GLatLng(southWest.lat() + latSpan * Math.random(),
                southWest.lng() + lngSpan * Math.random());
            // map.addOverlay(new GMarker(point));
            map.addOverlay(createMarker(point, i,"ff"));
        }
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
    }
}
    
 
    
    
function openWindow(theTarget, windowName, Properties)
	{
	var newWin = window.open(theTarget, windowName, Properties);
	newWin.focus();
	}

function goTo(theForm, theAction, theTarget){
	//backup previous values
	backUpAction = theForm.action;
	backUpTarget = theForm.target;
	//feed new values and submit
	theForm.action = theAction;
	theForm.target = theTarget;
	theForm.submit();
	//restore original values
	theForm.action = backUpAction;
	theForm.target = backUpTarget;
}

function DeltioTotalAmount()
{
	var TotalAmount;
 	var price0 = document.getElementById('Deltio_displayPriceHidden0').value;
 	var price1 = document.getElementById('Deltio_displayPriceHidden1').value;
	var price2 = document.getElementById('Deltio_displayPriceHidden2').value;
	var price3 = document.getElementById('Deltio_displayPriceHidden3').value;
	var price4 = document.getElementById('Deltio_displayPriceHidden4').value;
	var price5 = document.getElementById('Deltio_displayPriceHidden5').value;
	var price6 = document.getElementById('Deltio_displayPriceHidden6').value;
	var price7 = document.getElementById('Deltio_displayPriceHidden7').value;
	var price8 = document.getElementById('Deltio_displayPriceHidden8').value;
	var price9 = document.getElementById('Deltio_displayPriceHidden9').value;
	//alert(price0);
	
	price0 = price0.replace(",",".")
	price0 = FormatNumber(price0,3,false,false,'.')
	//alert(price0);
	price1 = price1.replace(",",".")
	price2 = price2.replace(",",".")
	price3 = price3.replace(",",".")
	price4 = price4.replace(",",".")
	price5 = price5.replace(",",".")
	price6 = price6.replace(",",".")
	price7 = price7.replace(",",".")
	price8 = price8.replace(",",".")
	price9 = price9.replace(",",".")
	
	if (price0.length==0) {price0=0;} 
	if (price1.length==0) {price1=0;}
	if (price2.length==0) {price2=0;}
	if (price3.length==0) {price3=0;}
	if (price4.length==0) {price4=0;}
	if (price5.length==0) {price5=0;}
	if (price6.length==0) {price6=0;}
	if (price7.length==0) {price7=0;}
	if (price8.length==0) {price8=0;}
	if (price9.length==0) {price9=0;}
	//alert(price0);
	//alert(price1);
	//alert(price2);
	TotalAmount = parseFloat(price0)+parseFloat(price1)+parseFloat(price2)+parseFloat(price3)+parseFloat(price4)+parseFloat(price5)+parseFloat(price6)+parseFloat(price7)+parseFloat(price8)+parseFloat(price9);
	//alert(TotalAmount);
	var result = Math.round(TotalAmount*100)/100
	//var result = parseInt((TotalAmount * 100) )/ 100
	//alert(TotalAmount);
	//alert(result);
	var resultCommas = result.toFixed(2)
	var resultCommasF = resultCommas.replace(".",",")
	if (isNaN(result))	
	{
		//document.getElementById('totalFormAmount').innerHTML = '0';
	}
	else
	{
		document.getElementById('totalFormAmount').innerHTML = resultCommasF + '&nbsp; &euro;';
	}
}


function FormatNumber(num,decimalNum,bolLeadingZero,bolParens,bolCommas)
/**********************************************************************
	IN:
		NUM - the number to format
		decimalNum - the number of decimal places to format the number to
		bolLeadingZero - true / false - display a leading zero for
										numbers between -1 and 1
		bolParens - true / false - use parenthesis around negative numbers
		bolCommas - put commas as number separators.
 
	RETVAL:
		The formatted number!
 **********************************************************************/
{ 
        if (isNaN(parseInt(num))) return "NaN";

	var tmpNum = num;
	var iSign = num < 0 ? -1 : 1;		// Get sign of number
	
	// Adjust number so only the specified number of numbers after
	// the decimal point are shown.
	tmpNum *= Math.pow(10,decimalNum);
	tmpNum = Math.round(Math.abs(tmpNum))
	tmpNum /= Math.pow(10,decimalNum);
	tmpNum *= iSign;					// Readjust for sign
	
	
	// Create a string object to do our formatting on
	var tmpNumStr = new String(tmpNum);

	// See if we need to strip out the leading zero or not.
	if (!bolLeadingZero && num < 1 && num > -1 && num != 0)
		if (num > 0)
			tmpNumStr = tmpNumStr.substring(1,tmpNumStr.length);
		else
			tmpNumStr = "-" + tmpNumStr.substring(2,tmpNumStr.length);
		
	// See if we need to put in the commas
	if (bolCommas && (num >= 1000 || num <= -1000)) {
		var iStart = tmpNumStr.indexOf(".");
		if (iStart < 0)
			iStart = tmpNumStr.length;

		iStart -= 3;
		while (iStart >= 1) {
			tmpNumStr = tmpNumStr.substring(0,iStart) + "," + tmpNumStr.substring(iStart,tmpNumStr.length)
			iStart -= 3;
		}		
	}

	// See if we need to use parenthesis
	if (bolParens && num < 0)
		tmpNumStr = "(" + tmpNumStr.substring(1,tmpNumStr.length) + ")";

	return tmpNumStr;		// Return our formatted string!
}


function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
else 
countfield.value = maxlimit - field.value.length;
}



function handleGifts(obj)
{
	var isChecked = obj.checked
	var giftRButtons = document.getElementsByName("selGift");
	if (isChecked==true)
	{
		document.getElementById('send_gift').style.display='block';
		for (i = 0; i < giftRButtons.length; i++)
			{
				giftRButtons[i].checked = false;
				giftRButtons[i].disabled = true;
			}
	}
	else
	{
		document.getElementById('send_gift').style.display='none';
		for (i = 0; i < giftRButtons.length; i++)
			{
				//if (i==0){giftRButtons[i].checked = true}
				giftRButtons[i].disabled = false;
			}
		
	}
}

function removeValue(theObj)
	{
		if (theObj.value!='')
			{
				theObj.value='';
			}
	}
	
function manageBigCartShipType( countryID )
{
	var chboxPost = document.getElementById('rdShipMini1');
	var chboxCourier = document.getElementById('rdShipMini2');
	

	if (countryID != 210)
	{
		chboxCourier.checked=true;
		chboxPost.disabled=true;
	}
}


function toggleMC(obj,countryID) {
	
	var el = document.getElementById(obj);
		//alert('ddd');
	var chboxPost = document.getElementById('rdShipMini1');
	var chboxCourier = document.getElementById('rdShipMini2');
	
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';		
		document.MinicountrySelect.submit();		
	}
	else {
		el.style.display = 'block';	
		
	}
	
	if (countryID != 210)
	{
		chboxCourier.checked=true;
		chboxPost.disabled=true;
	}
}


function toggleText(obj,text1,text2) {
	var myObjVal = document.getElementById(obj).innerHTML;
	var myTrimedOldVal = TrimString(myObjVal);
	var myTrimedNewVal1 = TrimString(text1);
	var myTrimedNewVal2 = TrimString(text2);
	//alert(myTrimedOldVal);
	
	if (myTrimedOldVal==myTrimedNewVal1)
		{document.getElementById(obj).innerHTML=text2;}
	else
		{document.getElementById(obj).innerHTML=text1}
	
}

function TrimString(sInString) {
  sInString = sInString.replace( /^\s+/g, "" );// strip leading
  return sInString.replace( /\s+$/g, "" );// strip trailing
}

function toggleLayer(obj) {
	var el = document.getElementById(obj);
		
	
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';					
	}
	else {
		el.style.display = 'block';	
	}	
	
}

function showLayerTable_row(obj) {
	var el = document.getElementById(obj);
	var browserName=navigator.appName;
	
	if (el){
		if (browserName=="Netscape")
		{
			
			el.style.display = 'table-row';	
			
		}
		else
		{			
			el.style.display = 'block';				
		}
	}
}


function toggleLayerTable_row(obj) {
	var el = document.getElementById(obj);
	var browserName=navigator.appName;
	
	if (el){
		if (browserName=="Netscape")
		{
			if ( el.style.display != 'none' ) {
				el.style.display = 'none';					
			}
			else {
				el.style.display = 'table-row';	
			}	
		}
		else
		{
			if ( el.style.display != 'none' ) {
				el.style.display = 'none';					
			}
			else {
				el.style.display = 'block';	
			}	
		}
	}
}


function miniCartRD(myObj)
{
	var CountryCode = myObj.value;
	var chboxPost = document.getElementById('rdShipMini1');
	var chboxCourier = document.getElementById('rdShipMini2');
	
	
	if (CountryCode != 210)
	{
		
		chboxCourier.checked=true;
		chboxPost.disabled=true;
	}		
	else
	{
		chboxPost.disabled = false;
	}

	
	
}

