<!--

function CopyToClipboard()

{
   document.Form1.txtArea.focus();
   document.Form1.txtArea.select();
   CopiedTxt = document.selection.createRange();
   CopiedTxt.execCommand("Copy");
}

function displayCopyButton(){

if (navigator.appName == "Microsoft Internet Explorer"){
	document.write("<br><a href=\"javascript:CopyToClipboard()\">Copy Keywords to Clipboard</a>")
	}

}



function submit(form){
	document.forms[form].submit();
}


function submit2(){
document.Form1.action ="index.php?tool=power-posting-tool";
document.Form1.submit();
}

function launch(theURL) {
		window.open('tools/'+theURL,'ToolsWindow','width=800, height=740, toolbar=0, resizable=0, status=0, menubar=0, scrollbars=0, directories=0, location=0');
		if (window.focus){ToolsWindow.focus();}
}


function createGoogle(){

	var CampaignName = document.Form1.CampaignName.value;
	var CPC = document.Form1.CPC.value;
	var AdgroupNames = document.Form1.AdgroupNames.value;
	var Keywords = document.Form1.Keywords.value;
	var AdTitle_1 = document.Form1.AdTitle_1.value;
	var AdTitle_2 = document.Form1.AdTitle_2.value;
	var AdLine1_1 = document.Form1.AdLine1_1.value;
	var AdLine1_2 = document.Form1.AdLine1_2.value;
	var AdLine2_1 = document.Form1.AdLine2_1.value;
	var AdLine2_2 = document.Form1.AdLine2_2.value;
	var AdDisplayURL_1 = document.Form1.AdDisplayURL_1.value;
	var AdDisplayURL_2 = document.Form1.AdDisplayURL_2.value;
	var AdDestinationURL = document.Form1.AdDestinationURL.value;

		if(CampaignName && CPC && AdgroupNames && Keywords && AdTitle_1 && AdTitle_2 && AdLine1_1 && AdLine1_2 && AdLine2_1 && AdLine2_2 && AdDisplayURL_1 && AdDisplayURL_2 && AdDestinationURL){
			
			if (Form1.Broad.checked == false && Form1.Phrase.checked == false && Form1.Exact.checked == false){
				alert('Atleast one keyword matching type must be selected');
			}else{submit('Form1');}

		}
		else{
			alert('All Fields Are Required');
		}
}

function createYSM(){
	submit('Form1');
}

function createMSN(){
	submit('Form1');
}

function check(){

	var field = document.Form1.keywords.value;

	if(field){
		submit('Form1');
	}
	else{
		alert('All Fields Are Required');
	}
}

function DynamicLimit(ElementId,Display,Type){

	MxLength=35;
		
	if(Type=="T"){
		MxLength=25;
	}
	
	if(Type=="D"){
		MxLength=70;
	}

	taObj=document.getElementById(ElementId);
	
	var s =taObj.value;
	
	if(Type!="D"){
		if(Type=="T"){
			if((s.match('{keyword:') || s.match('{keyWord:') || s.match('{KeyWord:') || s.match('{Keyword:')) && s.match('}')){
				MxLength = 35;
			}
		}else{
			if((s.match('{keyword:') || s.match('{keyWord:') || s.match('{KeyWord:') || s.match('{Keyword:')) && s.match('}')){
				MxLength = 45;
			}
		}
	}

	taLength=taObj.value.length; // look at current length
	
	if (taLength>MxLength) { // clip characters
		taObj.value = taObj.value.substring(0,MxLength);
	}
	taLength=taObj.value.length; oldLength=0;
	while (oldLength<taLength) { //validate characters
		tChar=taObj.value.charAt(oldLength);
		oldLength++;
	}
	dispObj=document.getElementById(Display);
	dispObj.innerHTML=(MxLength-taObj.value.length);
	
	if(dispObj.innerHTML=='0'){
		dispObj.style.color='red';
	}else{
		dispObj.style.color='#909090';
	}
}

//-->
