function ClearText(objectID, message)
{
    if(objectID.value == message)
    {
        objectID.value='';
    }
}
function blockError(){return true;}
function FillText(objectID, message)
{
    if(objectID.value=='')
    {
        objectID.value=message;
    }
}
function UncheckOtherRadioButton(redId)
{
    var str = '';
    var elem = document.forms[0].elements;
    for(var i = 0; i < elem.length; i++)
    {
        str = elem[i].type;
        if(str=="radio")
        {
            document.getElementById(elem[i].id).checked = false;
        }        
    }
     document.getElementById(redId).checked = true;
}
var musicURL="";
function getFlashMovie(movieName) {
      var isIE = navigator.appName.indexOf("Microsoft") != -1;
      return (isIE) ? window[movieName] : document[movieName];
}

function getFlash(swfID,radioId)
{
    if(radioId != undefined && radioId != '')
    {
        UncheckOtherRadioButton(radioId);
    }
	if(navigator.appName.indexOf("Microsoft")!=-1)
	{
		return document.getElementById(swfID);
	}
	else
	{
		return document[swfID]
	}
}

function stopMusicStreaming()
{
    getFlash('PreviewPlayer').stopStreaming();
}

 function PassMusicPath1(redId,musicPath)
{
    UncheckOtherRadioButton(redId);
    //musicPath = "resources/mp3/Airtel.mp3";
    if(musicPath != ""){
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    var container = (isIE) ? document : window;
    container["PreviewPlayer"].sendMusicURL(musicPath,true);
    }
}
 function PassMusicPath2(musicPath,isPlay)
{
    if(musicPath != "")
    {
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    var container = (isIE) ? document : window;
    container["PreviewPlayer"].sendMusicURL(musicPath,isPlay);
    }
}
function refreshShoppingCart()
{
 __doPostBack('ctl00$mainCart$LinkButton1','')
 //alert("Refresh Shopping Cart...");
}
window.onerror = blockError;


function CheckUploadBeforeNavigation(redirectPage)
{
    //getFlash('FileUploadApp').checkUploadStatus(redirectPage);
    //alert(redirectPage+":"+getFlash('FileUploadApp'));
    if(getFlash('FileUploadApp') == null || getFlash('FileUploadApp') == undefined )
    {
        //alert(redirectPage);
        window.location=redirectPage;
    }
    else
    {
        //alert(redirectPage+":"+getFlash('FileUploadApp'));
        getFlash('FileUploadApp').checkUploadStatus(redirectPage);
    }
}


function DisableEnableCalculateLink(isEnabled)
{
    var hlink = document.getElementById('ctl00_mainCart_lnkCalculateTax');
    if(isEnabled)
    {   
       hlink.href ="javascript:__doPostBack('ctl00$mainCart$lnkCalculateTax','')";
       hlink.className = "royalLink"; 
    }
    else
    {
        hlink.removeAttribute("href");
        //hlink.removeAttribute("class");
        hlink.className = "disabledLink"; 
    }
}

function validateAndCopyShippingPhoneHoliday(phone1, phone2, phone3,phoneNo,phoneNoBill)
{
    chkSameBillingAddress = this.document.getElementById('ctl00__contentBody_chkSameBillingAddress');
    ctrlPh1 = this.document.getElementById(phone1);
    ctrlPh2 = this.document.getElementById(phone2);
    ctrlPh3 = this.document.getElementById(phone3);
    part1 = ctrlPh1.value.trim();
    part2 = ctrlPh2.value.trim();
    part3 = ctrlPh3.value.trim();
    var num = part1 + part2 + part3;
    
    ctrlPh = this.document.getElementById(phoneNo);
    ctrlPhBill = this.document.getElementById(phoneNoBill);
    
    if(num.length > 0)
    {
        ctrlPh.value = "(" + part1 + ")" + part2 + "-" + part3;
        
        if(chkSameBillingAddress.checked)
        {
            ctrlPhBill.value = "(" + part1 + ")" + part2 + "-" + part3;
        }
    }
    else
    {
        ctrlPh.value ="";
        
        if(chkSameBillingAddress.checked)
        {
            ctrlPhBill.value ="";
        }
    }
    
    //alert(num);
    if(num.length == 0)
    {   
        //alert("Shipping phone number blank.");
        return;
    }
    else if(num.length != 10)
    {
        //alert("Insert valid shipping phone number.");
        return;
    }
    if(chkSameBillingAddress.checked)
    {
        billingPh1 = this.document.getElementById('ctl00__contentBody_txtBPhoneNumberPart1');
        billingPh2 = this.document.getElementById('ctl00__contentBody_txtBPhoneNumberPart2');
        billingPh3 = this.document.getElementById('ctl00__contentBody_txtBPhoneNumberPart3');
        billingPh1.value = part1;
        billingPh2.value = part2;
        billingPh3.value = part3;
    }
}
function validateBillingPhoneHoliday(phone1, phone2, phone3,phoneNo)
{
    ctrlPh1 = this.document.getElementById(phone1);
    ctrlPh2 = this.document.getElementById(phone2);
    ctrlPh3 = this.document.getElementById(phone3);
    part1 = ctrlPh1.value.trim();
    part2 = ctrlPh2.value.trim();
    part3 = ctrlPh3.value.trim();
    var num = part1 + part2 + part3;
    
    ctrlPh = this.document.getElementById(phoneNo);
    
    if(num.length > 0)
    {
        ctrlPh.value = "(" + part1 + ")" + part2 + "-" + part3;
    }
    else
    {
        ctrlPh.value ="";
    }
    
    if(num.length == 0)
    {   
        //alert("Billing phone number blank.");
    }
    else if(num.length != 10)
    {
        //alert("Insert valid billing phone number.");
    }
}
function validateShippingPhoneHoliday(phone1, phone2, phone3,phoneNo)
{
    ctrlPh1 = this.document.getElementById(phone1);
    ctrlPh2 = this.document.getElementById(phone2);
    ctrlPh3 = this.document.getElementById(phone3);
    part1 = ctrlPh1.value.trim();
    part2 = ctrlPh2.value.trim();
    part3 = ctrlPh3.value.trim();
    var num = part1 + part2 + part3;
    
    ctrlPh = this.document.getElementById(phoneNo);
    
    if(num.length > 0)
    {
        ctrlPh.value = "(" + part1 + ")" + part2 + "-" + part3;
    }
    else
    {
        ctrlPh.value ="";
    }
    
    if(num.length == 0)
    {   
        //alert("Shipping phone number blank.");
        return;
    }
    else if(num.length != 10)
    {
        //alert("Insert valid Shipping phone number.");
    }
}
function validateAndCopyShippingPhone(phone1, phone2, phone3, phoneNo,phoneNoBill)
{
    chkSameBillingAddress = this.document.getElementById('ctl00__contentBody_chkSameBillingAddress');
    ctrlPh1 = this.document.getElementById(phone1);
    ctrlPh2 = this.document.getElementById(phone2);
    ctrlPh3 = this.document.getElementById(phone3);
    part1 = ctrlPh1.value.trim();
    part2 = ctrlPh2.value.trim();
    part3 = ctrlPh3.value.trim();
    var num = part1 + part2 + part3;
    //alert(num);
    if(num.length == 0)
    {   
        //alert("Shipping phone number blank.");
    }
    else if(num.length != 10)
    {
        //alert("Insert valid shipping phone number.");
    }
    if(chkSameBillingAddress.checked)
    {
        billingPh1 = this.document.getElementById('ctl00__contentBody_txtBPhoneNumberPart1');
        billingPh2 = this.document.getElementById('ctl00__contentBody_txtBPhoneNumberPart2');
        billingPh3 = this.document.getElementById('ctl00__contentBody_txtBPhoneNumberPart3');
        billingPh1.value = part1;
        billingPh2.value = part2;
        billingPh3.value = part3;
    }
    
    ctrlPh = this.document.getElementById(phoneNo);
    ctrlPhBill = this.document.getElementById(phoneNoBill);
    
    if(num.length > 0)
    {
        ctrlPh.value = "(" + part1 + ")" + part2 + "-" + part3;
        if(chkSameBillingAddress.checked)
        {
            ctrlPhBill.value = "(" + part1 + ")" + part2 + "-" + part3;
        }
    }
    else
    {
        ctrlPh.value ="";
        if(chkSameBillingAddress.checked)
        {
            ctrlPhBill.value ="";
        }
    }
}

function validateBillingPhone(phone1, phone2, phone3,phoneNo)
{
    ctrlPh1 = this.document.getElementById(phone1);
    ctrlPh2 = this.document.getElementById(phone2);
    ctrlPh3 = this.document.getElementById(phone3);
    part1 = ctrlPh1.value.trim();
    part2 = ctrlPh2.value.trim();
    part3 = ctrlPh3.value.trim();
    var num = part1 + part2 + part3;
    
    ctrlPh = this.document.getElementById(phoneNo);
    
    if(num.length > 0)
    {
        ctrlPh.value = "(" + part1 + ")" + part2 + "-" + part3;
    }
    else
    {
        ctrlPh.value ="";
    }
    
    if(num.length == 0)
    {   
        //alert("Billing phone number blank.");
    }
    else if(num.length != 10)
    {
        //alert("Insert valid billing phone number.");
    }
}

function validateShippingPhone(phone1, phone2, phone3,phoneNo)
{
    ctrlPh1 = this.document.getElementById(phone1);
    ctrlPh2 = this.document.getElementById(phone2);
    ctrlPh3 = this.document.getElementById(phone3);
    part1 = ctrlPh1.value.trim();
    part2 = ctrlPh2.value.trim();
    part3 = ctrlPh3.value.trim();
    var num = part1 + part2 + part3;
    
    ctrlPh = this.document.getElementById(phoneNo);
    
    if(num.length > 0)
    {
        ctrlPh.value = "(" + part1 + ")" + part2 + "-" + part3;
    }
    else
    {
        ctrlPh.value ="";
    }
    
    if(num.length == 0)
    {   
        //alert("Shipping phone number blank.");
    }
    else if(num.length != 10)
    {
        //alert("Insert valid Shipping phone number.");
    }
}
