function redirectParent()
{
    var targetUrl ='/spportal/spportalFlow.do?_flowId=pfc-flow';
    window.opener.location.href = targetUrl ;

    if (window.opener.progressWindow)

    {
        window.opener.progressWindow.close()
    }
    window.close();
}
                      
 function contactUsClearForm()
        {
            var inputs = document.getElementsByTagName('input');
            var selectboxes = document.getElementsByTagName('select');
            var textArea = document.getElementById('message');
            
            for(var i=0;i<inputs.length;++i)
            {
                if(inputs[i].type == 'text')
                {
                    inputs[i].value = '';
                }
            }
            for(var i=0;i<selectboxes.length;++i)
            {
                selectboxes[i].selectedIndex = 0;
            }
            textArea.value = '';

        }
                            
function roi(url) 
{
    popWin = window.open(url, "roi", "width=808px,height=500px,menubar=0,status=0,titlebar=0,toolbar=0,scrollbars=1,resizable=1");
    initPopUpBlockerTimer();
}
    
    
function closePopUp()
{
    
    //alert('closing window!');
    self.close();
    //window.close();
}

function putcookie()
{
    //alert('setting cookie!');
    var days = 90;
    var name="zoomerangsurvey";
    var value = "declined";
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
    document.cookie = name+"="+value+expires+"; path=/";
    //alert('cookie set!');
}


 
  function editcontact()
    {   
        //document.forms[0].method="POST";
        //document.forms[0].action="/spweb/pageflows/myaccount/editUserInfo.do";
        //document.forms[0].submit();
          document.forms[getNetuiTagName("UserInfo",this)].submit();
    }
function editemail()
    {
        //document.forms[0].method="POST";
        //document.forms[0].action="/spweb/pageflows/myaccount/editUserEmail.do";
        //document.forms[0].submit();
        document.forms[getNetuiTagName("UserEmail",this)].submit();
    }
    
    
//  shoppingcart SEO

function disableConfirm() 
    {
        needToConfirm = false;
    }
    
 function enableConfirm()
    {
        needToConfirm = true;
    }
        
       
 function remove()
       {
            var result=checkRemoveProduct();
            
            if(result!=false)
            {
             
              document.forms[getNetuiTagName('purchase_complete_order')].submit(); 
             
            }  
            
       }
       

  
          
	
	function submitPPCNewAd(event,formId){
		document.forms[formId]["_eventId_findMore"].name="_eventId_" + event;
		document.forms[formId].submit(); 
	}    


//signin seo
//Added the function "hideFooter" in order to fix the issue #22429

function hideFooter()
{
	var obj = document.getElementsByName("utility_nav");
	var rtn = false;
    	if (obj != null) 
        {
         	obj.display = "none";
            rtn = true;
	     }
       return rtn;
}

//function to display the next image in the animation sequence
function Switch() {                
    document.animatedimage.src = anim[imgNumber].src;
    imgNumber++;
           //if we've reached the last image, start over form the first image
           if(imgNumber >= totalimgNumber) imgNumber = 0;
    }
    
//function to start the animation, calls the switch() every 'delay' microseconds
function animate() {
    Switch();
    setTimeout( "animate()", delay);
    }


  function whoisPopUp(extension,domainname) {
       
            var targetUrl='/spweb/pageflows/browseproducts/products/websites/fullservice/whois.do'+'?extClicked='+extension+'&domainname='+domainname
            popWin = window.open(targetUrl, "WhoIsInformation", "width=735, height=460,toolbar=0, status=0, scrollbars=1");
            initPopUpBlockerTimer();
        }
        

		function validateAdTitle(elementValue)
		 {
		   // function to restrict pipe char from the ad title text field
		    
			if (elementValue.indexOf("|")==-1)
			{
				return true;
			}
		    return false;
		 } 

		function validateText(element)
			      {
			       
			       var elementValue = element.value;               
			        
			     
			    if (validateAdTitle(elementValue))
			    {
					var value = elementValue;
					var chk=/[a-zA-Z_ _0-9!@#$%^&*()_+-=\[\]{}:;\'?.,<>™© ®áÁéÉíÍóÓúÚñÑüÜ¿¡]/ ;
					var namechk=new RegExp(chk);
					var flag = false;
					var enterFlag = false;
						
					var char1 = "";
					for (var i=0; i<value.length; i++) {
								
						indVal = "" + value.substring(i, i+1);
						
						
						if(!(namechk.exec(indVal)))
						{								
							if( indVal == '\r')
							{
								char1 +=  '<enter>' +',';
								enterFlag=true;
							}
							else if( indVal == '\n' )
							{
			
							}
							else if( i != value.length )
							{								
								char1 +=  indVal + ',';
								
							}
							flag = true;
						}
					}
												
					char1 = char1.substring(0,char1.length-1);
					
				if( flag == true )
				{
				alert( "The following characters are not supported : \r\n" + char1 + "\r\n Please revise your text to continue.");
				if(enterFlag!=true){
				elementValue = elementValue.substring(0,elementValue.length-1);				
				element.value = elementValue;								
				return false;
				}
				else{
				elementValue = elementValue.substring(0,elementValue.length-2);
				element.value = elementValue;
				//return false;
				} 
			document.forms[0].submit();  	
			}					
			  			   
		}
		else{
			alert(" The following character is not supported : | "+ "\r\n Please revise your text to continue.");
			elementValue = elementValue.substring(0,elementValue.length-1);		
			element.value = elementValue;
			return false;
        }
			}
			
function producedvideo(item)
{
	var contentIds= new Array("how","shoot","tips");
	var navIds= new Array("how-nav","shoot-nav","tips-nav");
	tabbedNavigationShow(item,contentIds,'left-nav-off','selected-left-nav',navIds);
}
		 	
function selfvideo(item)
{
	var contentIds= new Array("how","cost","builder");
	var navIds= new Array("how-nav","cost-nav","builder-nav");
	tabbedNavigationShow(item,contentIds,'left-nav-off','selected-left-nav',navIds);
}
function montagevideo(item)
{
	var contentIds= new Array("how","shoot","tips");
	var navIds= new Array("how-nav","shoot-nav","tips-nav");
	tabbedNavigationShow(item,contentIds,'left-nav-off','selected-left-nav',navIds);
}
function searchengine(item)
{
    var contentIds= new Array("how","cost","search");
    var navIds= new Array("how-nav","cost-nav","search-nav");
    tabbedNavigationShow(item,contentIds,'left-nav-off','selected-left-nav',navIds);
}
function privacypolicy() {
     var targetUrl =  '/spportal/privacypolicy.do'
     popWin = window.open(targetUrl,"privacypolicy","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=820, height=620");
     initPopUpBlockerTimer();
}  

//	******************************
//	* SML Product Page functions *
//	******************************
function showSMLProductPageVideo(ImageURL,videoName)
{	
	smlTabClick('sml-resources');
	var url= '"'+ImageURL+'/img-spportal/videos/'+videoName+'"';
	var autoPlayStr= 'SMLProductPageInsertVideo("'+ImageURL+'","spVideo"'+','+url+',true,350,290);';
	setTimeout(autoPlayStr,1500);
}
function loadSMLProductPageVideo(ImageURL,videoName)
{
	var url= '"'+ImageURL+'/img-spportal/videos/'+videoName+'"';
	var autoPlayStr= 'SMLProductPageInsertVideo("'+ImageURL+'","spVideo"'+','+url+',true,350,290);';
	setTimeout(autoPlayStr,1500);
}
function playSMLProductPageSWF(ImageURL,videoName)
{
	document.getElementById('spVideo').innerHTML='<embed src="/spportal/img-spportal/videos/idearc_sp.swf" width="350" height="290"></embed>';			
}
function turnOffSMLProductPageVideo()
{
	document.getElementById('spVideo').innerHTML="<img onclick=\"playSMLProductPageSWF('idearc_sp.swf')\" onmouseout=\"this.style.cursor='default'\" onmouseover=\"this.style.cursor='pointer'\" src=\"/spportal/img-spportal/banners/movieimage.jpg\" />"	
}
function smlTabClick(show_content_id)
{
	turnOffSMLProductPageVideo();
	//make an array of content holders ids
	var contentIDs=new Array();
	$('#sml-tabs-content > div').each(function(i){
	contentIDs[i]= $(this).attr('id');
	});
	
	//make an array of tab ids
	var tabIDs= new Array();
	$('#sml-tabs-nav > div').each(function(i){
	tabIDs[i]= $(this).attr('id');
	});
	tabbedNavigationShow(show_content_id,contentIDs,'sml-tab-button-navoff','sml-tab-button-navon',tabIDs);
}
function SMLProductPageInsertVideo(ImageURL,id,url, autoplay,w,h)
{
	 flashembed(id,	
	 	{
			src:ImageURL+'/img-spportal/flash/FlowPlayerDark.swf',
			width: w, 
			height: h,
			pulgins: {controls: null}
		},		
		{config: {   
			autoPlay: autoplay,
			autoBuffering: true,
			controlBarBackgroundColor:'0x606060',
			initialScale: 'scale',
			initialVolumePercentage: 100,
			videoFile: url
		}} 
	);
}

function smldemo(){
  var targetUrl =  'showSMLDemo.do';
       popWin = window.open(targetUrl, "smldemo", "width=857, height=595,toolbar=0, status=0");
            initPopUpBlockerTimer();
 
}